Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber, Java8: find usage of step defined by lambda expression

Currently in our project's tests we switched from using annotated step definitions, e.g.:

public class Steps {
    @Given("^Step name$")
    void methodName() { 
        // do sth
    }
}

to lambda expressions:

public class Steps implements En {
    public Steps() {
        Given("^Step name$", () -> 
            // do sth
        );
    }
}

When using Intellij Cucumber Java plugin it was easy to find the usage of some step, since it looked for usages of the annotated method (I presume). Now however, we have to manually search for the regex passed as the argument.

My first question is: is there a neat way to do this with lambda expressions?

Moreover: when using Intellij's tool for version control and commiting files containing definitions of big numbers of steps, the code analysis tool goes on forever (I guess it is because of the constructor having to crank a lot of code).

So the second question is: since there is no possibility of the step library shrinking and step usage search is used very often wouldn't it be a good idea to switch back to Ye Olde Way i.e. using annotated methods?

like image 364
DCzo Avatar asked Nov 07 '22 09:11

DCzo


1 Answers

Find usages for java-8 style step definitions do not yet work. One can vote and follow this request: IDEA-144648.

like image 124
Andrey Avatar answered Dec 01 '22 02:12

Andrey