I'm trying to implement a sort of soft assertions in my selenium project with Cucumber.
Basically I'm running the scripts as JUnit tests using the JUnit Eclipse plugin, and I was wondering if there is any way that I can perform multiple assertions on a step, and if any of the assertions fail, I would like to mark the step as failed, but continue with the other steps/assertions in the scenario without interrupting the execution.
By marking failed steps I mean flagging the failure and adding to the FAILED counter in JUnit, for each assertion that fails, regardless of where it happened.
I've noticed that if I catch the assertion error using
try {
AssertTrue(someCondition.isTrue());
} catch (AssertionError ae) {
log.info(some message);
}
the step will be marked as PASSED in the JUnit plugin, and the failed counter stays 0.
What triggers the counter and how do I manually mark a JUnit failure without throwing an AssertionError?
Alternatively, is there a Cucumber option that I can add to the Runner in order to not stop tests on failures? I'd like to at least have the failures with expected and actual result in the cucumber report.