[Resolved] Access results from testSuite.teardownscript
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2011
06:42 AM
05-03-2011
06:42 AM
[Resolved] Access results from testSuite.teardownscript
Hi,
I want to access results at the teardownscript of a testsuite.
In a testcase teardownscript I'd use :
However, on testSuite level, this returns a "no such property testRunner for testSuite"
How do I fix this?
I want to access results at the teardownscript of a testsuite.
In a testcase teardownscript I'd use :
for (result in testRunner.getResults())
{
log.info result.getStatus()
}
However, on testSuite level, this returns a "no such property testRunner for testSuite"
How do I fix this?
7 REPLIES 7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2011
11:06 AM
05-03-2011
11:06 AM
I changed the script into the following:
But this doesn't return anything:(
import com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner
int count = testSuite.getTestCaseCount()
for(i = 0; i < count; i++)
{
testCase = testSuite.getTestCaseAt(i)
testRunner = new MockTestRunner(testCase)
for (result in testRunner.getResults())
{
log.info result.getStatus()
}
}
But this doesn't return anything:(
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2011
01:37 AM
05-05-2011
01:37 AM
Hi!
From the TestSuite scope, the test runner is referenced as runner, whereas it's referenced as testRunner in the TestCase scope. The naming discrepancy is because of legacy reasons. We should change this in the future (I've added it to our backlog).
Tips: The available variables in a script is always shown in the upper right corner:
Regards!
/Henrik
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
From the TestSuite scope, the test runner is referenced as runner, whereas it's referenced as testRunner in the TestCase scope. The naming discrepancy is because of legacy reasons. We should change this in the future (I've added it to our backlog).
Tips: The available variables in a script is always shown in the upper right corner:
Regards!
/Henrik
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2011
02:29 AM
05-05-2011
02:29 AM
ah ok, that explains it a bit.....
so on the testSuite.tearDownScript level the following script returns the results from each testCase:
1. In case a testCase has failed, I'd like to know which testStep has failed. How do I script this?
2. For each testCase that returns a FAILED status, I also want to know the results from each testStep. Again, how to script this?
I tried the following, did not work:(
so on the testSuite.tearDownScript level the following script returns the results from each testCase:
for(result in runner.results)
{
log.info result.getStatus()
}
1. In case a testCase has failed, I'd like to know which testStep has failed. How do I script this?
2. For each testCase that returns a FAILED status, I also want to know the results from each testStep. Again, how to script this?
I tried the following, did not work:(
for(result in runner.results)
{
log.info result.getTestCase().name
if(result.getStatus().toString() == 'FAILED')
{
log.info "TestCase has failed"
for(a in result.getTestCase.results())
{
log.info a
}
}
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2011
08:36 AM
05-05-2011
08:36 AM
Hi Finan,
This should work:
I've added it to the Scripting Tips & Tricks page.
/Henrik
eviware support
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
This should work:
for( testCaseResult in runner.results )
{
testCaseName = testCaseResult.getTestCase().name
log.info testCaseName
if( testCaseResult.getStatus().toString() == 'FAILED' )
{
log.info "$testCaseName has failed"
for( testStepResult in testCaseResult.getResults() )
{
testStepResult.messages.each() { msg -> log.info msg }
}
}
}
I've added it to the Scripting Tips & Tricks page.
/Henrik
eviware support
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2011
02:00 AM
05-09-2011
02:00 AM
Hi,
Thx for the script! It gave me enough clues to solve this part of my scripting puzzle
Thx for the script! It gave me enough clues to solve this part of my scripting puzzle

- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2018
07:06 AM
03-20-2018
07:06 AM
When I use above code...It is printing results in random order.
i.e let say i have test cases named with A,B and C in order..when I run above code multiple times it prints results in random order like C,A,B or B,A,C.
In order to prepare Customized HTML reports i want to access results in order.Can some one give solution ASAP.
Thanks in advance.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018
11:56 PM
06-04-2018
11:56 PM
Did you try: testRunner.testCase.name
