Mailing list - Entries of 2005


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qftestJUI] How to use Maven to run multiple JUITests


  • Subject: [qftestJUI] How to use Maven to run multiple JUITests
  • From: "Chandler, Trevor" <Trevor_Chandler@?.com>
  • Date: Tue, 20 Sep 2005 10:30:29 -0700

Gregor,

 

I wrote up this information regarding Maven and JUITest, I think it may be useful to people as Maven is being used heavily for software development these days, and will likely continue to be grow.

 

After all, I ask so many questions, I am eager to contribute.

 

Hope it helps,

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

How to use Maven to run multiple JUITests

 

     Maven is a tool from Apache, (The makers of ANT). Maven is thought of by many people to be the next generation tool providing solutions that ANT had been used for in the past. Maven can use ANT tasks as well as its own scripting language ‘Jelly Script’.  

 

Maven uses groups of actions called ‘goals’. Here is a goal that can be used to run multiple JUITests. This goal also moves reports nested in a group of folders, and moves them to a central results folder.

 

<project xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:ant= "jelly:ant">

 

      <goal name="jui-test">

      <u:tokenize var="listOfProperties" delim=",">${JUI.TEST.LIST}</u:tokenize>

            <j:forEach var="JUI.TEST.NAME" items="${listOfProperties}">

            <ant:exec executable="${JUITEST.EXE}" os="Windows XP">

            <arg line="-batch ${TEST.OPTIONS} ${JUI.TEST.DIR}/${JUI.TEST.NAME}"/>

            </ant:exec>

      </j:forEach>

 

      <ant:move flatten="true" todir="results">

            <fileset dir="${JUI.TEST.DIR}" includes="**/*.html" />

      </ant:move>

 

      </goal>

 

</project>

 

 

As you can see above, the goal is using properties.  These properties come from a project.properties file. This file’s properties are automatically loaded by maven, as maven looks for a file of this name in its current directory when it starts.

 

Here are the properties from project.properties

 

######################################################################

#

# PROJECT.PROPERTIES

#

######################################################################

######################################################################

# JUITEST PROPERTIES

######################################################################

JUITEST.EXE=C:/Program Files/qfs/qftest/qftestJUI-1.08.2/bin/qftestJUI.exe

TEST.OPTIONS=-report.html -report.depth 10

JUI.TEST.DIR=C:/juitests

JUI.TEST.LIST=theseTests/test1.qft,thoseTests/test2.qft

 

 

Here is a definition of each property:

 

JUITEST.EXE – This defines where the qftest executable is

TEST.OPTIONS – These are the command line options to be used by the qftest executable

JUI.TEST.DIR – This is the top level folder of where your tests are contained.

JUI.TEST.LIST – this is the comma separated list of the tests you wish to run. The maven goal will put the JUI.TEST.DIR before each entry so there is no need to define the full path in the JUI.TEST.LIST for each entry.

 

In the attached zip file you will find the files and folders discussed in this example.

Attachment: juitests.zip
Description: Binary data


Videos Downloads Documentation Buy Free Trial