jlagerweij / cucumber-kotlin

Jetbrains plugin for Cucumber step definitions written in Kotlin
https://plugins.jetbrains.com/plugin/10527-cucumber-for-kotlin
Other
20 stars 16 forks source link

Feature file can't find kotlin step definitions or does not support cucumber-android method annotations #34

Open KTOLE18 opened 3 years ago

KTOLE18 commented 3 years ago

io.cucumber.android.runner.CucumberAndroidJUnitRunner supported? If not please do so.

My step definitions consist of classes with methods defined like: ` @Given("I am on the log in page")     fun i_am_on_the_login_page() {         //assert the current activity is login activity         login {             isLoaded()         }     }

    @When("I click the email field")     fun i_click_the_email_field() {

        login {             clickOn(emailField)         }     }`    

Making use of the cucumber step annotations from: import io.cucumber.java.After import io.cucumber.java.Before import io.cucumber.java.en.And import io.cucumber.java.en.Given import io.cucumber.java.en.Then import io.cucumber.java.en.When

    Based off of the cucumber-android kotlin example in this: cucumber-android project

    Running Android Instrumented tests from the features folder works but in the IDE the Feature file hints that all steps have not been implemented and can not jump to the step on click.         The Test Results Navigator can not jump to the source (it's disabled)

An attempt to Generate a code snippet from the feature file produces a format without Given, When Then Annotations, and an import of the cucumber.api.java8.En library which can not find "En"

 `import cucumber.api.java8.En

class login_detailsSteps : En {     init {         Given("I am on the log in page") {

        }     } }`    

Screen Shot 2021-06-14 at 2 27 39 PM

When Android Studio supported the Cucumber for Java plugin, the steps in the feature file would at least jump the source via the Given, When, Then, Cucumber annotations. This plugin does not appear to do that and I have not found a workaround other than using IntelliJ CE with the java for cucumber plugin and giving up on code snippet generation.

KTOLE18 commented 3 years ago

I should mention this is with the recommended io.cucumber:cucumber-android package not the info.cukes:cucumber-android package.

jlagerweij commented 3 years ago

The cucumber.api.java8.En class comes from the dependency io.cucumber:cucumber-java8. You need to depend on that to make it work. This plugin does not work with annotations, sadly.

tassilo-posegga commented 1 year ago

So the plugin is not compatible with io.cucumber:cucumber-android ? I was running into the same issue