The Gradle Plugin

The Gradle test plugin provides a mechanism for running in-container integration tests as part of an automated build process. The following shows an example of using the plugin in a build: 

 

apply plugin: 'fabric3-test'
 
buildscript {
	dependencies {
    	classpath group: 'org.fabric3.gradle', name: 'fabric3-test', version: fabric3Version
    }
}
 
fabric3Test {

    // Writes a JUnit report to build/reports/integration-tests. Default is false (no report written)
    report true;
	
	// Enables resolution of remote snapshots
    remoteSnapshotRepositoryEnabled true;


	// Uses a shared system config located in a configuration directory under the project directory 
    systemConfigFile new File("$projectDir/configuration/systemConfig.xml")
 
	// Alternatively, systemConfig can be specified inline as a String:
	// systemConfig '<config>...</config>'


	// installs the JPA profile and EasyMock extension 
    profile group: fabric3Group, name: 'profile-jpa', version: fabric3Version
    extension group: fabric3Group, name: 'fabric3-mock', version: fabric3Version
	
	// installs a project as a contribution and a file as a contribution
    contribution project(':app-service')
    contribution new File("$projectDir/configuration/app.xml")
}

 

The following are plugin configuration properties:

  • contribution - installs a Project or File as a contribution. Can be in Gradle Project, String, dependency, or File form
  • profile - installs a Fabric3 runtime profile using Gradle String or dependency form
  • extension - installs a Fabric3 runtime extension using Gradle dependency form
  • shared - specifies a shared dependency between the build and runtime; may be in String, or Gradle dependency form.
  • sharedProjects - specifies a shared dependency between the build and runtime in String form
  • systemConfig - specifies the systemConfig to boot the embedded runtime with as a String
  • systemConfigFile - takes a file pointing to the system configuration to boot the embedded runtime with
  • report - if true, writes reports to build/reports/integration-tests; false by default.
  • remoteSnapshotRepositoryEnabled - if true, enables remote resolution of snapshot dependencies; true by default
  • remoteRepositoryEnabled - if true, enables remote resolution of dependencies; true by default
  • updatePolicy - sets the dependency update policy. Valid values are: "never", "always", "daily". 
  • snapshotUpdatePolicy - sets the snapshot dependency update policy. Valid values are: "never", "always", "daily". 

Â