Validation of Browser API Calls | Bondar Academy
Course: AI-based testing with testRigor
Module: Working with APIs
Instructor: Artem Bondar
Lesson Summary
In this lesson, we explore how to validate API calls made by a browser during application operations. This process helps ensure that the application behaves as expected. Key Concepts API Call Interception: By intercepting API calls, we can confirm that the correct requests are being made when user actions occur. Example Scenario: A likes counter for articles that increases or decreases likes based on user clicks. Request Types: The application makes a POST request to update likes and a DELETE request to decrease likes. Validation Process To validate API requests, follow these steps: Log in to the application. Trigger the API call by clicking the likes button. Intercept the API call and validate its properties. Validation Criteria Check that the API call is a POST request with a 200 response status. On the second click, validate that a DELETE request is made with the same endpoint and a 200 response status. Automation Example In the test framework, you can automate the validation using the following code structure: check that API call was made to POST with URL check that API call was made to DELETE with URL Additionally, you can validate request properties such as method , headers , and body . For request body validation, options include text , JSON , or JSON path . By following these steps, you can effectively validate the API calls in your web application. See you in the next lesson!