API testing automation consist of 5 major steps. Also make sure that API test cases should be executed with any order ,they should be independent of each other.
- Setup –> It involves calling common methods, or functions to perform tasks such as Initialize data, create objects, start services or setting machine states.Basically setup is about putting the system in to a known machine state required for test execution.
- Execution –> These are the statements to exercise API or sequence of API’s. It should include logging as well. If a test fails and you can not determine the failure from the log files, then probably you aren’t logging required information.
- Verification –> Evaluate execution outcomes. Compare actual results with expected one. Example – verify for error codes, verify output parameters, and many other.
- Reporting –> It records the outcome of the test. An automated test should be designed to log Pass / Fail / Blocked results
- Cleanup –> It basically means to return the system to its pre-test state by releasing memory, shutting down services and deleting files used by that test if required.