maiflai / gradle-scalatest

A plugin to enable the use of scalatest in a gradle Scala project.
The Unlicense
73 stars 35 forks source link

Test filter that contains wildcard (provided as CLI arguments) seems to cause filter to malfunction. #84

Closed tribbloid closed 3 years ago

tribbloid commented 4 years ago

A simple example:

$ ./gradlew common:test

> Task :common:test FAILED
Discovery starting.
Discovery completed in 139 milliseconds.
Run starting. Expected test count is: 27
...
*** 2 TESTS FAILED ***

FAILURE: Build failed with an exception.

The following command should be equivalent, however:

$ ./gradlew common:test --tests "*"

> Task :common:test
Discovery starting.
Discovery completed in 154 milliseconds.
Run starting. Expected test count is: 0
Run completed in 164 milliseconds.
Total number of tests run: 0
Suites: completed 0, aborted 0
Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
No tests were executed.

BUILD SUCCESSFUL in 1s
3 actionable tasks: 1 executed, 2 up-to-date

So what should I do to activate this feature?

maiflai commented 3 years ago

Sorry, I think the underlying ScalaTest runner doesn't support this form of filter.

The expected way of filtering is to pass the name of a test - do you have a real world example that you want to support please?

anthonyemerson commented 3 years ago

I'm not certain of the above users use case, but for my purpose I want to run only specific folders. We have different tests depending on the environment under test so all the tests are in the same module but sorted by folders. A good example would be sbt's testOnly command

./sbt "testOnly **.specs.fullstack.*

So in this case sbt would run all of the tests in our 'fullstack' folder. In moving over to gradle I have found that trying to implement similar test cases through custom tasks in my build.gradle either runs no tests or all of them

anthonyemerson commented 3 years ago

Nevermind, of course not 5 minutes after writing this I found that

suite 'specs.fullstack.*' works where include 'specs.fullstack.*' failed

maiflai commented 3 years ago

ok - please can we close this issue?

anthonyemerson commented 3 years ago

Seems reasonable to me but I don't know if my fix is true for the original poster