Discussion:
[Cucumber] [Cucumber-JVM]: Cucumber @After hook executed twice
(too old to reply)
Wong Peter
2018-04-12 08:07:49 UTC
Permalink
Raw Message
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?

<Loading Image...>
@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.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mo Hijazi
2018-04-12 14:30:47 UTC
Permalink
Raw Message
How many scenarios in your feature file?
Post by Wong Peter
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?
<https://lh3.googleusercontent.com/-jd2i4SXBUkY/Ws8TtfDxgCI/AAAAAAAAAzo/fj75FmqNjdwlRivLZ-XJeVRVvIEA8hOewCLcBGAs/s1600/Screenshot_205.png>
@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.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wong Peter
2018-04-12 22:45:25 UTC
Permalink
Raw Message
1 feature file and 1 scenario within the feature file. That's all.

Peter Wong
016-396 3326
Post by Mo Hijazi
How many scenarios in your feature file?
Post by Wong Peter
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?
<https://lh3.googleusercontent.com/-jd2i4SXBUkY/Ws8TtfDxgCI/AAAAAAAAAzo/fj75FmqNjdwlRivLZ-XJeVRVvIEA8hOewCLcBGAs/s1600/Screenshot_205.png>
@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.
--
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wong Peter
2018-04-13 08:17:28 UTC
Permalink
Raw Message
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
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wong Peter
2018-04-16 03:38:46 UTC
Permalink
Raw Message
My Source code. Please have a look.
Post by Wong Peter
@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
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wong Peter
2018-04-16 03:43:42 UTC
Permalink
Raw Message
https://www.dropbox.com/s/4wvqczqa99j0ael/Cucumber_TestNG.zip?dl=0
Post by Wong Peter
My Source code. Please have a look.
Post by Wong Peter
@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
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mo Hijazi
2018-04-12 14:28:37 UTC
Permalink
Raw Message
How many Scenarios in your feature file?
Post by Wong Peter
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?
<https://lh3.googleusercontent.com/-jd2i4SXBUkY/Ws8TtfDxgCI/AAAAAAAAAzo/fj75FmqNjdwlRivLZ-XJeVRVvIEA8hOewCLcBGAs/s1600/Screenshot_205.png>
@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.
--
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...