Using test data is a simple way to inject dynamic data into your tests. Our AI will identify the data needed for each test and use your added data when generating tests.

The data here will be used independently by each test. For global test data shared by all tests, refer to the Global Setup And Teardown page.

Pre-condition: You must add your data file in the stably/data directory.

Static Data

Add your static data as a JSON file. The file name will be used as the data name. For example, you can add a user.json file with the following content:

[{
  "name": "User-1",
  "email": "[email protected]",
  "password": "password",
  "description": "free user with 0 artwork uploaded"
}, 
{
  "name": "User-2",
  "email": "[email protected]",
  "password": "password",
  "description": "premium user who has uploaded 5 artworks",
}]

Dynamic Data

Add your dynamic data as a js file. The file name will be used as the data name. It must export a function that returns a JSON object. For example, you can add a new_event.js file with the following content:

export default function newEvent() {
  return {
    "name": "New Event" + Math.floor(Math.random() * 100),
    "date": new Date().toISOString(),
    "location": "New York",
    "description": "A new event happening in New York"
  }
}

Was this page helpful?