Anukul Singhal
2018-06-14 22:27:44 UTC
Hi,
I have a use case which requires me to capture the step name being
executed, just like how you can do it with Scenario class. Here is the
Hooks class content that I have:
public class Hooks {
TestContext testContext;
public Hooks(TestContext context) {
testContext = context;
}
@Before
public void beforeScenario(Scenario scenario) {
System.out.println("Executing before scenario for : " +
scenario.getName());
}
@After
public void afterScenario(Scenario scenario) {
System.out.println("Executing after scenario for : " +
scenario.getName());
}
@BeforeStep
public void beforeStep() {
System.out.println("In Before step...");
//TODO: Need to capture the Step which is going to execute
//Need some kind of implementation like step.getName()
}
@AfterStep
public void afterStep() {
}
}
I tried to pass in *PickleStep object* as an argument to *beforeStep()*
method but seems like it only likes to have args of type
*cucumber.api.Scenario* class (or no args). Is there anyway I can *capture
the current step name* being executed in @BeforeStep annotation?
I am using *cucumber-java - 3.0.2 (io.cucumber)*
Thanks,
Anukul
I have a use case which requires me to capture the step name being
executed, just like how you can do it with Scenario class. Here is the
Hooks class content that I have:
public class Hooks {
TestContext testContext;
public Hooks(TestContext context) {
testContext = context;
}
@Before
public void beforeScenario(Scenario scenario) {
System.out.println("Executing before scenario for : " +
scenario.getName());
}
@After
public void afterScenario(Scenario scenario) {
System.out.println("Executing after scenario for : " +
scenario.getName());
}
@BeforeStep
public void beforeStep() {
System.out.println("In Before step...");
//TODO: Need to capture the Step which is going to execute
//Need some kind of implementation like step.getName()
}
@AfterStep
public void afterStep() {
}
}
I tried to pass in *PickleStep object* as an argument to *beforeStep()*
method but seems like it only likes to have args of type
*cucumber.api.Scenario* class (or no args). Is there anyway I can *capture
the current step name* being executed in @BeforeStep annotation?
I am using *cucumber-java - 3.0.2 (io.cucumber)*
Thanks,
Anukul
--
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.
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.