Configuring Gradle to Show Test Runner in IDEA on Integration Tests

I'm trying to segregate our Cucumber integration tests from our Spock unit tests since the latter are much faster and are executed more frequently.

While the Cucumber integration tests run under IDEA 14.1.4 (IU-141.1532 under OSX), the test runner view isn't showing; i.e. no red bar/green bar view. I also tested it under the latest IDEA 15 EAP.

All that happens is the console indicates the build was successful or tests failed. If there were failures, the failures are listed in the console, but the failures are not even shown in a power assertion format:

:integrationTest

com.demo.RunCukesTest > Scenario: Order upgrade from X to Y. Then Order Y is blah FAILED
    org.codehaus.groovy.runtime.powerassert.PowerAssertionError

com.demo.RunCukesTest > Scenario: Order upgrade from X to Y.classMethod FAILED
    org.codehaus.groovy.runtime.powerassert.PowerAssertionError

333 tests completed, 2 failed
:integrationTest FAILED


I should note that when the Cucumber tests were under src/test/groovy, the test runner view displayed correctly.

The build is recognized as failed and the HTML reports generated are still good, so this will be okay from a CI server standpoint, but we developers like the visual feedback presented by the red/green bar view!

I'm sure I've misconfigured something in Gradle, but am not sure what. Here are the changes I made:

sourceSets {
    integrationTest {
        groovy {
            compileClasspath += main.output + test.output
            runtimeClasspath += main.output + test.output
            srcDir file('src/integration-test/groovy')
        }
        resources.srcDir file('src/integration-test/resources')
    }
}

configurations {
    integrationTestCompile.extendsFrom testCompile
    integrationTestRuntime.extendsFrom testRuntime
}

idea {
    module {
        //add integration test source dirs to IDEA
        
testSourceDirs += file('src/integration-test/groovy')
        scopes.TEST.plus += [ configurations.integrationTestCompile ]
    }
}

...

 
 
@RunWith(Cucumber.class)
@CucumberOptions(
    format=["pretty", "html:build/reports/cucumber"]
)
public class RunCukesTest {
//leave me empty!
}


In summary, the integrationTest task is set up and executes the Cucumber tests. Reports are being generated properly. The only thing that doesn't seem to be working is, IDEA doesn't show the test runner during test execution.

What do I need to do to this configuration to get my integration tests to run in the test runner view in IDEA?

Thanks in advance!

--
jack

4 comments
Comment actions Permalink

IDEA Gradle Test Runner does not support other gradle test tasks then built-in 'test' because of gradle tooling models limitations (it does not provide a task type), see details at https://docs.gradle.org/2.7/javadoc/org/gradle/tooling/model/GradleTask.html.
However there is an alternative way to implement the feature, you can track related issue at https://youtrack.jetbrains.com/issue/IDEA-133107

0
Comment actions Permalink

Thanks for the info.

The issue at https://youtrack.jetbrains.com/issue/IDEA-133107 suggests there will be a fix in IDEA 15, but I saw the same behavior in 15 EAP as in 14.1.4/14.1.5; that is, integrationTest task outputs mostly in console, but not in a test runner view.  (I say mostly because running the integrationTest task in Gradle from commandline at least shows a running count of tests, but the console in IDEA just sits there until all tests are finished and then reports outcome.)

Is the fix for this still slated for IDEA 15?

--
jack

0
Comment actions Permalink

Is the fix for this still slated for IDEA 15?

yep, it will not be available in IDEA 15 Public Preview build but it will be added in one of the further 15 EAP builds

0
Comment actions Permalink

I think my question has been answered now.

Thank you.

--
jack

0

Please sign in to leave a comment.