Testing with Maven
Starting with v9.2, you can use the Maven plug-in to run Functional Test scripts. Apache Maven is a software build tool based on the concept of a project object model (POM). You can use the Maven plug-in that is provided to run tests as part of your Maven build.
Introduction
To automate testing with Maven, you must configure a POM file that is delivered with the product installation package and launch the test from command line using Maven command.
Before you begin
- You must have installed HCL DevOps Test UI (Test UI) and set up an environment variable that points to the installation directory.
- You must have installed Maven and set up an environment variable that points to the M2_HOME directory.
- You must have a functional test.
Downloading FT-Maven plug-in
Maven plug-in is included in the product installation. The plug-in contains a POM.XML file. The first time you execute this file, Maven will automatically download the plug-in from a local repository. You can use this file to execute your tests, or use and rename the ft_pomSample.XML file sample file that is delivered in the product package.
Configuring the sample POM file
DataStore and script name arguments are required.
Arguments ftArgs and scriptArgs are optional, they must be used only if it is required by the script.
<arguments>
<argument><!-- Specify DataStore path (Mandatory) --></argument>
<argument><!-- Specify script name to be executed (Mandatory) --></argument>
<argument><!-- Provide ftArgs if any (Optional) --></argument>
<argument><!-- Provide scriptArgs if any (Optional) --></argument>
</arguments>
<arguments>
<argument>drive:/MyName/Project1</argument>
<argument>Script1</argument>
<argument><!-- Provide ftArgs if any (Optional) --></argument>
<argument><!-- Provide scriptArgs if any (Optional) --></argument>
</arguments>
Running the tests
- Maven automatically identifies the POM file. So if the .xml file name is POM.XML, then execute the tests with the mvn test command, otherwise use the appropriate command as shown in the following table:
-
Table 1. Command line to run the tests: Command Description mvn test If file name is POM.xml and you are in same directory. mvn test -f filename.xml If file name is other than POM.xml and you are in the same directory mvn test -f FULL_PATH\fileName.xml If you are in a different directory and POM.xml or use a .xml file with other name in a different directory, provide the full path.
- File name you have provided.
- Required parameters missing.
- Any wrong argument.
- Any exception occurred while executing scripts.
FT-Maven plug-in will just indicate whether the test was executed successfully or not. Reports and logs are not showing up once the test execution is completed. To see the reports, you need to check the log folder in Test UI log folder. The log will show in the explorer mode if it is disabled in FT-maven plug-in.
Use cases
<arguments>
<argument>drive:/MyName/Project1</argument>
<argument>Script1</argument>
</arguments>
<arguments>
<argument>drive:/MyName/Project1</argument>
<argument>Script1</argument>
<argument>scriptArgs1 scriptArgs2 scriptArgsN</argument>
</arguments>
<arguments>
<argument>drive:/MyName/Project1</argument>
<argument>Script1</argument>
<argument>-rt.log_format html -log testLogFolder -iterationCount 10</argument>
</arguments>
<arguments>
<argument>drive:/MyName/Project1</argument>
<argument>Script1</argument>
<argument>-rt.log_format html -log testLogFolder -iterationCount 10</argument>
<argument> scriptArgs1 scriptArgs2 scriptArgsN</argument>
</arguments>