Forum Discussion

cocarra's avatar
cocarra
Member
10 years ago

Is it possible to list all the test cases/targets in all scenarios in LoadUI NG Pro startup script?

I have a groovy script which creates a file that is used by a datasource teststep as part of the loadtest. Each record in the file can only be used once so it is shared.

 

fileName = loadTestRunner.loadTest.testCase.getTestStepByName("DataSource").getDataSource().getFileName()

I used the above code to get the filename for the datasource and it works fine in the startup script or the LoadTestRunListener.beforeLoadTest event when there is only a single testcase in the loadtest. 

 

I have started using the Pro version which means my load test can have multiple scenarios each of which can have multiple testcases. I assume the datasource 'shared' option only works for threads/virtual users in single testcase. Which means I need to be able to create a different file for each testcase. I would like to be able to access the DataSource test step for each of these testcases. So I need some way of looping through all the scenarios in a load test and in turn all the testcases/targets in each scenario. 

 

Looking at the apidocs I see no mention of scenarios. In the groovy startup script there is no code completion for anything related to scenarios.

 

testcase = loadTestRunner.getLoadTest().getTestCase().getName()

If I try to get a testcase from the loadTest object in the script it just returns one of the testcases.

 

Is there any method I can call in groovy to get all of the scenarios/testcases?

1 Reply

  • It's not possible to access all the targets from the load test script yet. I hope to improve this in one of the next releases.

    But you could do anything you want with the current functionality. You could use events and setup of the test case in beforeTestCase. LoadUI context could be used as a global storage and SoapUI context could be used as a virtual user storage.

    And the shared datasource thing is not working the way you described it or at least i did not understand this correctly. Each time test step requested a new line shared datasource returns the next one. Its not isolated anyhow. It became a global object available for each virtual user. It'll be probably much easy to understand it's work via logging data in afterTestStep loadUI event.