Closed skinny85 closed 7 years ago
I think fixing this would require changing the way Specnaz builds the tree of JUnit's Description
objects. Right now, we create a new Description
below the class Description
, from the top-level String passed to describes
. All of the tests are children of that Description
. If we want to change the console output, we should probably instead switch to a single Description
at the root of the tree, most likely ClassName.<TopLevelDescription>
(StackSpec.A Stack
in the case of the above example).
I've worked on this issue today, and unfortunately there's nothing we can do to fix this :(
That class name in the Gradle output above is emitted by JUnit, and there is no way to get rid of it, or modify it. It will always be the simple name of the test class being ran.
The console output is not the limit of the problems, anyway. In the HTML report, for example, the test cases are wrong - the nested groups formed by calling it.describes
are listed next to the top-level test descriptions from calling describes
in the Specnaz
interface. I have no idea how to fix that either.
Hopefully, when JUnit 5 comes out (and with it the JUnit Platform), the integration with JUnit will become easier and less hacky. Until that time, I'm afraid there's nothing we can do to fix these issues.
When running Specnaz tests from the console, the top-level description (the one given to the
describes
method from theSpecnaz
interface) is not always shown when reporting the name of the tests.This depends somewhat on the build tool being used, but, for Gradle (if you add:
to your
build.gradle
), for the following, slightly modifiedStackSpec
from theReadme.md
:...the Gradle output is the following:
A correct output would probably look more like: