Skip to content

Use collection variable value from K6 setup in the K6 default #119

Discussion options

You must be logged in to vote

I found a workaround, not very clean, but that solve my problem to communicate from setup to default.

export function setup() {
  let call="";
  group("setup", function() {
    postman[Request]("get client bearer token");
    call = postman[Request]("get special ID");
   //call contain a copy of the request definition where I set colSpecialId in the header Specialid
  });
  //use the return to persist the colSpecialId to the default function
  return call.request.headers;  
}


export default function(data) {
  group("loop", function() {
    postman[Pre].push(() => {
      //read from data the header Specialid I set in the setup
      pm.collectionVariables.set("colSpecialId", data.Specia…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dparadisZentelia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant