question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No tests are discovered if feature starts with comments followed by description

See original GitHub issue

👓 What did you see?

It seems that (at least) the junit-platform-suite fails to discover tests if any feature starts with a comment followed by a description

✅ What did you expect to see?

Tests should be discovered since syntax is correct

📦 Which tool/library version are you using?

Cucumber for java 7.8.1

🔬 How could we reproduce it?

Steps to reproduce the behavior:

  1. A feature which starts with a comment followed by a description
Feature: Feature 2
  # some comment
  some description

  Scenario: Scenario 1
    * Wait 3s
  1. Run feature, either from Maven or from the IDE. You may also try to execute the whole suite of tests containing this Feature. No test will be executed.
  2. See error from maven surefire plugin:
[ERROR] There was an error in the forked process
[ERROR] TestEngine with ID 'junit-platform-suite' failed to discover tests
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] TestEngine with ID 'junit-platform-suite' failed to discover tests
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:701)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:311)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:268)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1334)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1167)

You can reproduce this issue by building the following cucumber-showcase project: https://github.com/fslev/cucumber-showcase.git

mvn clean test

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mpkorstanjecommented, Oct 31, 2022

Gherkin has a grammar that explicitly includes comments and comments are not allowed before the description.

https://github.com/cucumber/common/blob/main/gherkin/gherkin.berp#L37

DescriptionHelper := #Empty* Description? #Comment*

You may want to create an issue in https://github.com/cucumber/common to address that.

0reactions
mpkorstanjecommented, Nov 2, 2022

Yeah, that’s between JUnit 5 and Surefire. You could petition the JUnit 5 team to include more information in the JUnitException thrown when discovery fails.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TestExplorer does not discover new tests in existing test class
Open solution with NUnit test classes builds fine. After the build process test explorer shows and runs all tests successfully. Test results are...
Read more >
Python Unittest: No tests discovered in Visual Studio Code
The python Testing plugin won't find your tests if there is an error in the test script. To check for a potential error,...
Read more >
How to resolve cases of Visual Studio “No tests appearing”
An upcoming blog post will detail a procedure for how to do this. One good tip here is to determine if it is...
Read more >
doctest — Test interactive Python examples — Python 3.11.1 ...
This will import example.py as a standalone module and run testmod() on it. Note that this may not work correctly if the file...
Read more >
Set up unit testing for Python code - Visual Studio
Setting up unit testing for Python code in Visual Studio takes full advantage of Test Explorer features to discover, run, and debug tests....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found