What is LatkaLatka is a functional (end-to-end) testing tool. It is implemented in Java, and uses an XML syntax to define a series of HTTP (or HTTPS) requests and a set of validations used to verify that the request was processed correctly. Note: Although Latka currently supports only HTTP and HTTPS request/response validations, it may be expanded to perform other sorts of functional testing as warranted. A simple example of a Latka XML test suite is shown in our sample Latka test suite. When processed, this example would verify that the Jakarta Commons homepage is present and that all the Commons Components have online documenation. Running LatkaA Latka test suite can be run:
Note:To run Latka as an ant task, we suggest you use the JUnit support of ant and write a small test case to invoke Latka, as discussed later Running Latka from the command promptThere are two scripts (or batch files) shipped with latka:
Both of the scripts take the following parameters:
For more information about what properties you can pass to Latka, please see the Latka Properties definition Running Latka from a web application (Under Construction)The Latka release distribution comes with a web application (latka-webapp.war) ready to deploy on a conforming Servlet 2.2/ JSP 1.1 container. For example, to install the Latka web application into a Tomcat 4 server, simply copy the .war file to Tomcat's webapp directory, e.g. [Win32] copy latka-webapp.war c:\tomcat4\webapps or [Unix] cp latka-webapp.war /usr/java/jtomcat4/webapps and restart Tomcat Once you've gotten the Latka web app running, it's straightforward to use. You can either
Running Latka as a JUnit Test CaseHere's hoping you're familiar with JUnit Latka ships with a class JUnitTestAdapter that bridges Latka and JUnit. You can use this class to create JUnit Tests from Latka's XML documents. For example, calling JUnitTestAdapter.createTestFromFile(fileName) So, essentially you code a JUnit TestCase, and in the suite method, you add the Tests created by JUnitTestAdapter to the JUnit TestSuite. public static Test suite() { TestSuite suite = new TestSuite(); String fileName = "tests/samples/TestCommonsWebsite.xml"; suite.addTest(JUnitTestAdapter.createTestFromFile(fileName)); return suite; } Once you have Latka's suite as a JUnit TestSuite, you can run it using any JUnit TestRunner to execute the suite, including those shipped with ant. Anatomy of a test suite (Under Construction)For a reference of the XML tags that can possibly be used in developing latka test suites, see The XML Reference A Latka test suite is an XML document with a top level element of suite Latka Properties (Under Construction)Definitive list of properties and their meanings... |