Closed netvl closed 4 years ago
Hi,
This sounds like a bug - please could you try running the command line with --console plain
?
Thanks, Stu
I observe exactly the same behavior with --console plain
, although test block names appear to be indented correctly. Still no context messages, though.
Could this be related to test reports generation? In the project where I have HTML reports generation disabled (in order not to add a dependency to pegdown), I observe this issue. In another project, which does have a pegdown test runtime dependency, I see the test descriptions printed out correctly.
Ah - that is interesting, what is the issue preventing the use of pegdown on the other project please?
Would it be possible to add it temporarily?
Oh, sorry for misleading - it seems that I was wrong. I was under impression that that first project did have HTML reports disabled, but it seems this is no longer the case since some time ago (we have pegdown in the testRuntime scope now). I still observe the issue even then :(
Please could you supply a sample project? I don't seem to be able to reproduce this on the command line of macOS with Gradle 5.2.1 and scalatest 3.0.5.
Task :scalatest Discovery starting. Discovery completed in 89 milliseconds. Run starting. Expected test count is: 1 FreeTest: Some thing when some condition holds - should do whatever (13 milliseconds) Run completed in 184 milliseconds. Total number of tests run: 1 Suites: completed 2, aborted 0 Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0 All tests passed.
A year has passed since - sorry for the long delay! It just happened that I worked on another project which did not exhibit this behavior, so it did not bother me much.
However, now I believe I know the reason. This behavior - whether to print context messages or not - is controlled by the TestLogEvent.STARTED
option, whose absence maps to -oNHP
arguments to the Scalatest runner. I see that the Scalatest plugin sets all TestLogEvent
values, but apparently one of our internal plugins resets them back to a limited subset, which does not include TestLogEvent.STARTED
. The thing is, in one of our projects we have our internal plugin applied before the Scalatest plugin, but in others it is the other way around. This naturally results in different enabled event configuration.
So I guess this could be closed :) thanks!
Great, thanks very much.
Stu
If you use
FreeSpec
, you can define nested tests like this:Here the
in
block is the actual test which is run, while the enclosing statements provide context. When you run the tests e.g. with SBT, test execution output looks like this:With Gradle scalatest plugin, however, only the actual test block name is printed:
I couldn't find any way to enable the full output approach with configuration. Is this a bug or intentional behavior?