Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Same step twice in a scenario confuses Eclipse's JUnit runner #211
JUnit associates an instance of its
Unfortunately, JUnit also uses the Description as a key to keep track of the state of test methods, i.e. whether they have run, failed, were ignored and so on. Thus, each test method/cucumber step must have an associated Description that is not Java-equal to any other Description in the whole Suite. Otherwise runners will get confused and report on the wrong steps.
Even more unfortunately, Descriptions are Java-equal when the labels contained within them are Java-equal. It follows that even with the current implementation of cucumber's
I see two ways to proceed here:
I'm going to have a look at the second option on Monday. From a glance at the code it seems finding the index of a step within a scenario should be a one-liner.
If you cucumber guys are ok with that approach, I will see if I can fix it that way and provide a pull request for it.
Great analysis! I think the short term solution is to work around JUnit in Cucumber-JVM. Perhaps just prepending a counter. That will look a bit ugly, but it seems to be the only option for junit 4.10 and older.
When a new JUnit is out with a fix for this, we should keep the short term solution as well, so that people who happen to be on an older junit can still have this working. We could decide at runtime whether to use the workaround or not.
Thanks for looking into this. If you create a junit ticket/pullreq, please link to this so they get the context.