Maven Latka Plug-in dIon Gillard

The following sections are available in the Latka plugin documentation

  1. An overview of how this plugin works
  2. How to get more from Latka
  3. How to generate Latka test suites
  4. What's in store for the Latka plugin

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

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.

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.

]]>

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:

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

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.