TarekO
4 years agoNew Contributor
How to fetch if the test passed or failed in the After hook
Hi,
I would like to know how can I implement an After hook that does an action if the test failed or passed.
For example, please check the follow snippet of a sample where I can handle the step state with the reason of failing.
if( Step.failed() ){
System.out.println("The test failed due to this reason " + Step.failReason());
}else if( Step.passed(){
System.out.println("The test passed with no issues");
}
I am using Cucumber Open Source with Appium/Selenium Libraries.