How to use Hamcrest Matchers with Soft Assertion

2,092 views
Skip to first unread message

Selenium Webdriver Automation

unread,
May 11, 2017, 6:26:03 AM5/11/17
to REST assured
Hi , 
I am Using Rest Assured with TestNG and using Hamcrest Matchers to assert output of response.

In case any of assertion fails my whole test is skipped and marked as failed .

What I want is to fail the test case but execute full test case without skipping . In TestNG we ha soft assertion's to do so . But I am not sure how to use soft assertions along with Hamcrest Matchers

Kindly Help

Warm Regards
Anurag Gupta

Johan Haleby

unread,
May 11, 2017, 7:38:27 AM5/11/17
to rest-a...@googlegroups.com
You can either use this approach:

then().
       body("x", equalTo("something"), 
            "y", equalTo("something else"));

or you can use something like assertj instead.

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

Selenium Webdriver Automation

unread,
May 11, 2017, 7:48:16 AM5/11/17
to REST assured
Thanx Johan ,

AssertJ worked. It really helped me :)
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages