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

K6 setup() #46

Open
thim81 opened this issue Mar 8, 2022 · 1 comment
Open

K6 setup() #46

thim81 opened this issue Mar 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@thim81
Copy link
Collaborator

thim81 commented Mar 8, 2022

Feature: Provide a converter option to insert custom K6 "setup()" logic, that will be injected during conversion.

Reasoning: K6 supports a life cycle: https://k6.io/docs/using-k6/test-life-cycle/
The package already supports the “pre-request” functionality from Postman, but it feels that “setup()” and “teardown()” is not a concept that exists in Postman, and it serves more the K6 execution.

Approach: Provide a file reference as a --k6-setup CLI parameter, that will be take the content of the file and insert it in the generated K6 script.

@thim81 thim81 added the enhancement New feature or request label Mar 8, 2022
@aaroncampecino
Copy link

Hi @thim81 ,

Sorry for being a complete newbie.

Given I have multiple requests that required authentication.
And I execute the script with --separate true flag.
Then configured setup function that returns the correct JWT token.

How can I pass the access_token to each file requests/SAMPLE_FILE.js to be added to the headers config?

export function setup() {
  //returns Bearer TEST_TOKEN
  return authenticateUsingOkta();
}

export default function(data) {
  group("Test", function() {
    postman[Request]("Test name");
  });
}

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

No branches or pull requests

2 participants