Creating Fake Data in Tests

You may want to generate fake data to include in your API calls, whether as a parameter or in the payload. RapidAPI Testing makes it very easy for you to generate fake data, of multiple types, from within your test. Let's walk through an example.

For this purpose, let's imagine that we are testing an order creation API, and need to feed the API with a fake address. First, add the "Faker Generate" step.


The Faker Generate supports multiple categories of fake data including: name, address, company, images, phone number, date, time, and more. For our example, choose "address" from the options in the Category dropdown. You can then choose from different functions of an address, such as street address, zip code, city name, etc. In the example below, we will create a fake street address.

The next step is to define the name of the variable you want the fake value to be stored. For this example, we are storing it in a variable called fakeStreetAddress. At the bottom of the Faker Generate step is a preview of the data. Note that this value is random and will change each time this step is used.

To use our new fake street address in subsequent steps, you can access fakeStreetAddress as a variable using the curly brace {{fakeStreetAddress}} syntax.