Upgraded to Geb 5.0 and can't figure out how to run smoke tests that worked on Geb 4.0

50 views
Skip to first unread message

jc

unread,
Aug 18, 2021, 11:22:30 AM8/18/21
to Geb User Mailing List
I have been dreading when this day would come but I am hoping some of the smart people here can help me out.  The way we run our smoke tests (and other subsets of tests) is by using the @Category tag from Junit4 and running that with a gradle task.  Since spock 2 no longer uses Junit4, @Category no longer works.

From my reading and research, @Category was replaced with @Tag in Junit5.  Marcin previously provided me this link which seemed simple enough but unfortunately it is not working.

I have 2 MVPs on my github I put together to demonstrate how it is working in Geb4/Junit4 and how I am trying to get it to work in Geb5/Junit5.  If someone is able to take a look and help me out I would really appreciate it.  If it doesn't look like this route is going to work, I'd love some ideas on tagging tests for smoke tests that is similar to this solution.

https://github.com/jacattau/smoketestGeb4 - this one you should be able to checkout and run.  There are 2 test classes with 2 tests each.  Running the "chromeSmokeTest" gradle task should run 1 test in each class with the @Category(SmokeTest) annotation.

https://github.com/jacattau/smoketestGeb5 - this one is updated to Geb5 and Groovy 3.0.8. This has the same 2 test classes and same 4 tests (2 each).  I updated the tests ti yse the @Tag annotation and changed the gradle task to useJUnitPlatform and when I run it, it says "Test events were not received".  If I add @Test to the method as well and it actually launches the browser but fails and runs the test with a weird name like "$spock_feature_3_0()".

I'd love some help if anyone has any ideas.

jc

unread,
Aug 18, 2021, 11:25:00 AM8/18/21
to Geb User Mailing List
Sorry, here is the link Marcin provided me with: https://mkyong.com/junit5/junit-5-tagging-and-filtering-tag-examples/

Marcin Erdmann

unread,
Aug 22, 2021, 7:11:22 AM8/22/21
to geb-...@googlegroups.com
Unfortunatelly, @Tag is specific to the Jupiter JUnit engine and the test runner of Spock 2 is a separate test engine for JUnit platform and it does not implement test filtering using the @Tag annotation. For Spock 2 you will need to use it's own test filtering mechanism implemented using config scripts -  see https://spockframework.org/spock/docs/2.0/extensions.html#spock-configuration-file and https://spockframework.org/spock/docs/2.0/extensions.html#_include_and_exclude.

--
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/497afc89-c972-4121-a931-0fde24ea2436n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages