-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should work for cucumber scenario outlines #83
base: develop
Are you sure you want to change the base?
Should work for cucumber scenario outlines #83
Conversation
I already signed the CLA. |
Hey @alexmsmartins, I was the primary maintainer of this repo for the past several years. I no longer use SBT much because my company was acquired by a company that uses Gradle. We should find someone at Lightbend to take over this repo and review your PR. I'll let you drive that since you're probably more motivated to get this change in A couple places you might try: @dwijnand @jsuereth would you be able to help find a new maintainer for this repo? |
Hi @benmccann , @dwijnand and @jsuereth Is it possible to just get merge permissions? That should get things going because, in my team, we keep getting bitten by this problem where scenarios with the same name that pass basically stop failing scenarios with the same name in other files from failing the build. And the fix in this PR does solve that problem. While you don't get a new maintainer, I could just push things forward a bit. |
@szeiger perhaps you could help review this PR? @alexmsmartins do you mind rebasing this PR? sorry I know it's quite old |
I'll add one more possible name on here: @eed3si9n |
I'd be happy to review and get this to finish line. |
@@ -0,0 +1,57 @@ | |||
/* | |||
* Copyright (c) 2015, Michael Lewis | |||
* All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems problematic. If we're doing Lightbend CLA the copy right needs to transfer to Lightbend.
I don't know anything about Cucumber, but this sounds like their bug? I feel uneasy compromising the overall contract of testframework for all junit-interface users just to workaround Cucumber bug/oddity. |
IMHO It doesn't feel like a bug in Cucumber, the same case works absolutely fine in Scala+Maven. |
JUnit uses the Cucumber is currently using So rather then depending on the class and method name to determine test identity the |
"org.scalatest" %% "scalatest" % "3.0.1" % "test", | ||
"io.cucumber" % "cucumber-core" % "2.0.0" % "test", | ||
"io.cucumber" %% "cucumber-scala" % "2.0.0" % "test", | ||
"io.cucumber" % "cucumber-jvm" % "2.0.0" % "test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pom dependency and not required.
|
||
libraryDependencies ++= Seq ( | ||
"org.scalatest" %% "scalatest" % "3.0.1" % "test", | ||
"io.cucumber" % "cucumber-core" % "2.0.0" % "test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a transitive dependency of cucumber-scala
and not required.
libraryDependencies ++= Seq ( | ||
"org.scalatest" %% "scalatest" % "3.0.1" % "test", | ||
"io.cucumber" % "cucumber-core" % "2.0.0" % "test", | ||
"io.cucumber" %% "cucumber-scala" % "2.0.0" % "test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a rather old version. Latest is 4.7.1
https://search.maven.org/search?q=g:%22io.cucumber%22%20AND%20a:%22cucumber-scala_2.12%22
private void postIfFirst(AbstractEvent e) | ||
{ | ||
e.logTo(logger); | ||
if(reported.add(e.fullyQualifiedName())) handler.handle(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported
now goes unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractEvent
should probably expose Description
, and reported
should use the description's identity to track whether the event has been posted or not.
Thanks for the explanation. I guess the impedance mismatch here is that junit-interface (and sbt test frameworks in general) tries to lookup tests using a mechanism called fingerprint and it's either package cucumber
import cucumber.api.CucumberOptions
import cucumber.api.junit.Cucumber
import org.junit.runner.RunWith
@RunWith(classOf[Cucumber])
@CucumberOptions(
features = Array("classpath:features"),
glue = Array("com.waioeka.sbt"),
strict = true,
)
class CucumberApplicationSpec sbt would then send back the task definition for
That makes sense. Currently it's testing for |
✔️ For anyone coming here, please note that starting from version 6.2.2 cucumber-junit now adds a unique number to workaround this issue (see cucumber/cucumber-jvm#2045). |
Problem
Cucumber tests with Data Tables will pass with failing examples as long as the first example passes.
This happens because all the examples in have the same fully qualified name that comes from the scenario outline description.
The changes
This Pr simply allows for tests with equal names to pass through from the JUnit RunNotifier to the SBT EventHandler without repeats being filtered out.
The first commit in this test is a passing build that should have failed and the second commit is the fix.