net.sf.jameleon
Class ExecuteTestCase

java.lang.Object
  extended by net.sf.jameleon.ExecuteTestCase

public class ExecuteTestCase
extends Object

Executes a Jameleon Test Case.


Field Summary
protected  Map contextVars
          A set of key-value variables to be set in the context
protected static String DASH
          A line of dashes
protected  boolean debug
          Print out stack trace of each failed Jameleon Test Case to stdout.
protected  List files
          A list of files to execute
protected  org.apache.log4j.Logger log
           
protected  boolean printFooter
          Print the name of the script being executed to stdout
protected static TestCaseTagLibrary tagLibrary
           
static String TEST_CASE_LISTENERS
          The jameleon.conf configuration name for a list of desired TestCaseListeners to be registered.
protected  List testCaseListeners
          A list of files to execute
protected static String US
          A line of underscores
protected  long waitTimeBetweenScripts
          The # of milliseconds to wait between each script execution
 
Constructor Summary
ExecuteTestCase()
           
ExecuteTestCase(boolean debug)
           
 
Method Summary
 void addFile(File f)
          Adds a file or directory to the list of files to be executed by this instance.
 void beginTestRun()
          Begins the test run.
static void closeAllLogs()
          This is a workaround to the fact the shutdown is not called in log4j.
protected  void delay()
           
 void deregisterEventListeners()
          Remove all TestCaseListeners registered via the registerEventListeners method.
 void endTestRun()
          Ends the test run.
 String execute(File f)
          Runs through all files in the given file or directory and executes each file as a Jameleon test script.
 String executeFiles()
           
 String executeJellyScript(File file)
          Executes the given file as a Jameleon test script and returns the error message if the test failed.
 Map getContextVars()
           
 List getFiles()
           
 ResultsReporter getResultsReporter()
           
 long getWaitTimeBetweenScripts()
           
static void main(String[] args)
           
 void registerEventListener(TestCaseListener tcListener)
          Register a new TestCaseListener in the TestCaseEventHandler.
 void registerEventListeners()
          Read in desired TestCaseListeners defined in jameleon.conf and register them in the TestCaseEventHandler.
 void registerEventListeners(boolean useCurrentThread)
          Read in desired TestCaseListeners defined in jameleon.conf and register them in the TestCaseEventHandler.
 JellyContext runScript(File file)
           
protected  void setContextVariables(JellyContext context)
           
 void setPrintFooter(boolean printFooter)
           
 void setWaitTimeBetweenScripts(long waitTimeBetweenScripts)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

files

protected final List files
A list of files to execute


testCaseListeners

protected final List testCaseListeners
A list of files to execute


contextVars

protected Map contextVars
A set of key-value variables to be set in the context


debug

protected boolean debug
Print out stack trace of each failed Jameleon Test Case to stdout.


printFooter

protected boolean printFooter
Print the name of the script being executed to stdout


waitTimeBetweenScripts

protected long waitTimeBetweenScripts
The # of milliseconds to wait between each script execution


DASH

protected static final String DASH
A line of dashes

See Also:
Constant Field Values

US

protected static final String US
A line of underscores

See Also:
Constant Field Values

log

protected final org.apache.log4j.Logger log

tagLibrary

protected static final TestCaseTagLibrary tagLibrary

TEST_CASE_LISTENERS

public static final String TEST_CASE_LISTENERS
The jameleon.conf configuration name for a list of desired TestCaseListeners to be registered.

See Also:
Constant Field Values
Constructor Detail

ExecuteTestCase

public ExecuteTestCase()

ExecuteTestCase

public ExecuteTestCase(boolean debug)
Method Detail

registerEventListeners

public void registerEventListeners()
Read in desired TestCaseListeners defined in jameleon.conf and register them in the TestCaseEventHandler.


getResultsReporter

public ResultsReporter getResultsReporter()

registerEventListeners

public void registerEventListeners(boolean useCurrentThread)
Read in desired TestCaseListeners defined in jameleon.conf and register them in the TestCaseEventHandler.

Parameters:
useCurrentThread - if set to true, then use the current thread's classloader

registerEventListener

public void registerEventListener(TestCaseListener tcListener)
Register a new TestCaseListener in the TestCaseEventHandler.

Parameters:
tcListener - The TestCaseListener to register

deregisterEventListeners

public void deregisterEventListeners()
Remove all TestCaseListeners registered via the registerEventListeners method.


setPrintFooter

public void setPrintFooter(boolean printFooter)

setWaitTimeBetweenScripts

public void setWaitTimeBetweenScripts(long waitTimeBetweenScripts)

getWaitTimeBetweenScripts

public long getWaitTimeBetweenScripts()

beginTestRun

public void beginTestRun()
Begins the test run. This creates a new html reporter which in turn ends up generating another results file.


endTestRun

public void endTestRun()
Ends the test run.


main

public static void main(String[] args)

closeAllLogs

public static void closeAllLogs()
This is a workaround to the fact the shutdown is not called in log4j.


execute

public String execute(File f)
Runs through all files in the given file or directory and executes each file as a Jameleon test script.

Parameters:
f - The file to execute
Returns:
the error message if one exists

executeFiles

public String executeFiles()

executeJellyScript

public String executeJellyScript(File file)
Executes the given file as a Jameleon test script and returns the error message if the test failed. Only a single file should be passed to this method.

Parameters:
file - - the file to execute.
Returns:
a String representing the error(s), if any, that occured

runScript

public JellyContext runScript(File file)
                       throws JellyException,
                              FileNotFoundException
Throws:
JellyException
FileNotFoundException

setContextVariables

protected void setContextVariables(JellyContext context)

addFile

public void addFile(File f)
Adds a file or directory to the list of files to be executed by this instance.

Parameters:
f - The file to add

getFiles

public List getFiles()
Returns:
a List of files and/or directories to be executed by this instance.

getContextVars

public Map getContextVars()

delay

protected void delay()


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.