Test Data Setup Using API | Bondar Academy
Course: AI-based testing with testRigor
Module: Working with APIs
Instructor: Artem Bondar
Lesson Summary
In this lesson, we explore how to create test data using API calls to streamline the process of testing article deletion in an application. Overview Instead of manually creating an article through the UI, we can use API calls to automate this process, making it significantly faster. The steps include: Creating an article via API. Testing the deletion of the article through the UI. Process Steps Login Request: Use the users endpoint to obtain an access token by sending a POST request with user credentials. Create Article: Use the access token to send a POST request to the API create articles endpoint, including the article data in the request body. Validate Creation: Refresh the application UI to confirm the article has been created. Delete Article: Navigate to the article in the UI and delete it, confirming the deletion. Implementation Details In TestRigor, the following key elements are used: JSON Path: To extract values from the API response, such as the access token and article title. Authorization Header: Include the access token in the header for subsequent API requests. Reusable Rules: Refactor API calls into reusable rules for cleaner test scripts. By using API calls, we significantly reduce the time taken to create and delete test data compared to manual UI interactions. This method enhances the efficiency of the testing process.