[Cucumber-JVM]: Cucumber @After hook executed twice

34 views
Skip to first unread message

Wong Peter

unread,
Apr 12, 2018, 4:07:49 AM4/12/18
to Cukes
I"m implemnet Cucumber Testng for learning purposes. I"m realizes that @After hook method is executed twice. I can confirm it with debugging set and test report output. I"m only execute 1 feature file and my test report has two same class names.

Do you guys know why?

@After
public void tearDown(Scenario scen) throws IOException {
ExtentTest logger = reportMgr.getLogger();
String feature = getClass().getName() + " Feature";    //+ "." + Thread.currentThread().getStackTrace()[1].getMethodName().toString();
logger = reportMgr.getExtent().createTest(feature);
String screenShot = CaptureScreenshot.captureScreen(WebDriverManager.driver, CaptureScreenshot.generateFileName(feature));
if (!scen.isFailed()) {
logger.pass("Pass");
logger.addScreenCaptureFromPath(screenShot);
} else {
logger.fail("Fail");
logger.addScreenCaptureFromPath(screenShot);
}
}





Please help. Thanks. 









Message has been deleted

Mo Hijazi

unread,
Apr 12, 2018, 10:42:29 AM4/12/18
to cu...@googlegroups.com
How many Scenarios in your feature file?

--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wong Peter

unread,
Apr 12, 2018, 6:45:50 PM4/12/18
to cu...@googlegroups.com
1 feature file and 1 scenario within the feature file. That's all. 

Peter Wong
016-396 3326

On Thu, Apr 12, 2018 at 10:30 PM, Mo Hijazi <mo.hi...@gmail.com> wrote:
How many scenarios in your feature file?

Wong Peter

unread,
Apr 13, 2018, 4:17:29 AM4/13/18
to Cukes
Feature File: 

@Login_Valid
Feature: Login to Volare Collector
Description:  As a user, I want login to Volare Collector 

  Scenario: Valid Login
    Given Volare Collector Home Page opens in browser
    When I login to Volare Collector with Username and Password
    Then Page navigate to Volare Collector Home Page





Message has been deleted
Message has been deleted

Wong Peter

unread,
Apr 15, 2018, 11:38:46 PM4/15/18
to Cukes
My Source code. Please have a look.
Message has been deleted

Wong Peter

unread,
Apr 15, 2018, 11:43:42 PM4/15/18
to Cukes
Reply all
Reply to author
Forward
0 new messages