Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

PluginTestPlugin

Michael Barth edited this page Jun 28, 2017 · 4 revisions

Compatibility

At this moment, the plugin works only for Gradle 3.4. We will work on making it compatible with higher Gradle versions too.

Purpose

This plugin is the completion of the TestDefinitionPlugin and acts on the test project level. It uses the prepared target platform from the TestDefinitionPlugin and expands it with the test bundle, the bundle ot test and all dependencis of them.

Declaration

Using this plugin needs the following plugin declarations:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "de.monkeyworks.buildmonkey:gradle.pde:0.4.18"
  }
}

apply plugin: 'de.monkeyworks.buildmonkey.pde.PluginTestPlugin'

or in the incubating script snippet notation:

plugins {
  id "de.monkeyworks.buildmonkey.pde.PluginTestPlugin" version "0.4.18"
}

Configuration

The configuration must be done on test project level. The test code must be stored in src/main/java instead of src/test/java or in a similar defined source set. The following example shows the common usage, if the name of all bundles test projects (and only of them) end with .test and the bundle to test has the same name without this suffix.

subprojects {
  if (project.name.endsWith('.test')) {

      def hostName = project.name.minus(~/\.test$/)

      apply plugin: 'de.monkeyworks.buildmonkey.pde.PluginTestPlugin'

      pluginTest {
          fragmentHost hostName
          applicationName 'org.eclipse.pde.junit.runtime.coretestapplication'
          optionsFile rootProject.project(":${hostName}").file('.options')
          consoleLog true
          debug false
          debugPort 8998
          testTimeoutSeconds 3600
          projectPattern = ['hmi(\\..*)', 'mw(\\..*)']
      }
  }
}
  • fragmentHost - Name of the bundle to test. This bundle must also be referenced from the MANIFEST.MF as Fragment-Host to run the test from Eclipse if wanted.
  • applicationName - Application to start. coretestapplication starts an eclipse without GUI.
  • optionsFile - File with the line ${fragmentHost}/debug = true, if remote debuggin from an IDE should be enabled.
  • consoleLog - Turns on the log output to console if true.
  • debug - Turns on remote debugging if true.
  • debugPort - Port for the remote debug session.
  • testTimeoutSeconds - Seconds to wait for the test execution. If the tests need more time, they will be interruptes, if less the task will ends up earlier.
  • projectPattern - Name pattern for build artefacts in the projects references by test bundle and host.

Gradle tasks

There is only one task to call for executing all bundle tests.

pluginTest

This task executes the plugin tests.

gradle pluginTest