Forum Discussion
SmartBear_Suppo
13 years agoSmartBear Alumni (Retired)
Ok, then it should only be a matter of making your script into a method and putting it in a file in the soapUI Pro/scripts folder.
How to use the script library:
[link]
How the file could look:
regards
Henrik
SmartBear Software
How to use the script library:
[link]
How the file could look:
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);
def generateCustomReport( resultsFromRunner )
{
JUnitReport report = new JUnitReport();
for ( testCaseResult in resultsFromRunner )
{
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 ))
}
regards
Henrik
SmartBear Software
Related Content
- 4 years ago
- 8 years ago
Recent Discussions
- 5 days ago
- 10 days ago