API Test Automation with ContextQA

ContextQA offers powerful tools for automating API tests, allowing you to validate API responses, status codes, and data integrity efficiently. This guide provides a step-by-step approach to setting up and executing API test cases in ContextQA.

Setting Up API Test Cases

1. Navigate to the Test Development Section

  • Log in to your ContextQA account.

  • Click on the pencil icon in the sidebar to access the Test Development section.

2. Click on Testcase

  • From the dropdown menu, select 'Testcase'.

3. Type API and Select API Template

  • In the template options, type 'API' in the search bar.

  • Select the API Template from the list.

4. Click on the Edit Icon

  • Click on the edit icon to start configuring your API test case.

5. Add Title

  • Enter a descriptive title for your API test case.

6. Select the Required HTTP Method

  • Choose the appropriate HTTP method (e.g., GET, POST, PUT, DELETE) based on the API you are testing.

7. Add the URL

  • Enter the URL of the API endpoint you want to test.

8. Click on Send

  • Click the 'Send' button to execute the API request.

9. View the Response Preview

  • After clicking 'Send', review the response preview to verify the API response.

  • This includes response body, headers, and status code.

10. Click on Next

  • Proceed to the next step by clicking 'Next'.

11. Add a Variable Name to Store Response

  • Define a variable name to store the API response for further use in verification.

12. Click on Next

  • Click 'Next' to move to the verification configuration.

13. Add JSON Path to Verify

  • Specify the JSON path for the data you want to verify in the API response.

14. Select the Required Verification Method

  • Choose the verification method (e.g., equals, contains) to check the data against the expected results.

15. Select the Data Type to Verify

  • Indicate the data type (e.g., string, number) of the expected value.

16. Enter the Expected Value in String Field

  • Input the expected value that the API should return.

17. Click on Status

  • Configure the status verification settings to ensure the response meets expectations.

18. Add Expected Status Value

  • Enter the expected status value (e.g., HTTP 200 for a successful request).

19. Click on Create

  • Click 'Create' to finalize and save your API test case.

  • Your API test case is now created successfully!

20. Click on Run

  • To execute the test case, click 'Run'.

21. Test Case Executing

  • The test case will begin executing. You can track its progress in real-time.

22. Executed Successfully

  • Once the test completes, you'll receive a notification indicating whether the test passed or failed based on your criteria.


Using ContextQA for API Automation

We'll now walk you through a step-by-step guide on how to create and execute an API test case using ContextQA.

Step 1: Navigate to the Test Development Section

  • Log in to ContextQA and navigate to the Test Development section by clicking the pencil icon in the sidebar.

Step 2: Create a New Test Case

  • In the Test Development section, click 'Testcase'.

Step 3: Select the API Template

  • Type 'API' in the search bar and select the API Template designed to streamline API tests.

Step 4: Configure Your Test Case

  • Click the edit icon to start customizing your API test case.

Step 5: Add Details

  • Enter a descriptive title for your test case.

  • Select the appropriate HTTP method (GET, POST, PUT, DELETE).

  • Enter the URL of the API endpoint.

Step 6: Execute and Review

  • Click 'Send' to initiate the API request.

  • Review the response preview to check the response body, headers, and status code.

Step 7: Proceed with Verification

  • Click 'Next' to proceed to the verification steps.

  • Add a variable name to store the response.

  • Specify the JSON path and verification method (equals, contains).

  • Select the data type and input the expected value.

Step 8: Verify Status

  • Configure the status verification settings.

  • Enter the expected status value.

Step 9: Save and Run

  • Click 'Create' to save the test case.

  • Click 'Run' to execute the test case.

Step 10: Monitor Execution

  • Track the test execution progress in real-time.

Step 11: Check Results

  • After completion, review the test results to see if it passed or failed based on your criteria.

By following these steps, you can effectively set up and execute API test cases in ContextQA, ensuring that your APIs function as expected.

Last updated