Load test multiple programs within a single script and get statistics

I would like to know how to correctly do a load test on multiple programs on a platform.
I wrote my script as below. but as I understands the required number of concurrent users are getting shared over the programs that I provided.

My requirement is to simulate a given load across the given program list and get the statistics for individual program. Is it doable within a single script?
For example:

import http from 'k6/http';
import { check } from 'k6';
import generateAccessToken from '../helpers/generateAccessToken.js';

  const url = __ENV.GATEWAY_URL ? __ENV.GATEWAY_URL : 'http://gatway.com';
  const query = `request body`;


export let options = {
  stages: [
    { duration: '60s', target: 100 }, // simulate ramp-up of traffic from 1 to 100 users over 5 minutes.
    { duration: '60s', target: 100 }, // stay at 100 users for 10 minutes
    { duration: '20s', target: 0 } // ramp-down to 0 users
  ],
  thresholds: {
    http_req_duration: ['p(99)<1500'], // 99% of requests must complete below 1.5s
    checks: ['rate>0.95']
  }
};

function newsfeedEvetExtract(authToken){

    const headers = {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + authToken
  };
  const res = http.post(url, JSON.stringify({ query: query }), { headers: headers });

  check(res, {
    'is status 200': (r) =>
      function () {
        if (r.status === 200) {
          return true;
        }
        // eslint-disable-next-line no-undef
        console.log('ERROR: ' + r.body);
        return false;
      }
  });

}



export default function () {

  const authToken_shard1 = __ENV.AUTH_TOKEN ? __ENV.AUTH_TOKEN : generateAccessToken('user1','pwd',1);
  const authToken_shard2 = __ENV.AUTH_TOKEN ? __ENV.AUTH_TOKEN : generateAccessToken('user1','pwd',2);

  newsfeedEvetExtract(authToken_shard1)
  newsfeedEvetExtract(authToken_shard2)

}


Thank you

Hi @sashi1 !

I believe there are a couple of ways to achieve your goals.

First, you could have a look to the Scenarios. Using them, you can assign different load profiles, the number of the VUs, and so on.

Second, you can use the Tags and Groups functionality.

Let me know if that helps,
Cheers