-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to separate test types (unit, integration, ui, end-to-end, etc.) when using Spek #572
Comments
@tkrullmann (from gradle-testset-plugin) answered the following to my problem with Spek:
@raniejade, Would it be possible to make the Spek runner to scan only the |
Another option is to create separate Gradle source sets and corresponding test tasks. This has the advantage of allowing you to have different dependencies for each type of test (which can be useful when you want to enforce the level at which different tests operate). I have this set up in a project, take a look at https://github.com/charleskorn/batect/blob/master/app/build.gradle, https://github.com/charleskorn/batect/blob/master/app/gradle/integrationTest.gradle and |
@charleskorn Yes, that's exactly what I did. And it is also my prefered option. The only difference is that I use gradle-testsets-plugin to make my build really simpler, and avoid writing the same boiler-plate in all my projects. But Spek doesn't work well with that plugin, because it ignores the I see, you managed to make it work with a manual configuration. But it is really a shame that we cannot use Anyway, I personally think that:
EDIT: |
Apologies for the late reply - been very busy lately.
It wasn't ignored, nothing was passed to Spek. Scanning the classpath will only happen if no
Indeed.
There's no "recommended" approach, documentation-wise I'd used vanilla gradle (separate sources sets, manually creating test class, etc...). Looks like the bug was in |
There was indeed a problem in However, if I'm personally no longer blocked, I don't consider this issue solved. Here hare the things that (I think) should be done before closing this issue:
|
I think we need to disambiguate in the docs JUnit Platform vs JUnit Jupiter (collectively known as JUnit 5), pretty common misunderstanding.
Yep, definitely going to happen.
|
I'm trying to use testSets { |
The other test sets are not executed by default - that's by design. You have to either include the
in your build script. |
yeah I got that, I'm running 14:46:29.278 [DEBUG] [TestEventLogger] Gradle Test Run :integrationTest STARTED |
Finally got my different sourceSets working. I have to add this to discover and execute the tests.
Then I had to add the spek framework explicitly to the integrationTest config so the test runner can find the spek tests to execute. NOTE: I also had to repeat the testing log configuration I had in the test config so the SUCCESS tests appear on console.
|
Hello,
As far as I understand neither
@Category
(Junit4) nor@Tag
(JUnit5) annotations can be used in conjunction with Spek righ?Separating test source would be my preferred option. But I encountered trouble trying do to so using gradle-testset-plugin... (see unbroken-dome/gradle-testsets-plugin/issues/62).
The last option I am aware of, is to create filter rules based on the class name. That's my least preferred option, because I find it quite error prone.
May I ask what is the recommended way of separating integration-test and unit-test when using Spek?
Is it planned to support or add an equivalent of
@Tag
for Spek?EDIT: Actually even filtering by name doesn't work. Gradle's test filter only work for Junit classes, but has no impact on Spek tests. So, as far as I know, there is no way to separate test type when using Spek...
The text was updated successfully, but these errors were encountered: