Ask a Question

How to Print to Assertion Log?

SOLVED
david2
Occasional Contributor

How to Print to Assertion Log?

In ReadyAPI/SoapUI Pro, when a test case fails, I would like to print a custom message to the assertion log (see the "Compare" tab), as well as printing the endpoint that has failed. Is this possible? Or even simply printing the variables from the DataSource?

1 ACCEPTED SOLUTION

Accepted Solutions
nmrao
Community Hero

Re: How to Print to Assertion Log?

Thanks. Here two examples fail, pass cases respectively.

//this will show the endpoint as assertion fails
assert 1==0, context.expand( '${DataSource#EndPoint}' )

 

//Below doesnot show anything as assertion passes
assert 1==1, context.expand( '${DataSource#EndPoint}' )





Regards,
Rao.

View solution in original post

8 REPLIES 8
nmrao
Community Hero

Re: How to Print to Assertion Log?

I know error log, script log.
Where to find assertion log?

Regarding the custom message, one can use like below groovy sample

assert 1==0, 'My custom failure message: expected value does not match with actual'


Regards,
Rao.
david2
Occasional Contributor

Re: How to Print to Assertion Log?

Delete

david2
Occasional Contributor

Re: How to Print to Assertion Log?

Delete

david2
Occasional Contributor

Re: How to Print to Assertion Log?

The assertion log is the log that appears when you run a TestSuite in ReadyAPI/SoapUI and then click the "Compare" tab.

 

Here is an image: https://imgur.com/a/8UKPhLs


How do I make this Groovy Script work?

assert 1==0, ${DataSource#EndPoint}

nmrao
Community Hero

Re: How to Print to Assertion Log?

Thanks. Here two examples fail, pass cases respectively.

//this will show the endpoint as assertion fails
assert 1==0, context.expand( '${DataSource#EndPoint}' )

 

//Below doesnot show anything as assertion passes
assert 1==1, context.expand( '${DataSource#EndPoint}' )





Regards,
Rao.

View solution in original post

david2
Occasional Contributor

Re: How to Print to Assertion Log?

Thank you! Is there any way to avoid printing "java.lang.AssertionError" and "error at line: 1" ? Perhaps an alternate print method?

 

Here is a picture: https://imgur.com/a/3ObqCzj

nmrao
Community Hero

Re: How to Print to Assertion Log?

It is the way it shows when an assertion is failed.
Not that I am aware alternatives.
So can this be close?


Regards,
Rao.
david2
Occasional Contributor

Re: How to Print to Assertion Log?

Yes, thank you!

cancel
Showing results for 
Search instead for 
Did you mean: