Tagging Smoke tests in Spock 2.0

132 views
Skip to first unread message

jc

unread,
Feb 26, 2021, 10:57:07 AM2/26/21
to Geb User Mailing List
This might be a Spock question vs a Geb question but I'm hoping someone here can help.  We currently have our Smoketests setup to run by tagging them with @Category. 

So we have an interface class setup like this:

Screen Shot 2021-02-26 at 9.50.38 AM.png

This allows us to tag any test we want to run as a smoke test with @Category(SmokeTest).  We have a grade job setup that will run all tests with this tag that uses useJUnit and the includeCategories to grab those tags:
Screen Shot 2021-02-26 at 9.53.20 AM.png

I know Spock 2.0 removes Category and breaks this setup completely and I'm not really sure how to fix this.  I've read that Category has been replaced with @Tag, but I don't know how this works with changing the interfaces and the gradle job to run them correctly.  As soon as I update to Spock 2.0 it all breaks.  

I'd really appreciate some input on how to fix this, or like some insights on how others are tagging their tests to run Smoke tests.

thok...@gmail.com

unread,
Feb 26, 2021, 12:30:48 PM2/26/21
to Geb User Mailing List
Hello jc, 

there is always the option to create a new Test task in Gradle, and include tests from there.

Example:

```
task smokeTest(type: Test) {
    // ...
    filter {
        includeTestsMatching 'my_package.ThisTest'
        includeTestsMatching 'my_package.OtherTest'
    }

Marcin Erdmann

unread,
Feb 27, 2021, 6:29:06 AM2/27/21
to geb-...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/25d037a0-aa85-4a2b-a7d2-29c4e18f543cn%40googlegroups.com.

jc

unread,
Feb 27, 2021, 10:02:41 AM2/27/21
to Geb User Mailing List
So it looks like maybe JUnit 5 added the includeTags and i completely remove the interfaces part of this out of it.  I will have to give this a try.

jc

unread,
Mar 2, 2021, 3:05:11 PM3/2/21
to Geb User Mailing List
I tried to take a look at this today and something isn't making sense to me.  I updated geb-spock to 4.0 and I updated spock-core to 2.0-M4-groovy-3.0.  When i tried the @Tag method I am getting errors that the import cannot be resolved for the @Tag.  Upon further digging it looks like spock-core 2.0-M4-groovy-3.0 isn't bringing in any JUnit 5 dependencies?   I know for sure that spock-core 1.3-groovy-2.5 is bringing in junit 4.12.  Am I supposed to be bringing the JUnit 5 dependency in myself or is it because Spock 2 hasn't been officially released?  

I guess I am confused because Geb 4.0 seems to still work with our setup, which I thought it would break.  Perhaps I shouldn't worry about this for now?

Reply all
Reply to author
Forward
0 new messages