ISO Folder & File Repo Structures

Hi fellow climbers - please feel free to reply on a new thread as we are looking for input/experiences with the following:

  • currently with JMeter: we are migrating from a central repository of scripts (under a shared folder named /scripts)
  • currently with JMeter: the scripts use a shared /data folder from the same repo
  • moving to k6: we’re hoping to have the new scripts located in each teams repo (not central, nor shared)
  • moving to k6: for large, combined load tests in a big environment we bring all the scripts together to run them at the same time
  • moving to k6: the data for the large environment is shared/centralized - but separate from lower environments

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? How would you build out the repo? How to structure data files/sharing?

Thanks in advance,

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.

1 Like