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 ] }
}
...
task integrationTest(type: Test) {
group = 'verification' testClassesDir = sourceSets.integrationTest.output.classesDir classpath = sourceSets.integrationTest.runtimeClasspath shouldRunAfter test outputs.upToDateWhen { false }
}
At first, I thought the RunCukesTest class (shown below) wasn't being used, but the Cucumber formatted test report is generated, so it must be executing.
@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