Turn your manual testers into automation experts! Request a DemoStart testRigor Free

How to do API testing using testRigor?

During testing, you might find yourself in a situation where you might need to work directly with APIs. testRigor allows you to work directly with APIs, especially during end-to-end or functional testing.

Let’s take a look at how we can achieve that using testRigor’s plain English language commands.

Pre-requisites to writing the test case

First and foremost, you need to create a test suite. Depending on the type of app you are testing, testRigor will ask you for details during test suite creation. Here are the general fields that will be visible to you during this process.

Step 1: Log in to your testRigor app with your credentials.

Step 2: Set up the test suite for the website testing by providing the information below:

  • Test Suite Name: Provide a relevant and self-explanatory name.
  • Type of testing: Select from the following options: Desktop Web Testing, Mobile Web Testing, Native and Hybrid Mobile, based on your test requirements.
  • URL to run test on: Provide the application URL that you want to test.
  • Testing credentials for your web/mobile app to test functionality which requires user to login: You can provide the app’s user login credentials here and need not write them separately in the test steps then. The login functionality will be taken care of automatically using the keyword login. However, this is an optional field and can be skipped if not relevant.
  • OS and Browser: Choose the OS Browser combination on which you want to run the test cases.
  • Number of test cases to generate using AI: You can simplify your test creation further by opting to generate test cases based on the App Description text. This feature works on generative AI.

This is how the test suite creation screen will look like

Step 3: Click on Create Test Suite.

Note: On the next screen, you can let AI generate the test case based on the App Description you provided during the Test Suite creation. However, for now, select do not generate any test, since we will write the test steps ourselves.

Step 4: To create a new custom test case yourself, click Add Custom Test Case.

Test Case: Fetching search string through an API call

The below test case involves going to testRigor’s home page and searching a string through the search bar. The string to be searched will be fetched using an API call.

Let’s take a look at every step that will be part of the testRigor test case.

Test Steps

Step 1: Come to the Test Cases section, provide the test case Description, and start adding the test steps. We will add test steps in the test case editor screen.

Step 2: Since we provided the website URL during test suite creation, testRigor automatically navigates to this website. There is no need to use a separate function to open the URL.

Step 3: Click on the search icon in the header. You can use OCR in situations where you want testRigor to identify certain texts on the screen visually.
click on "Search" using OCR

You should be redirected to the search results page.

Step 4: Make an API call using testRigor’s API testing capabilities. You can provide various specifications of the API, like its headers, body, and parameters.
call api get "https://jsonplaceholder.typicode.com/users/10" with headers "Content-Type:application/json" and "Accept:application/json" and get "$..catchPhrase" and save it as "searchWord" and then check that http code is 200

JsonPath is the way to refer to parts of JSON and is described with examples here. If JsonPath is being used, then you need to use a variable to store the corresponding value in. If the JsonPath is not defined in the action, the complete result of the request will be stored in the variable.

Step 5: The value that is saved in the variable ‘searchWord’ can now be used to perform a search through the search bar.
enter stored value "searchWord" in "Search"
enter enter

In the above commands, we send the input equivalent to the ‘Enter’ key of the keyboard to get the search functionality working.

Step 6: The page should display ‘Nothing Found’ once the search is complete. Add the assertion using plain English as below:
check that page contains "Nothing Found"

Complete Test Case

Here’s what the full test case will look like in testRigor.
click on "Search" using OCR
call api get "https://jsonplaceholder.typicode.com/users/10" with headers "Content-Type:application/json" and "Accept:application/json" and get "$..catchPhrase" and save it as "searchWord" and then check that http code is 200
enter stored value "searchWord" in "Search"
enter enter
check that page contains "Nothing Found"

Viewing Test Results

Once the test is executed, you can view the execution details, such as execution status, time spent in execution, screenshots, error messages, logs, video recordings of the test execution, etc. In case of any failure, there are logs and error text that are available easily in a few clicks.

You can also download the complete execution with steps and screenshots in PDF or Word format through the View Execution option.

testRigor’s Capabilities

Apart from the simplistic test case design and execution, some advanced features help you test your application using simple English commands.

  • API testing and Mocking: The above example shows how you can conduct functional testing through a mix of UI-based and API testing with testRigor. But there’s a lot more you can do with APIs on this platform. Read more about the various methods testRigor provides for API testing.
  • Reusable Rules (Subroutines): You can easily create functions for the test steps that you use repeatedly. You can use the Reusable Rules to create such functions and call them in test cases by simply writing their names. See the example of Reusable Rules.
  • Global Variables and Data Sets: You can import data from external files or create your own global variables and data sets in testRigor to use them in data-driven testing.
  • 2FA, QR Code, and Captcha Resolution: testRigor efficiently manages the 2FA, QR Code, and Captcha resolution through its simple English commands.
  • Email, Phone Call, and SMS Testing: Use simple English commands to test the email, phone calls, and SMS. These commands are helpful for validating 2FA scenarios, with OTPs and authentication codes being sent to email, phone calls, or via phone text.
  • File Upload/ Download Testing: Execute the test steps involving file download or file upload without the requirement of any third-party software. You can also validate the contents of the files using testRigor’s simple English commands.
  • Database Testing: Execute database queries and validate the results fetched.

Make the most of testRigor’s features to test web, mobile (hybrid, native), API, and desktop apps with minimum effort and maintenance.

Additional Resources

Join the next wave of functional testing now.
A testRigor specialist will walk you through our platform with a custom demo.
Related Articles

How to execute test cases in parallel in testRigor?

Parallel execution plays a significant role in End-to-End (E2E) testing for several reasons, mainly time constraints and thorough ...

How to reference elements by UI position using testRigor?

When referring to an element in the DOM, testRigor never relies on unstable XPaths, and it uses testRigor locators instead. ...

How to test QR codes using testRigor?

QR codes have become a game-changer for software applications. Users can access websites, download content, or even make secure ...