My requirement is to show all the failures after Junit test run.
I tried two things:
Assertions.assertEquals --> This stops the execution after first failure, and in test report I see only first failure.
Assertions.assertEquals(expceted, actual,"Error Message");
assertj.SoftAssertions --> Here execution happens but in test report I do not see any failure message.
SoftAssertions softAssertions = new SoftAssertions();
softAssertions.assertThat(expected).withFailMessage("Error Message", actual) ;
Any Idea if any other type of assertion or any other option I can use with these assertions?
I tried Junit5 assertAll
for (int index = 0; index < response1.row.size(); index++)
{
int finalIndex = index;
Assertions.assertAll(
() ->Assertions.assertEquals(Response1.row.get(finalIndex).field1, Response2.row.get(finalIndex).field1,
"Value doesn't match between source and target"),
() ->Assertions.assertEquals(Response1.row.get(finalIndex).field2, Response2.row.get(finalIndex).field2,
"Value doesn't match between source and target"),
() ->Assertions.assertEquals(Response1.row.get(finalIndex).field3, Response2.row.get(finalIndex).field3,
"Value doesn't match between source and target")
}
But here it shows failures only for first row, not for all the rows.
Thanks in advance !!!