Running tests in TestNG

32 views
Skip to first unread message

====

unread,
Aug 17, 2016, 7:43:48 PM8/17/16
to testng-users
How to make sure that your run fails, if one of the asserts in your test fails? If an Assert method returns false, that alone doesn't make your run fail. What logic do you need to wrap around an Assert method to make sure that the run fails?

Krishnan Mahadevan

unread,
Aug 17, 2016, 10:32:29 PM8/17/16
to testng-users

TestNG by default fails a @Test annotated test method if :

1. There is an assertion failure.
2. Test method raises an exception.
3. A configuration method fails.

Assertions never return anything. They evaluate a condition and if condition is not satisfied they raise an AssertionError which causes the test method to fail.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages