I am trying to get the annotation: ("someid") used in step definition of cucumber in custom plugin implementation. How to get this? is it possible?
StepDefinition
@Group(id="someid")
@Given("today is Sunday")
public void today_is_Sunday() {
today = "Sunday";
}
Custom Plugin class
package hellocucumber.listener;
import io.cucumber.plugin.ConcurrentEventListener;
import io.cucumber.plugin.event.*;
public class StepListener implements ConcurrentEventListener {
@Override
public void setEventPublisher(EventPublisher publisher) {
publisher.registerHandlerFor(TestStepFinished.class, this::handleTestStepFinished);
}
private void handleTestStepFinished(final TestStepFinished event) {
System.out.println("Status: "+event.getResult().getStatus());
System.out.println("Id: "+ event.getTestStep().getId());
System.out.println("Code Location: "+event.getTestStep().getCodeLocation());
if (event.getTestStep() instanceof PickleStepTestStep) {
PickleStepTestStep testStep = (PickleStepTestStep) event.getTestStep();
System.out.println("Get Step:" + testStep.getStep());
testStep.getStep().getText();
}
}
}