autoscout24
15 years agoContributor
TearDown TestRunner results
Hi Support Team,
It is important for us to document the failed test request & response so we are using the above code in the test case tear down method . The Method works fine if we use simple parameters in the xml request (refer eg 1), but when we use the expressions in the xml as defined in eg 2, we cannot able to get the exact value of the expression in the request
Would be great if you provide us some suggestion on the above.
Thank you
Regards
Vijay
def sNotes;
def list = new ArrayList();
def item;
count = 0
for( r in testRunner.results )
{
count++
if (r.toString().indexOf ("Request") != -1)
{
item = "TestStep < " + r.testStep.name + " > finished with status < " + r.status + " > Time Taken ::< " + r.timeTaken + " > ms " + "\n\n" + "----------------------------"+ r.testStep.name + " Request Message-----------------------" + "\n\n" + r.testStep.getProperty("request").getValue() +"\n\n" + "----------------------------" + r.testStep.name +" Response Message-----------------------" +"\n\n"+ r.testStep.getProperty("response").getValue()+ "\n\n" + "----------------------------"+ r.testStep.name + " Assertions-----------------------" +"\n\n"+ r.messages;
}
else
{
item = "TestStep < " + r.testStep.name + " > finished with status < " + r.status + " > Time Taken ::< " + r.timeTaken + " > ms " +"\n\n";
}
list.add(item);
}
sNotes = list.toString();
It is important for us to document the failed test request & response so we are using the above code in the test case tear down method . The Method works fine if we use simple parameters in the xml request (refer eg 1), but when we use the expressions in the xml as defined in eg 2, we cannot able to get the exact value of the expression in the request
eg 1
testStep.TestRequest
<web:request>
<profile_id>DIR_DE</profile_id>
</web:request>
r.testStep.getProperty("request").getValue() from the above code got the same message in the request.
eg 2
testStep.TestRequest
<web:request>
<profile_id>${#TestCase#Group1}</profile_id>
</web:request>
in this case also, r.testStep.getProperty("request").getValue() from the above code got the same message in the request.
That means '${#TestCase#Group1}' is displayed same as in the request. We want the real value of that parameter 'Group1' to be displayed in the request.
Like how it displays in TestCase Log (double clik the test request method--> Request Message, Response Message, Properties, etc.)
Would be great if you provide us some suggestion on the above.
Thank you
Regards
Vijay