Cucumber Undefined Step, Though Defined Using IntelliJ

后端 未结 5 803
慢半拍i
慢半拍i 2020-12-16 22:12

I\'m trying to run a .feature file to test a simple RESTEasy web application: https://github.com/dashorst/jaxrs-quickstart-resteasy.

However, the IntelliJ keeps say

相关标签:
5条回答
  • 2020-12-16 22:22

    I made the same mistake and found several different answers. But the same mistake always remained. So I ended up finding the solution. I was using a cucumbe.api dependency, but in my Steps class I was importing io.cucumber, so my steps could not be found. Then delete the import and select the correct import.

    enter image description here

    0 讨论(0)
  • 2020-12-16 22:29

    I'll recommend a solution step by step while there is correct solutions above.

    1. Go through "Run > Edit Configurations..." within your IntelliJ
    2. Select your cucumber java class from "Cucumber java" list
    3. Fill the "Glue" with the path where your cucumber implementation is in. For example, "com.blabla.test.steps"
    4. Click "Apply" button
    5. Try to run/debug your cucumber feature file
    0 讨论(0)
  • 2020-12-16 22:33

    Try this:

    1. Cucumber for java plugin is installed and compatible with your intellij idea version
    2. Create and mark test\resources as Test Resources Root
    3. Put the .feature in test\resources
    4. Create the folder step_definitions in test\java and put your test code there
    5. Check that the Feature configuration contain step_definitions as Glue
    6. Check if the step_definitions code is building properly

    After those checks the steps should be recognized.

    0 讨论(0)
  • 2020-12-16 22:34

    Double check you 'glue' in the Idea (Configuration), in my case I caught such issue while entering incorrect (glue from dependent project not current) glue.

    0 讨论(0)
  • 2020-12-16 22:35

    Sometimes it happens when there are saved references to the old names of the packages. If the packages have been renamed you should check if there are references to the old names (Cucumber Run/Debug Configurations) and delete them.

    Kind regards

    0 讨论(0)
提交回复
热议问题