- In the API Maker, you can write test cases of your custom APIs and Utility classes.
Add new test case
- Give the name of the test case.
- Select the type of test cases from the Custom API | Utility class.
- If you select the Custom API as the Test cases type, in the next dropdown('Test Item') you have to select the custom API name for which you want to write the test cases.
- If you select the Utility class as the Test cases type, in the next dropdown('Test Item') you have to select the Utility class name for which you want to write the test cases.
- Add multiple mock methods for the test case.
- 'Method' is the API Maker's pre-defined API methods.
- In the 'Function argument' you have to select the data type and its value.
- 'Mock return value' is the expected value of the test case.
- Here, we can add more readable text to understand the test case.
Once you save the new test case you will get the default code of the test case like below.
- As you can see in the above code, we have an array of test case objects.
- Just write your test case name and define the assertion.
Execute / Run
- On clicking the 'Execute' button it will run all test cases of the current Test.
- On clicking the 'Run' button you will see there are checkboxes to select the test cases, and you can run the selected test cases.
- You will get the proper error details if your test cases are failed.
- If the test case was run successfully, it has the right(✓) symbol.
Another example of the test cases code.
- The 'GetClientSoftwareVersions', 'ClientSoftware', and 'CloudTypes' are imported from the utility classes.