Skip to content

The main goal of project is to provide implemenation of integration task in gradle

Notifications You must be signed in to change notification settings

PolomskiBartlomiej/gradle-integration-test-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gradle-integration-test-task

The main goal of project is to provide implemenation of integration task in gradle

integration tests assumptions

  1. language: groovy
  2. dedicated structure for source files and resources
  3. separate dependency configuration
  4. use classpath from main sources files
  5. unique task for running integration tests
  6. verification task group
  7. excluded from incremental gradle build mechanism
  8. run before check

implementation

  1. groovy + dedicated structure for source files and resources (src/intTest)
    intTest {
         groovy {
             srcDir "src/intTest/groovy"
         }
    
         resources {
             srcDir "src/intTest/resources"
         }
    
  2. separate dependency configuration
    configurations {
      intTestCompile.extendsFrom testCompile
      intTestCompile.extendsFrom integrationTestCompile, testRuntime
      intTestImplementation.extendsFrom implementation
      intTestRuntimeOnly.extendsFrom runtimeOnly
    }
    
    dependencies {
        ...
        intTestCompile group: 'org.codehaus.groovy', name: 'groovy', version: '2.4.15'
        intTestCompile group: 'org.spockframework', name: 'spock-core', version: '1.1-groovy-2.4'
     }
    
    Remark: configurations should be before dependencies section
  3. use classpath from main sources files
    sourceSets {
        intTest {
            ...
            compileClasspath += sourceSets.main.output + configurations.intTestCompile
            runtimeClasspath += sourceSets.main.output + configurations.intTestRuntime
        }
    }
    
  4. unique task for running integration tests
    task integrationTest(type: Test) {
      ...
    }
    
  5. verification task group
     task integrationTest(type: Test) {
        description = 'Integration tests'
        group = 'verification'
        ...
    }
    
  6. excluded from incremental gradle build mechanism
     task integrationTest(type: Test) {
        ...
        outputs.upToDateWhen {false}
    }
    
  7. run before check
      check.dependsOn integrationTest
    

About

The main goal of project is to provide implemenation of integration task in gradle

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published