General overview of API testing tools currently available, most popular options comparison. How to implement flexible solution that would allow not only to test APIs but could be reused to speed up UI tests up to x10 times.
• Can be used for both REST and SOAP • Reusable client • Easy to use, no need to worry about low-level details • Declarative type-safe interface • Lightweight
newApp = Execute.as(BUSINESS_ADMIN, ApiRequest::addRandomIndexedApp); step("Follow app as new user.", () -> new AppDetail<>(newApp.appID) .as(newUser.credentials()) .loginAndOpenByUrl() .followApp() .endSession()); Solution: UI Test example step("As admin add and delete new app version.", () -> new AppDetail<>(newApp.appID) .as(BUSINESS_ADMIN) .loginAndOpenByUrl() .addNewVersion() .enterVersionId("3.0") .enterVersionDescription(randomText(32)) .clickSaveButton() .deleteOnlyVersion() .endSession()); step("As app user check that app activity not visible on dashboard ", () -> new Dashboard<>() .as(newUser.credentials()) .loginAndOpenByUrl() .assertAppActivityDoesNotExist(newApp.name) .endSession()); }
Can’t send some random requests • All requests need to be defined in interface before use • Initial configuration can be complicated Conclusions: Downsides
add new tests • Easy to maintain code • No need to think about user session • All request/response details available in console • Convenient and readable reports • Easy to reuse in UI tests • From UI testing perspective: Before: ~2,5 hours, After: ~7 minutes Conclusions: Benefits