ISO Folder & File Repo Structures

Hi Mark,

When test suites start to grow, it is recommended to decouple some test logic in modules and reuse it across various tests.

To import a local module in k6, you use Javascript modules:

Also, different teams might want to share modules implementing complex logic, for example, a login flow. Sharing these modules will prevent various teams from implementing the same functionality and facilitate maintenance.

import { login } from './actions/login.js';

export default function () {
  let user = login();
}

How would you build out the repo?

If you need to reuse modules between teams, set up a shared project that can be imported/reused for each team. You can use an npm package, git submodules, or any other project setup… - each different setup has its advantages and disadvantages.

Do you have any advice on how to structure the scripts, data, config, modules, utils for each script and yet still enable running in large, shared scenarios in a larger environment?

This will be very specific to your testing project. I’d start simple and split by concepts: config, data, scenarios, utils, common, etc, and the subfolders.

How to structure data files/sharing?

What type of data? How will the teams load these data?

k6 and Javascript work easily with JSON files. For example, using SharedArray.

If you can use data in JSON, it will facilitate operating with the data.

3 Likes