Creating Fake Data in Tests

In some instances, you might 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 create fake data of multiple types right from within the testing steps, and assign it to a variable so you can use it later in the testing steps. 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, we will simply add a step called "Faker Generate".

Then, choose from the options available under Category. It allows you to create fake name, image, company, etc. In this case we will choose address. You can then choose from different types of addresses, such as street address, zip code, city name, etc. Below, we choose to create a fake street address. The next step is to define the name of the Variable to which you want the fake value to be assigned to. In this case, we are assigning it into a variable called fakeStreetAddress.

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