问题
I am trying to figure out how to change LoadTest setup during it's run. E.g. I need to run 5 tests included in Loadtest mix during 90 minutes(25 simultaneous users), than add one more test to the mix, which will run 25 simultaneous user for next 90 minutes. I know that with loadtest plugins we can change some properties, but still didn't find a way to make it work.
Any help would be greatly appreciated
回答1:
I believe that the tests in the test mix of a scenario cannot be altered at run time. A load test plugin has access to the names of the tests in a scenario via m_loadTest.Scenarios[N].TestNames
where N
is an index into the collection of scenarios. The Intelitype help for TestNames
states Gets an array of the test names that are included in the scenario.
There does not appear to be any way to add the other properties of a test such as its percentage or its rate of occurrence.
One way of achieving something similar to what the question wants is to have two scenarios. The first scenario has the initial 5 tests and 25 users, it runs for the entire 180 minutes of the test. The second scenario has all 6 tests and one user, it has a Delay start time
of 90 minutes. This gives 26 users for the second half of the test, but that can be fixed with a plugin. The Heartbeat
plugin of the load test could be used to decrease the number of users in the first scenario to 24 after 90 minutes, by assigning to m_loadTest.Scenarios[N].CurrentLoad
for a suitable N
.
Having the 5 test and 6 test scenarios running at the same time may give the wrong proportions of test cases. If equal ratios are wanted throughout then for the second half there will be 5 tests at 20% each in one scenario and 6 tests at 16% or 17% each in the other scenario. Leading to the 6th test case being about 8% overall.
Another approach has the two scenarios with 5 and 6 tests as above. This time make the heartbeat
plugin slowly decrease the number of users in the 5 scenario test and at the same time increase the users in the other. This should avoid the problem with wrong proportions of the tests.
来源:https://stackoverflow.com/questions/49032911/change-loadtest-setup-during-run