Skip to end of metadata
Go to start of metadata

This document describes Q7 Maven Plugin of version 1.3.x. If you are using older version, please refer to Q7 Maven Plugin 1.2.x.

Contents

General info

Q7 Maven plugin works with Maven 3 and provides an ability to launch Q7 automated tests during maven build. 

For ease of use and ability of further customization, Q7 tests projects use custom packaging type q7test, since it is a natural way to associate a particular lifecycle with a project. The table below describes all phases used by Q7 Maven plugin and actions performed on these phases.

Phase

Goal

Description

generate-resources

com.xored.q7:q7-maven-plugin:resources

  1. Copies project to target/projects/artifactId
  2. Resolves all dependencies of type q7test and unpacks them to target/projects/
  3. Unpacks AUT to target/aut
  4. Unpacks Q7 runner to target/q7/
  5. Creates target/results/ directory

compile

com.xored.q7:q7-maven-plugin:execute

  1. Launches Q7 runner.
    • Q7 workspace is set to $target/projects/
    • AUT workspace prefix is $target/autWorkspace
  2. Converts q7 report to surefire report and puts it to target/surefire-reports/

package

com.xored.q7:q7-maven-plugin:package

Packages Q7 project and execution results as artifacts (see below)

install

maven-install-plugin:install

default

deploy

maven-deploy-plugin:deploy

default

Configuration

Basic plugin configuration

Below is a basic POM template which can be used as starting point of automating Q7 tests with Q7 Maven plugin. Put it into your Q7 project and configure as described below

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company.product</groupId> 
  <artifactId>productTests</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>q7test</packaging>
 
  <pluginRepositories>
    <pluginRepository>
      <id>q7-releases</id>
      <name>Xored Q7 Maven repository</name>
      <url>http://maven.xored.com/nexus/content/repositories/q7-releases/</url>
    </pluginRepository>
  </pluginRepositories> 
  <properties>
    <q7-maven-version>1.3.3</q7-maven-version>
  </properties> 
 
  <build>
    <plugins>
      <plugin>
        <groupId>com.xored.q7</groupId>
        <artifactId>q7-maven-plugin</artifactId>
        <version>${q7-maven-version}</version>
        <extensions>true</extensions>
        <configuration>
          <!-- The main configuration section goes here --> 
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

 

Important things to note here:

  • Packaging type is set to q7test
  • Xored Maven repository added to pluginsRepositories
  • extensions

The configuration element can have following main child elements described below: aut, q7, testOptions and skipTags.

Q7 Version and credentials

Use q7/version to specify version of Q7 to use. To authenticate Q7 Runner requires credentials which are either a pair of clientId/clientSecret for OnDemand users, or licenseUrl for Enterprise users.

Q7 Runner VM Arguments

Use q7/vmArgs to specify extra arguments for Q7 Runner. For instance, to configure proxy settings, the following lines can be added:

 

AUT specification

Q7 Maven Plugin supports two sources of applications-under-tests – it can either use Maven artifact resolution to download AUT from Maven repository, or get it explicitly from file system or http server. The configuration of AUT is specified in plugin configuration section under aut element. If we use Maven artifact resolution, then we assume that AUT is compiled using tycho, therefore we can automatically define classifier (which consists of OS, Window System and architecture, for example win32.win32.x86 or macosx.cocoa.x86_64) for current machine and hence AUT can be defined like this

In this case our plugin determines the classifier of the current platform (and we assume that classifier is constructed from os.ws.arch), assumes that packaging type is zip, and resolves the artifact using Aether, by taking the latest version. However, version, classifier and extension can be explicitly specified:


In case when application-under-test is not being deployed into Nexus, it is possible to specify application-under-test location  by setting explicit property which can contain either path to AUT location on local file system, or http url to download AUT from. If path is not absolute, then it is resolved relative to project base dir. If explicit parameter is provided, other parameters are ignored:

Explicit AUT specification supports some initial substitution –  for example tag [platform] can be used to substitute the eclipse classifier of current platform (i.e. linux.gtk.x86_64) Example:

The explicit location specification when executed on win32 will be resolved to

 

Injections

Sometimes it might be useful to make some certain features available in testing assembly, but not included into the final product. For this purpose, it is possible to specify injection parameters for AUT to specify which features from which update sites should be installed into AUT before testing. Here's the example configuration

Application args

Extra command-line arguments for application and/or for Java VM can be specified like this: 

Extra projects

In case of using linked projects or folders in Workspace context, it might be required to specify an extra projects to be imported into Q7 Runner workspace. This can be done by using <projects> element:

Test options

Options related to test execution are specified under testOptions element in plugin configuration. There are no required options here, so by default this element is just omitted.
The example below sets timeout options for the whole test suite and for a single test:

The complete list of parameters with their defaults is provided on Q7 Runner page (section Runtime Options).

Tags to skip

Sometimes it might be valuable to skip certain test cases during test execution, for example if tests depend on specific operating system or other environment. For this purpose it is possible to mark such tests in Q7 IDE with some specific tag and then specify <skipTags> option, for example:

Custom reports

Q7 supports custom user reports, see more information here – http://github.com/xored/q7.extensions.reporting. In order to use custom reporter during maven build, use <report> node with two child properties – id to identify the reporter, and name to specify a custom name like this:

Memory usage

Sometimes it might be useful to see how much memory is used by AUT after completion of each test. You can turn on outputting that information by using <memoryUsage> element:

Q7 Launcher resolution

By default, Q7 Maven plugin just resolve artifact with groupId = com.xored.q7 and artifactId = q7runner and takes the latest version it can find. However, in some rare cases it might be necessary to override this information. It is possibly by specifying q7 element under plugin configuration. The contents of this element are the same as for specifying AUT.

Test suites

By default Q7 Maven plugin launches all tests in given projects (and extra projects) besides tests having tags from tags to skip list. In order to run only test cases belonging to test suite(s), the following lines can be added (suite name must match to a name of existing test suite inside a project):

 

Produced artifacts

The package phase of Q7 lifecycle produces two artifacts:

  • The project itself as primary artifact (so it can be references by other projects)
  • Q7 execution results/logs/outputs and other information which can be helpful to identify the reason of failures. This artifact has classifier results

Below is the complete list of items included into results artifact:

  • q7 – Base directory for q7-runner files
    • report.xml – Q7 report
    • stdout.txt – Q7 process output stream contents
    • stderr.txt – Q7 process error stream contents
    • log.txt, log1.txt – Q7 workspace logs (.log and .bak_N.log files from .metadata)
  • For each AUT (specified by autCount in testOptions the separate folder aut<N>is created inside results artifact archive with the following contents:
    • log<N>[restart<M>].txt – AUT workspace logs (including logs from restarts).
    • out.txt – Combined out/err stream contents
  • launch – For each launch configuration with name Foo, the following dirs are created
    • Foo
      • launch.xml - Launch configuration arguments
      • ... - directories from org.eclipse.pde.core/Foo

Examples

Simple project

This is a trivial example which uses most of defaults provided by q7-maven-plugin.

Dependent projects

Dependencies between test projects are described in the same way as it is for other maven projects, one thing to note is that type element must be set to q7test:

Current implementation assumes that all dependencies are packed and located either in local or in some of configured remote repositories which means that when using dependencies between projects it is necessary to use at least install phase. 

Labels: