org.apache.commons.latka
Class Latka

java.lang.Object
  extended by org.apache.commons.latka.Latka

public class Latka
extends Object

This is the primary class for executing Latka functional tests. The main(String aargs[]) class provides a convenient command-line interface for executing single tests. See the Latka documentation for details on command-line usage. There is also a webapp-based Latka interface.

Version:
$Revision: 155424 $
Author:
Morgan Delagrange, dIon Gillard
See Also:
Suite, LatkaProperties

Field Summary
protected  boolean _isValidating
          whether xml parsing is validating or not
protected static org.apache.log4j.Category _log
          log4j category for logged output
protected  Properties _props
          Latka configuration variables
protected  URL _reportStylesheetUrl
          XSL stylesheet url to use when generating XML
 
Constructor Summary
Latka()
           
 
Method Summary
protected  org.apache.commons.jelly.JellyContext buildJellyContext()
           
protected  void logXML(String xml)
          Use this method to log XML generated by the XMLReporter class.
static void main(String[] args)
          Execute a single test suite via the command line interface.
protected  void runCommandLine(String[] args)
          Processes the command line arguments, executes a single test.
 void runTests(Suite suite, LatkaEventListener listener)
          Execute a single Latka test suite.
 void setReportStylesheet(URL url)
          Set the URL to be used when transforming XML generated by the XMLReporter
 void setValidating(boolean isValidating)
          Set whether or not Latka will validate the XML in each test.
 String transformXML(String xml)
          Transform the XML generated by the XMLReporter using the default stylesheet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_isValidating

protected boolean _isValidating
whether xml parsing is validating or not


_reportStylesheetUrl

protected URL _reportStylesheetUrl
XSL stylesheet url to use when generating XML


_log

protected static final org.apache.log4j.Category _log
log4j category for logged output


_props

protected Properties _props
Latka configuration variables

Constructor Detail

Latka

public Latka()
Method Detail

runTests

public void runTests(Suite suite,
                     LatkaEventListener listener)
              throws LatkaException
Execute a single Latka test suite. The Latka event listner will receive all the events generated during the test. The Latka packages contain an implmentation of LatkaEventInfo which can generate an XML report according to a standard DTD (see documentation).

Parameters:
suite - test suite to execute
listener - target for test events
Throws:
LatkaException - when any internal error occurs
See Also:
XML-based implementation of LatkaEventListener

buildJellyContext

protected org.apache.commons.jelly.JellyContext buildJellyContext()

setValidating

public void setValidating(boolean isValidating)
Set whether or not Latka will validate the XML in each test.

Parameters:
isValidating - whether or not to validate XML

setReportStylesheet

public void setReportStylesheet(URL url)
Set the URL to be used when transforming XML generated by the XMLReporter

Parameters:
url - a valid URL referencing a stylesheet

logXML

protected void logXML(String xml)
               throws IOException
Use this method to log XML generated by the XMLReporter class.

Parameters:
xml - XML to be logged
Throws:
IOException - if the XML could not be written to the filesystem

transformXML

public String transformXML(String xml)
                    throws LatkaException
Transform the XML generated by the XMLReporter using the default stylesheet.

Parameters:
xml - XML generated by XMLReporter
Returns:
transformed report
Throws:
LatkaException - if the XML could not be transformed

runCommandLine

protected void runCommandLine(String[] args)
                       throws LatkaException
Processes the command line arguments, executes a single test. and processes the resulting report. Command line usage is described in the LATKA_USAGE constant.

Parameters:
args - arguments passed into the main(String[]) method
Throws:
LatkaException - if any problems are encountered during the execution of the tests

main

public static void main(String[] args)
Execute a single test suite via the command line interface. See the Latka documentation for detailed usage instructions. The Java process will return a 0 if all tests succeed and a 1 if any fail or there is an unrecoverable error in the test execution.

Parameters:
args - arguments containing the test suite location and any properties or property file references


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.