assigning assertEqual to a variable

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

assigning assertEqual to a variable

Muaaz
Hi tarun ,

I have a simple requirement , i have assertEquals statement to verify , what i want is if relevant assertion passes i need to print as "SuccessFull test case" if assertEquals fails i need to print as "TestCase fail"

i was trying to assign assertEquals to a boolean variable , but i cant assign assertion to a variable , if can how do we do that ..i even Google'd but cannot find any sort of coding part ,

Plz help me out ,
Reply | Threaded
Open this post in threaded view
|

Re: assigning assertEqual to a variable

softwaretestingforum
Administrator
If assertion fails then test would be marked as fail any way (either JUnit or TestNG) .  Why do you want to print such message?
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: assigning assertEqual to a variable

Muaaz
i am printing successful message end of the test case , even assertion failed because end of the line , i need to trigger my print based on vital assertions ,

This is basically for managerial reporting purpose , because managers dont like the way assertionError message  :-)

is thr a way
 
Reply | Threaded
Open this post in threaded view
|

Re: assigning assertEqual to a variable

softwaretestingforum
Administrator
You could corresponding message printed in assert also like -

assertEquals("Test failed coz of....", obj1.equals(obj2));

if assertion fails then message - "Test failed coz of...." will be printed in you report. Does this help?
~ seleniumtests.com