Can we use soft assert in Junit as like TestNG:
I dont want to fail my Test Case if Assert Condition fail
Any way to solve this use case
Can we use soft assert in Junit as like TestNG:
I dont want to fail my Test Case if Assert Condition fail
Any way to solve this use case
You can use:
import org.assertj.core.api.SoftAssertions;
Code:
SoftAssertions softAssertions = new SoftAssertions();
softAssertions.assertThat(searchCriteriaPage.count()).isEqualTo(searchCriteria.getCount());
softAssertions.assertAll();
Maven Dependency:
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.18.1</version>
<scope>test</scope>
</dependency>