Visual Editor

You can build custom tests using the Visual Editor.

We will test some endpoints in the Spoonacular API, so if you want to follow along subscribe to the API for free here.

📘

RapidAPI Testing Link

To get started, navigate to https://rapidapi.com/testing/.

Once you have signed up or logged in to your RapidAPI account, you will be able to see all your APIs. You can click on one of them to add tests to or create a new API to test.

19071907

Once you click an API, go ahead and create a test. You can give it any name you'd like. Click the pencil icon in the test row to edit it.

19161916

In this test, we are going to test the Extract Recipe from Website endpoint in the API.

Click "+ Add Step" to add the first test step.

17281728

You will be prompted to choose from the following options:

  • HTTP Methods: HTTP GET, HTTP PUT, HTTP POST
  • Assertions: Assert Equals, Assert Exists, Assert Type, Assert In, JSON Validate
  • Advanced Options: Loop Foreach, Set Variable, Logic If, Code Run
919919

For our example, we will choose HTTP GET. We can add a URL and a variable (a). You can also set the URL parameters and headers using the tab.

908908

📘

You can find the URL for the API from the RapidAPI Marketplace.

906906

Making Assertions

Let's add an assertion to our test.

Select "+ Add Step" and select the Assert Equals option.

You can build assertions from context variables. In the previous step, we set the variable a. Therefore, we can assert that API status is 200 using the expression a.status and setting the value to 200.

15291529

If you want to add multiple assertions to your test, consider using the automatic test generation tool to speed up the process.

Running the Test

For a test to be successful, all steps of the test must pass. Save and run the test by clicking the button in the top right corner.

19121912

You can see the test result (sucess or fail) on the left-hand side:

19121912

Click on a test result to view more details:

11641164

📘

Now that you have created a basic test consider doing the following steps: