Scenario: As a user, I want to login to the system
Given I am on my website
When I enter valid credentials
Then I am taken to the home page
The sce
Grabbing the annotation using self-reflection seems more straightforward to me:
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@When("^User enters username and password$")
public void userEntersUsernameAndPassword() throws Throwable{
Method callingMethod = new Object() {} .getClass() .getEnclosingMethod();
Annotation myAnnotation = callingMethod.getAnnotations()[0];
System.out.println("myAnnotation=" + myAnnotation);
Results in:
myAnnotation=@cucumber.api.java.en.Given(timeout=0, value=^User is in portal page$)