Adding message in Assert.fail()

I’m using Assert.fail to get list of empty elements. I need to add some text message in Assert.fail(errorDivs.get(0).getText());

so I can see that message in report. How can I do that ?

When I add message as

Assert.fail("Some message",errorDivs.get(0).getText())

eclipse gives me warning "The method fail(String, Throwable) in the type Assert is not applicable for the arguments (String, String)"

Thanks

Answer

How about

Assert.fail( "Some message" + errorDivs.get(0).getText() );

Confer the JavaDoc for Assert.fail() – the method takes a single String argument.

Cheers,

Leave a Reply

Your email address will not be published. Required fields are marked *