Maven Integration
If you use Maven in your development environment, you can include ReadyAPI tests in your builds. To do that, command Maven to download and use the ReadyAPI Maven plugin in your project.
Requirements
To run ReadyAPI tests from Maven, ensure you have the following:
Plugin dependency: Include the
ready-api-maven-plugin
in yourpom.xml
file. Configure the file to retrieve the plugin from the Maven repository. This setup integrates ReadyAPI tests into the build lifecycle’s test phase.See ReadyAPI Test Testing with Maven - Example for a sample Maven configuration. If you already have a configuration, copy only the required sections into it.
ReadyAPI project file: Use a ReadyAPI project file to run your tests. You can find examples on the Sample Projects page.
License: For example, you need a ReadyAPI Test Pro license to run functional tests. If ReadyAPI cannot find a license when you run it from Maven, it asks you to activate it.
Tip
You can use a trial license to try the integration out. To learn how to get it, see Activate and Use ReadyAPI.
Maven downloads the required files and handles any dependencies.
Configure the execution environment
The Java version used by Maven must be the same as the one used in ReadyAPI (JDK 17.0.15 for ReadyAPI 3.61.0).
Maven uses a Java Virtual Machine (JVM) to run ReadyAPI tests. This JVM uses properties that differ from those specified in the ReadyAPI vmoptions file.
To specify JVM properties in Maven:
Create a
.mvn
directory in your Maven project directory.In the
.mvn
directory, create thejvm.config
file with the following content:-Xms128m -Xmx8000m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 --illegal-access=permit
Next time, when you run a Maven build, Maven will use the specified options to create the virtual machine.
Tip
If your system has more RAM available, you can increase the
-Xmx
value to improve performance. For guidance, see the ReadyAPI installation system requirements.
Run tests
To start a test, execute the Maven test
command in the folder containing your pom.xml
file. This command will run the test and generate reports for it. For example:
C:/Work/MvnSample> mvn test
See an example to learn more about using the pom.xml
file for running ReadyAPI tests. To add more test properties, uncomment the corresponding elements (if they exist) or specify additional parameters.
To learn more about known issues and how to work around them, see Troubleshooting.
Reports
The Maven plugin supports two types of reports for ReadyAPI tests:
ReadyAPI JUnit reports.
The Surefire Report plugin converts the JUnit XML reports created by ReadyAPI to Surefire HTML reports. Learn more about this plugin in the Apache documentation and see a sample test that creates such a report.
Custom ReadyAPI reports: Require additional configuration, see below.
Fonts in Linux
ReadyAPI reports use some of Microsoft's core fonts. Not all Linux installations include these fonts. If you have issues with creating reports:
Install the mscorefonts package applicable for your Linux distributive.
Copy TTF files from /usr/share/fonts/truetype/msttcorefonts to the <ReadyAPI Installation>/jre/lib/fonts directory.
Make sure to specify the <ReadyAPI Installation>/bin/reports directory in the Custom Reports Library field of the ReadyAPI tab in the Preferences window.
Custom ReadyAPI reports require assets and templates that are not present by default on test machines without ReadyAPI installed.
To work around this issue, retrieve the necessary data from any machine where ReadyAPI is installed:
Copy the
<ReadyAPI installation>/bin/reports
folder to some location on your test machine.In ReadyAPI, go to Preferences > ReadyAPI.
Set the path to the
reports
folder as the value of the Custom reports library option.Close ReadyAPI.
Copy the
<user home directory>/.readyapi/readyapi‑settings.xml
file to some location on your test machine.(Optional) Restore the original value of the Custom reports library option on the Preferences > ReadyAPI tab.
On your test machine, add the following line to the configuration
section of the pom.xml
file:
<settingsFile>[Path]/readyapi‑settings.xml</settingsFile>
If needed, see a sample Maven pom.xml
file here.
Maven configuration for SmartBear ID-Based Licensing
You may provide your credentials by either enclosing them within the
<slmAccessKey>Access_Key</slmAccessKey>
tag, or by using the<slmUsername>Username</slmUsername>
and<slmPassword>Password</slmPassword>
tags.You may provide your credentials for clientID and clientSecret by adding them as arguments in the configuration of the
pom.xml
file. They will retrieve the token from SLM and use it to fetch, lock, and release the license. The expected arguments to be configured are:<clientId>clientId</clientId>
<clientSecret>clientSecret</clientSecret>
The server address and access settings for all users can be defined in the
readyApiProperties
. To enable access for everyone, set it totrue
.<readyApiProperties> ... <property> <name>licenseApiAccessForEveryone</name> <value>true</value> </property> <property> <name>licenseApiHost</name> <value>SLM_License_Server_Address</value> </property> <property> <name>licenseApiPort</name> <value>SLM_License_Server_Port</value> </property> </readyApiProperties>
The SmartBear license server is included by default and does not require additional configuration. However, if you have installed and configured an offline (on-premises) license server for your ID-based licenses, you need to specify the server address and port information.