Spek: Improve grouping in JUnit test reports

Created on 10 Dec 2015  路  15Comments  路  Source: spekframework/spek

I've setup a test repo for this issue here.

When I run Spek suites in IntelliJ IDEA, the reports looks awesome:
IntelliJ IDEA test report

Suite class's name is visible alongside with it's package. The sings are aligned in tree. Just great.

But when I run tests in Gradle (./gradlew test) the report (build/reports/tests/index.html) is not so good:
Gradle test report - root
Gradle test report - default-package expanded
Gradle test report - arithmetics expanded

  • Everything is put inside default-package, which is not true.
  • given / describe / on blocks appear in one list.

I understand that reports are not supposed to support custom tree structures, but wouldn't it be better if describe goes to package name and all ons being grouped by them?

Also, XML reports should be tweaked too to improve reporting on CI...

Most helpful comment

@artem-zinnatullin AFAIK there is no official JUnit 4 support in the Android Gradle Plugin.

But if it's possible without breaking Android Studio's unit testing capabilities this would be a great thing. Spek's own documentation just mentions Junit4 support for Android. Would you mind updating it? https://github.com/JetBrains/spek/blob/master/documentation/src/asciidoc/setting-up.adoc#setting-up-legacy

All 15 comments

Any plans for this?

bump...
+1

We just upgraded to JUnit 5 which should fix the XML reports. However currently it doesn't generate the html reports. We will be releasing 1.0 soon, so stay tuned.

As of Spek 1.0.89, tests still reside in default-package.

As we're stuck with Junit4 on Android I'd like to know whether you're planning on improving grouping there as well.

@ubuntudroid we're not stuck with JUnit4 "on Android", if you run tests on JVM, you can use JUnit5 (with few hacks for now, but still possible)!

@artem-zinnatullin AFAIK there is no official JUnit 4 support in the Android Gradle Plugin.

But if it's possible without breaking Android Studio's unit testing capabilities this would be a great thing. Spek's own documentation just mentions Junit4 support for Android. Would you mind updating it? https://github.com/JetBrains/spek/blob/master/documentation/src/asciidoc/setting-up.adoc#setting-up-legacy

bump +1

Do I understand correctly that this issue is blocked by some issues in gradle?
Like these:
#4438
#4252

Will this issue be solved for Spek 2.0.0?

Loosing hierarchy information in reports make it very cumbersome to track the cause of failing tests.

@grine4ka I don't see how it could be related. Theses are gradle issue. Spek shall produce good test reports independently on the build system used. No matter if it is gradle, maven or something else.

@grine4ka is correct as we depend on gradle for generating reports. Spek already reports the proper hierarchy , it's all up to gradle on how it is rendered.

Thanks @raniejade for the precision. Does it mean that maven users don't experience this issue?

I'm not sure, I don't use maven that much.

I'm not sure, I don't use maven that much.

I experienced the same with Maven.

Spek already reports the proper hierarchy , it's all up to gradle on how it is rendered.

Should this issue be closed then?

Or maybe Spek could provide a workaround? By concatenating the hierarchy information in the test name for instance.

Or maybe Spek could provide a workaround? By concatenating the hierarchy information in the test name for instance.

Nope, hacky solutions will only add more problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raosuj picture raosuj  路  3Comments

alejandropg picture alejandropg  路  6Comments

yaroslav-shlapak picture yaroslav-shlapak  路  4Comments

ruigoncalo picture ruigoncalo  路  7Comments

fabiocarballo picture fabiocarballo  路  3Comments