cancel
Showing results for 
Search instead for 
Did you mean: 

Get all test suite's test case results

Buschfunk
Frequent Contributor

Get all test suite's test case results

Hello,

I need to do the following but I don't know how to

Description
Using soapUI Pro 4.5 I have two test suites "TestSuite_A" and "TestSuite_B" with several test cases. Both of them are run independent from each other. After both test suites are finished I'd like to export the results to a file using a Groovy script, i.e. I cannot use the testRunner object.

Basically I need to do the following: Go through all test cases in each test suite and get the result ("FINISHED" or "FAILED").

How can I do this using Groovy?
4 REPLIES 4

Re: Get all test suite's test case results

Hi!

I would use this technique.

Does that help?

Henrik
SmartBear Software


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Buschfunk
Frequent Contributor

Re: Get all test suite's test case results

Henrik,

Thanks for the link. However I'm afraid that this won't work for my case. Here's some more information.

Initial situation
There are two test suites: TS_A, TS_B. Each of them contains around 20 test cases. Usually we don't execute complete test suites or even the complete project but single test cases as there is some manual work to do between executing the tests. After having executed all necessary test cases I want to manually start a Groovy script "getTestCaseResults" which collects all the results of each single test case. I don't want to get the results of all the test steps, just the test case result "FINISHED" or "FAILED". It is ok that test cases may appear which have not been run and thus don't have a result.

Given this information I cannot use a teardown script of a test case or a test suite. What I basically need is:


  • Iterate over all test cases (I already have that)

  • Get the test result of each test case


Iterating was achieved by using a code snippet like that:

testRunner.testCase.testSuite.project.getTestSuiteList().each {
it.getTestCaseList().each {
// Need something like:
// it.getResult()
}
}

However I cannot find a method which can be applied for getting the result.

Sincerely,
Robert
RJanecek
Regular Contributor

Re: Get all test suite's test case results

in each test case tear down script you can set property with result of this testCase:
 def tc = runner.testSuite;

for ( testCaseResult in runner.results )
{
tc.setPropertyValue("result",testCaseResult.getStatus().toString())
if (testCaseResult.getStatus().toString() == "FAILED") {
break;
}

}


and then in groovy script you can iterate over this testCase properties:

testRunner.testCase.testSuite.project.getTestSuiteList().each {
it.getTestCaseList().each {
println it.getPropertyValue("result")
}
}
RJanecek
Regular Contributor

Re: Get all test suite's test case results

probably you should in setup script set these testCase property to null or empty string...
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors