Hi guys, how to pass variables between scenarios. For example,In options, i used 2 scenarios (login & verify_login), execute two functions separately (login & verify_login), how to reference openid+token of login function in verify_login function .
Hi @sunnini,
I would recommend just merging those two scenarios as it seems like they should be combined.
Otherwise you will either need to use a hack such as the one explained in here
Or need an external service to save every login and then retrive it later.
For single business, the sequential APIs can be put into a scenario. But for mixed business scenarios, different business operations, how should organize case scenarios in k6 ?
Such as different APIs are split into different thread groups in Apache Jmeter, in addition, set the business ratio for different thread groups.
Can you provide a k6 demo?
different business operations, how should organize case scenarios in k6 ?
I am not certain that organizing this in separate scenarios is warannted if you want to use the same data.
Is there a particular reason you want that specifically?
If you will want to separate them completely so that you can have two different rates of testing you will also need to give them all the data they need to work. So in your case it seems like you will need to get some openid
and token
values from somewhere.
Either generate them completely outside the test and just test with them or potentially use something like xk6-redis + redis to write them from the first scenario and read them from the second. You will need to figure out how to read/write them in a way that will scale for your use case and potentially clear the data at the end of the test.
You can use any other extension that write/reads from an extenral database to do this.
You can probably also (ab)use the hack I provided above - I would recommend against that really as you will:
- need to have one scenario after the other - not concurrently
- you will need to store stuff in the VU memory which potentially can be a problem
I have no experience with jMeter, so can’t really give any comparison