Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Overview

This plugin runs Latka web testing scripts.

To use the plugin, you simply need to create some Latka test scripts and place them in the src/test/latka directory.

To execute the scripts, simply run

maven latka

By default this will simply print the results of running your Latka test suite to the console, and if the suite(s) failed, the build is stopped with an appropriate exception

Customizing Latka

Latka can be customised in many ways when running within the plugin. The Latka docs should be read thoroughly first as they should contain far more detail on the ways Latka can be tweaked.

XML Report

Latka has the concept of listeners, classes whose job it is to listen for, and report on the progress of a Latka suite.

Latka looks for a listener at the start of the suite tag as a Jelly variable named latkaEventListener. If one is not found, Latka notes this internally and creates an XMLReporter as the default listener.

You can provide your own listener to Latka simply by using jelly's new tag before the suite tag, e.g.

<j:new var="latkaEventListener" className="org.apache.commons.latka.XMLReporter" />

Once the suite is complete, you can then access the XML report using all the usual jelly xml tags. For example, to simply print out the resulting report in XML format use the following:

${latkaEventListener.documentAsString}

Once you have the report, you can then do anything else you may like such as

  • Writing the report to a file using j:file
  • Perform JSL transformations on the report to generate documentation
  • Extract pieces of the report using Jelly's XML tags

Generating Suites

The plugin has a goal (latka:jmeter-convert) that takes a set of requests as recorded by JMeter's Http Proxy and converts them into a Latka suite.

This has only been tested with JMeter 1.8.x

You can easily set up a browser with the correct proxy settings, and simply by using your web application, you can create tests that this plugin can later replay.

The JMeter documentation contains a section on setting up the HTTP Proxy feature. This allows you to set 'listen' to requests being sent to the application and save the request details in XML format. JMeter can be set up to filter out requests by specifying a regular expression to match the incoming requests. This lets you only record relevant requests for your tests, e.g. HTML or JSP files, Struts actions with a .do extension etc.

The jmeter-convert goal looks for a property passed to Maven, jmeterFile. If this file exists, the plugin blindly assumes it's a JMeter file and generates a corresponding Latka suite, containing all the requests in the JMeter file with the appropriate web server, port, request path and parameters.

The file that is generated, ${maven.build.dir}/latka/jmeter-suite.latka, can then be editied and placed in the Latka source directory.

To convert a file, say C:\JMeter\test.jmx, into a Latka suite, invoke Maven like this:

maven -DjmeterFile=C:\JMeter\test.jmx latka:jmeter-convert

This will produce a file, target\latka\jmeter-suite.latka ready for editing or execution.

Futures

  • The Latka Jelly tags are only new, and we're sure we'll find more bugs in them as time goes by, so first on the agenda is those pesky bugs and making Latka rock solid within Maven.
  • Secondly a way to generate xdoc reports from the Latka XML Reporter, so that the Latka results can be incorporated into the site reports
  • Exposing more detail about requests and responses to Jelly so people can get at them easily
  • Your suggestions are always welcome!