Detailed Design of SCIM Test Suite
The Overall design of SCIM test suite is as follows:
Process Flow Diagram
Workflow Diagram of SCIM Suite
Test Data
- Format of test data is a JSON file which will be in below-mentioned formate
{ |
Test connection file
- Format of connection file to connect SCIM connector
{
url: "",
resourcesAvailable: []
}
CODE
Pseudo Code for Test Generator
@AutoConfigureMockMvc
@ContextConfiguration()
@WebMvcTest
class TestGenerator {
JSONParser parser = new JSONParser();
String input = null;
String resourceName = null;
@Autowired
private MockMvc mockMvc;
@Autowired
private TestValidator testValidator;
@BeforeEach
void setUp() throws IOException, ParseException {
//intialize input, resource name and connection
}
@AfterEach
void tearDown() {
// drop connection
}
@org.junit.jupiter.api.Test
@Order(1)
void test1() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/SCIM/v2/" + resourceName + "/Me")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().is5xxServerError())
.andReturn();
String actualResponseBody = mvcResult.getResponse().getContentAsString();
testValidator.validateTest1(actualResponseBody);
}
........................
........................
........................
}
JAVA
Test Validator PsudeoCode
@Service
class TestValidator {
public boolean validateTest1(String actualResponseBody) throws Exception {
//expected result rewad from testdata file
String expectedResult= readFromTestData();
// validate results
......................
..............................
// strore info in report using extent report framework api
........................
...................................
return true if validation is succesful else false.
}
........................
........................
........................
}
JAVA
Report Format:
Going to use extent report API to represent the test reports API
Extent Framework 4 - Community Edition
https://github.com/extent-framework/extentreports-java
Sample test report
http://extentreports.com/samples/spark/index.html#
Console Level Application
we can create this application as a console-level application using https://docs.spring.io/spring-shell/docs/current/reference/htmlsingle/
create SCIM connection file and test data file and store at a location in the same server where the test suite is running.
For Console level application
- select SCIM connection file using SelectSCIMConnection <fileLocation> shell command.
- select SCIM test data file using SelectSCIMTestData <fileLocation > shell command.
- execute test cases using executeAll shell command (if you did not select connection file or test data file then sample test file and connection will be used).
- execute selected test cases using executeSelected <list of test cases names> shell command (if you did not select connection file or test data file then sample test file and connection will be used).
- check last executed test results using check reports shell command.