Hi, Marcin! 
Thanks for your reply!

*For 1.* I didn`t know about this option, you really help me. I just tried 
to run a few scripts and it works.
*For 2. *I found this article 
https://blog.jdriven.com/2018/10/combining-spock-junit-5-tests/ so, Junit5 
and Spock 1.2 should work together.
I`m not familiar with categories in Junit, should I somehow mark tests to 
some categories before create Gradle task?



On Wednesday, May 13, 2020 at 11:06:53 PM UTC+3, Marcin Erdmann wrote:
>
> Gordon,
>
> For 1., why don't you simply use built in test filtering provided by 
> Gradle Test task?
>
> ./gradlew uiTest --tests=ui.Ui1Spec --tests=ui.Ui5Spec --tests=ui.Ui17Spec 
> --tests=ui.UiRegression78Spec
>
> See 
> https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html#setTestNameIncludePatterns-java.util.List-
>  and 
> https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/TestFilter.html
> .
>
> For 2., I don't think Spock 1.2 supports JUnit5. Why don't you use JUnit 
> categories instead as described at the beginning of 
> https://docs.gradle.org/current/userguide/java_testing.html#test_grouping?
>
> Marcin
>
> On Mon, May 11, 2020 at 11:52 AM Gordon Freeman <[email protected] 
> <javascript:>> wrote:
>
>> Hi, guys! I need your advice.
>>
>> I have 2 test folders:
>> \src\test\groovy\tests\ui
>> \src\test\groovy\tests\api
>>
>> And have 2 tasks in Gradle:
>> task uiTest(type: Test) {
>>     doFirst {
>>         include "**/ui/${System.getProperty("testPackage", "")}"
>>         exclude "**/api/*"
>>     }
>>     maxParallelForks = 4
>>     forkEvery = 4
>>     testLogging.showStandardStreams = true
>> }
>>
>> task apiTest(type: Test) {
>>     doFirst {
>>         include "**/api/${System.getProperty("testPackage", "")}"
>>         exclude "**/ui/*"
>>     }
>>     maxParallelForks = 4
>>     forkEvery = 4
>>     testLogging.showStandardStreams = true
>> }
>>
>> I can easily execute one particular test OR all tests in one folder 
>> without any execution issues, example for ui tests:
>> gradlew.bat "-DtestPackage=/" clean uiTest -b build.gradle
>> gradlew.bat "-DtestPackage=/Ui1Spec*" clean uiTest -b build.gradle
>>
>>
>> So, I have 2 questions:
>> *1. *How can I execute more than 1 test simultaneously for one 
>> *testPackage*, but not all tests from *testPackage*?
>> *For example:* in
>>  '\src\test\groovy\tests\ui'
>> I have 100 tests, but I need to execute only* 'Ui1Spec', 'Ui5Spec', 
>> 'Ui17Spec'* and *'UiRegression78Spec'*
>>
>> *2.* How can I execute tests by *Junit5 *tag? 
>> *Let me explain:* previously I was working on another framework and we 
>> used Selenide+JUnit5, it was very easy to mark test by annotation 
>> @Tag('regression')
>> and then execute only tests which were marked:
>>  '-Dtag=regression'
>>
>> I was trying to create gradle task with this closure:
>>  useJUnitPlatform {
>>         includeTags 'regression' //or System.getProperty('tag') to make 
>> it generic
>>     }
>>
>> Found it here <https://www.baeldung.com/junit-5-gradle>but it doesn`t 
>> work with *Spock/Geb*, maybe because test classes doesn`t contain '*Test*' 
>> suffix? 
>>
>> FYI my dependencies: 
>>
>> gebVersion = '3.4' 
>> junitVersion = '5.6.1'
>> spockVersion = '1.2-groovy-2.5'
>> groovyVersion = '2.5.10'
>> compile "org.gebish:geb-spock:$gebVersion"
>> compile "org.codehaus.groovy:groovy-all:$groovyVersion"
>> compile "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
>> compile "org.codehaus.groovy:groovy-all:$groovyVersion"
>> compile "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
>> testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
>> testCompile("org.spockframework:spock-core:$spockVersion") {
>>         exclude group: "org.codehaus.groovy"
>>     }
>>
>> Thanks in advance! 
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/geb-user/c2449a17-05b7-45d4-9e0d-4af8bf5208bd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/geb-user/c2449a17-05b7-45d4-9e0d-4af8bf5208bd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/4bb8a13c-0f3a-40a6-beda-14836d672421%40googlegroups.com.

Reply via email to