Is there any way with Spek to add categories for t...
# spek
t
Is there any way with Spek to add categories for tests? Specifically looking for for something to allow having a gradle task that runs long running tests and let the default gradle test task only execute fast unit tests.
t
I would say you should put your long running tests in a separate source set, similar to https://docs.gradle.org/current/userguide/java_testing.html#sec:configuring_java_integration_tests Other option would be create special tasks for each test types and use tests filtering:
Copy code
task testWithDockerChrome(type: Test) {
    filter {
        includeTestsMatching 'ShouldSeleniumContainerTest'
    }
    ignoreFailures = true
    testLogging.exceptionFormat = 'full'
    testLogging {
        events "passed", "skipped", "failed"
    }
//    systemProperties System.properties
    systemProperties = [
            'file.encoding'   : 'UTF-8',
            'selenide.browser': 'chrome',
            'BUILD_URL'       : System.getenv()['BUILD_URL'],
    ]
}
filtering docs - https://docs.gradle.org/current/userguide/java_testing.html#test_filtering Haven't used any of this, would love to hear what worked for you
t
Yep, we're using the separate source set right now. At one point I was hitting some runtime "no such method exists" errors that I was convinced at first was due to the source sets not having visibility into some of the implementation.
What'd be pretty cool would be to have some common ways of integration testing that operate at different "levels", ones that have specific visibility (or not) into the implementations, e.g. tests that run in a different process space than the subject under test (service integration) and tests that run in the same process space but exercise the implementation combined with a dependent external service such as a persistence layer
Ultimately I was able to stick with the separate source set
👍 1