Using Ant and LISA 5.0

Document ID : KB000048423
Last Modified Date : 14/02/2018
Show Technical Document Details

If you choose to use LISA 5.0 in your Ant build script, we have supplied a sample in the following directory.

LISA_HOME/examples/build.xml

Custom LISA Ant task documentation

junitlisa is a 'drop in' replacement for JUnit, but designed to execute LISA tests instead of JUnit tests. Most continuous build systems recognize the XML output files and will integrate the build dashboard with the test results. You can also produce HTML reports with the junitlisareport task (or the regular junitreport task if you want).

junitlisa is an Ant task that directly subclasses the regular JUnit task, so any of the attributes and nested elements that JUnit has, junitlisa also has. See http://ant.apache.org/manual/OptionalTasks/junit.html

There are several differences though:

  • You cannot set the 'fork' attribute to 'false' (we *always* fork).
  • You can't add nested <test> elements; use a test="testcase.tst" attribute instead.
  • You can't add nested <batchtest> elements; use a suite="suiteFile.ste" attribute instead.
  • We add an implied classpath consisting of LISA_HOME/bin/.jar, LISA_HOME/lib/.jar,*.zip. and LISA_HOME/lib/endorsed/*.jar.
  • We add an implied java.endorsed.dirs system property pointing to LISA_HOME/lib/endorsed.
  • We add a default formatter of type "xml".
  • We default the 'showoutput' attribute to 'true'.
  • We default the 'printsummary' attribute to 'true'.
  • We default the 'maxmemory' attribute to '512m'.

junitlisa supports the following attributes in addition to the attributes inherited from JUnit:

  • suite="suitename.ste" - a LISA suite. This is the most common use case.
  • test="filename.tst" - a single LISA test to run.
  • config="configname" which is either a named internal configuration set or a filename (.config or .properties file).
  • outfile="filename" specify the filename that junitlisa uses to write reporting data. NOTE: if "filename" doesn't comply with standard naming scheme for <junitlisareport> you will need to specify a fully configured <junitreport> task instead.
  • testRegistry="registryName" e.g "rmi://testbox/lisa.Registry" - a pointer to the registry you want to use if you want to stage the tests remotely. If you don't specify this or the registry name is 'local', the tests will be staged locally

All the attribute values can use curlybraces and LISA will resolve them in the usual fashion.

You can specify either suite or test but not both.

You *must* specify either a 'test' or 'suite' attribute. 'config' and 'testRegistry' attributes are optional.

You will almost always want to specify the inherited 'toDir' attribute, although it will default to the current working directory.

When you run a single test with the 'test' attribute, it is staged with a single vuser, run once and has 100% think time. If you need to change this, wrap the test in a suite and specify an alternative staging doc.

junitlisareport is a subclass of the regular junitreport element except that we specify sensible defaults. It is exactly equivalent to the following:
Figure 1

You can specify your own fileset and report if you want though... and because it's a direct subclass of junitreport, we also support all the attributes and nested elements that junitreport does.

You will almost always want to specify the 'toDir' attribute of the junitlisareport element; however it will default to the current working directory.