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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/c2449a17-05b7-45d4-9e0d-4af8bf5208bd%40googlegroups.com.

Reply via email to