Yashodip Patil
Yashodip Patil

Reputation: 79

Assertequls method is not working

 boolean   b = Testfactory.read_element_file(models).equals(ExcelUtils.readdata("Model Export.xlsx"));

 SoftAssert ass = new SoftAssert();
 ass.assertEquals(b, true);

in boolean b i comparing two list after debugging i am getting b value is false but the assert is not getting failed. Junit test cases showing passed.Please have a look the attched screen shot here

Upvotes: 0

Views: 165

Answers (2)

Kovacic
Kovacic

Reputation: 1481

I would suggest to use simple

Assert.assertTrue(b);

hope this helps,

Upvotes: 0

Guy
Guy

Reputation: 50959

SoftAssert doesn't throws an exception, From the docs

When an assertion fails, don't throw an exception but record the failure. Calling assertAll() will cause an exception to be thrown if at least one assertion failed.

Use regular assert or call assertAll()

Upvotes: 4

Related Questions