cucumber / cucumber-eclipse

Eclipse plugin for Cucumber
MIT License
192 stars 149 forks source link

Test runner class not found in selected project in Cucumber #450

Open ratelz opened 2 years ago

ratelz commented 2 years ago

Issue: Test class not found in selected project

Steps to recreate:

Create a cucumber feature file. Create a Step Definitions file Create a Runner test file using Junit But when I run the Runner file , it shows all tests are passed but when I click on any of the test it shows the error "Test class not found in selected project".

Screenshot 2022-01-26 162724

Screenshot 2022-01-26 162914

Screenshot 2022-01-26 162945

Screenshot 2022-01-26 164251

mpkorstanje commented 2 years ago

You're using cucumber-junit which integrates Cucumber with JUnit 4. This means that you are using the JUnit Plugin for Eclipse, not the Cucumber plugin.

While JUnit 4 no longer requires tests to be classes most tools still assume this is the case because JUnit 4 does not provide a way for Cucumber to specify if the test file is a class or something else. So I would consider it unlikely that this bug will be fixed by the Eclipse team.

With JUnit 5, JUnit does provide a way for Cucumber to communicate that the test files are files and where they are located. Though the JUnit Eclipse Plugin is equally unable to handle this. Still I would consider it possible that this bug will be fixed by the Eclipse team. So consider switching to JUnit 5 with the cucumber-junit-platform-engine and file a bug report with the Eclipse Team.