0
votes

My test plan is as follows: Thread Group

Transaction Controller 1 Transaction Controller 2 Run time Controller Transaction Controller 3 Transaction Controller 4 Transaction Controller 5 Transaction Controller 6 Controller 1 & 2 (Launch Application and Login) - should happen only once

Run time Controller contains some transactions - this will iterate for a duration of 1 hour

Controller 6 (Logout) - should happen only once

All samplers are found inside the controllers.

I want to run my test for the duration of 1 hour. The problem is when I set 1 hour for my thread group and 1 hour for my runtime controller, Transaction Controller 6 does not get executed. It all depends where the test flow has reached when duration hit 1 hour.

How can I make the test to stop (like gradual exiting) but executes the remaining transactions when we hit the 1 hour mark before stopping the test completely?

Is there a controller that will wait for the remaining transactions to execute before stopping the test even if the duration has reached 1 hour?

Your assistance will be greatly appreciated. Thank You

1

1 Answers

0
votes

I think the only way to solve this is to take control of the ramp-down manually.

Change your thread group to loop only once, and remove the duration limit.

Put a BSF PreProcessor with this code under your very first sample:

if (vars.get("start_time") == null) {
    vars.put("start_time", Date.now());
}

Replace your runtime controller with a While controller with a condition like this:

${__javaScript(Date.now() < ${start_time} + 1000 * 60 * 60)}

If you want gradual rampdown over, say, 5 minutes, you'll need to do something like this (newlines for clarity)

${__javaScript(
    Date.now() < ${start_time} +
        1000 * 60 * 60 +
        1000 * 60 * 5 * ${__threadNum} / <your total number of threads>
)}

If you also have gradual rampup, you'll need to take that into account as well (or if you want the same rampdown as you had rampup, you can just use the first version).