Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve the return of the setup function #124

Open
blixit opened this issue Aug 4, 2023 · 0 comments
Open

How to retrieve the return of the setup function #124

blixit opened this issue Aug 4, 2023 · 0 comments

Comments

@blixit
Copy link

blixit commented Aug 4, 2023

Hello

I'm working on a script to automate the generation of a JS script from HAR, the data injection and the JS script execution.

I want my JS script to contain a main function and a setup function such as:

export function setup() {
  let vars = {};
  // read a csv file that contains my dataset
  // update vars with data
  return vars;
}

export default function main(vars) {
  const randomIndex = ...; // computed from vars and the strategy
  const username = vars[randomIndex].username;
 
  group(...)
}

My current approach is to edit the JS file with another script that adds manually the wanted lines.

Is there a way to update the HAR in order to get this structure by running har-to-k6 ?

(If it's not implemented yet, just give me the recipe, I'll try a fork and submit a PR if the result is interesting)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant