Ready! API TestServer Maven Plugin

Maven plugin for executing test recipes against Ready!API TestServer

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.smartbear.readyapi
ArtifactId

ArtifactId

testserver-maven-plugin
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Ready! API TestServer Maven Plugin
Maven plugin for executing test recipes against Ready!API TestServer
Project URL

Project URL

https://github.com/olensmar/readyapi-testserver-maven-plugin
Source Code Management

Source Code Management

https://github.com/olensmar/readyapi-testserver-maven-plugin

Download testserver-maven-plugin

How to add to project

<plugin>
    <groupId>com.smartbear.readyapi</groupId>
    <artifactId>testserver-maven-plugin</artifactId>
    <version>1.0.0</version>
</plugin>

Dependencies

compile (9)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 2.0
org.apache.httpcomponents : httpcore jar 4.4.4
com.smartbear.readyapi : ready-api-testserver-client jar 1.0.0
org.apache.httpcomponents : httpclient jar 4.5.1
com.google.guava : guava jar 18.0
org.apache.maven.shared : maven-filtering jar 3.0.0
org.apache.maven.shared : file-management jar 3.0.0
org.apache.xmlbeans : xmlbeans jar 2.4.0
org.apache.xmlbeans : xmlbeans-xmlpublic jar 2.4.0

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

test (1)

Group / Artifact Type Version
junit : junit jar 3.8.1

Project Modules

There are no modules declared in this project.

ReadyAPI TestEngine Maven Plugin

A maven plugin that runs a set of SoapUI/ReadyAPI projects with ReadyAPI TestEngine - configure it to run in whatever build phase you might find relevant, for example;

<plugin>
    <groupId>com.smartbear.readyapi</groupId>
    <artifactId>testengine-maven-plugin</artifactId>
    <version>1.0.1</version>
    <configuration>
        <username>defaultUser</username>
        <password>defaultPassword</password>
        <server>...ReadyAPI TestEngine endpoint...</server>
    </configuration>
    <executions>
        <execution>
            <id>run</id>
            <phase>integration-test</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The only goal exposed by the plugin is "run" - you can invoke it as above or directly from the command-line, for example

mvn testengine:run 

The plugin will look for files with either json or xml extensions.

Configuration

Configuration parameters are:

  • username (required) : the TestEngine username to use for authentication
  • password (required) : the TestEngine password to use for authentication
  • server (required) : endpoint of the TestEngine (no trailing slash!)
  • projectsDirectory : the folder to scan recursively for projects and recipes, defaults to ${project.basedir}/src/test/resources/test-projects
  • targetDirectory : the folder to which filtered recipes will be copied before executing, defaults to ${project.basedir}/target/test-recipes
  • properties : an optional set of additional properties that will be used during filtering (see below)
  • disableFiltering : disables filtering of recipes - if set to true the recipes will not be copied and filtered to the target directory, instead they will run directly from the source directory.
  • reportTarget : the folder to which a junit-report.xml file will be generated (as can be processed by the surefire plugin), defaults to ${basedir}/target/surefire-reports
  • environment : if you're submitting existing SoapUI/Ready!API project files this allows you to select which environment to target
  • async : toggle if tests should be executed asynchronously - default is false which will wait for tests to finish to be able to create test-reports. Setting this to true will disable reporting functionality, but allow you to specify an optional callback that will be called by the TestEngine with test results when they are finished.
  • callback : an optional url to call with finished test results if async is set to true
  • hostAndPort: an optional string in the format host:port which will replace the host and port in all HTTP requests sent by the test.

Specifying a skipApiTests system property will bypass this plugin altogether.

The plugin will also look for standard properties file named testengine.properties in the projectsDirectory folder and load any properties in this file before applying the properties specified in the configuration.

Filtering

Json recipes will be filtered and copied to the folder specified by targetDirectory before getting executed. Any available property will be replaced, which makes it easy to parameterize your tests.

For example the following simple recipe:

{
    "testSteps": [
        {
            "type": "REST Request",
            "method": "GET",
            "URI": "${apitest.host}/apis",
            "assertions": [
                {
                    "type": "Valid HTTP Status Codes",
                    "validStatusCodes": [200]
                }
            ]
        }
    ]
}

would use a property defined as

...
<apitest.host>...</apitest.host>
...

when assembling the URI. You can simply look in the targetDirectory folder after your tests were run to see what was actually executed.

Error reporting

Currently the plugin simple fails the build if any tests fail and dumps the ReadyAPI TestEngine response to the console. A surefire xml file is generated for inclusion in generated reports.

Building the plugin

Simply pull this repo and run

mvn clean install

to install the latest version of the plugin locally. It will eventually be made available on maven central also.

Next steps?

Obviously huge list of things to improve:

  • support datadriven tests
  • improved surefire reports
  • etc..

Versions

Version
1.0.0