Forum Discussion
autoscout24
14 years agoContributor
Hi Guys,
I modied the code and using it like below.
I want to keep this script in the script library for testSuite Tear down.
Please give the me some suggestion how this 'runner.results' can be declared has input parameter of the script library method . Optimisation of the above is highly appreciated.
Thank you
Regards
Vijay
I modied the code and using it like below.
import com.eviware.soapui.report.JUnitReport;
def sTestRunCountry = "DE";
def sTestSuite = "Smoketext"
def testSuiteResultLocation ="c:\\temp\\"
def resultLocation = String.format("%s%s_%s.xml", testSuiteResultLocation, sTestRunCountry, sTestSuite);
JUnitReport report = new JUnitReport();
for ( testCaseResult in runner.results )
{
testCaseName = testCaseResult.getTestCase().name
double time = testCaseResult.timeTaken;
if ( testCaseResult.getStatus().toString() == 'FAILED' )
{
def results = new ArrayList();
def result;
for ( testStepResult in testCaseResult.getResults() )
{
if (testStepResult.toString().indexOf("Request") != -1)
{
def request = testStepResult.testStep.getProperty("rawrequest").getValue()
def response = testStepResult.testStep.getProperty("response").getValue()
result = "TestStep < " + testStepResult.testStep.name + " > finished with status < " + testStepResult.status + " > Time Taken ::< " + testStepResult.timeTaken + " > ms " + "\n\n" + "----------------------------"+ testStepResult.testStep.name + " Request Message-----------------------" + "\n\n" + request +"\n\n" + "----------------------------" + testStepResult.testStep.name +" Response Message-----------------------" +"\n\n"+ response + "\n\n" + "----------------------------"+ testStepResult.testStep.name + " Assertions-----------------------" +"\n\n"+ testStepResult.messages;
}
else
{
result = "TestStep < " + testStepResult.testStep.name + " > finished with status < " + testStepResult.status + " > Time Taken ::< " + testStepResult.timeTaken + " > ms " +"\n\n"+ testStepResult.messages;
}
results.add(result);
}
report.addTestCaseWithFailure(testCaseName, time, testCaseResult.getStatus().toString(), results.toString())
}
else
{
report.addTestCase(testCaseName, time)
}
}
report.save( new File( resultLocation ))
I want to keep this script in the script library for testSuite Tear down.
Please give the me some suggestion how this 'runner.results' can be declared has input parameter of the script library method . Optimisation of the above is highly appreciated.
Thank you
Regards
Vijay
Related Content
- 5 years ago
- 8 years ago
Recent Discussions
- 18 days ago