sbt / sbt-jupiter-interface

Implementation of sbt's test interface for JUnit 5's Jupiter module
Apache License 2.0
33 stars 18 forks source link

Suite task names broken: "Test class <name> is not enclosed by <suite>" and vintage suite names mangled #121

Open dji opened 2 hours ago

dji commented 2 hours ago

I'm seeing similar problems as #54 and #87, where TaskName is expecting the suite name to make up the first part of class names - likely as this code was first written for @Nested classes.

java.lang.RuntimeException: Test class path.to.my.TestClass is not enclosed by path.to.my.SuiteClass

87 wasn't a complete fix as it only dealt with ClassSource test sources and not MethodSource ones.


Even with this fixed though, vintage test names were still being mangled. Where I would expect path.to.my.TestClass#testMethod with highlighting, I was seeing path.to.my.TestClasstestMethod(path.to.my.TestClass).

The problem is that when we chose a naming function based on engine that ran the test, we assume that a TestDescriptor has the Jupiter or Vintage engine in the first segment. In a suite though the Suite engine is actually the first segment, and Jupiter or Vintage is second.

dji commented 2 hours ago

122 fixes both of these issues for me, although we aren't using a ton of suite features