Skip to content

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

@KTOLE18

Description

@KTOLE18

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions