com.googlecode.lightest.core
Class TestRunner

java.lang.Object
  extended by com.googlecode.lightest.core.TestRunner
All Implemented Interfaces:
ITestRunner, groovy.lang.GroovyObject

public class TestRunner
extends Object
implements groovy.lang.GroovyObject, ITestRunner

The Lightest test runner.


Constructor Summary
TestRunner()
           
TestRunner(InputStream _in, PrintStream out)
           
TestRunner(InputStream _in, PrintStream out, groovy.util.AntBuilder ant)
           
 
Method Summary
 void configure(File configFile)
          Configures the runner by wiring together dependencies as specified by the configuration file.
 void configure(IConfiguration config)
           
 void configure(String configText)
          Configures the runner by wiring together dependencies as specified by the configuration text.
 groovy.lang.GroovyClassLoader getClassLoader()
          Returns the current GroovyClassLoader, which may be used by TestNG to load test and related classes.
protected  Set getDuplicateSuiteNames(TestNG testng)
           
 TestInstanceFinder getFinder()
           
 groovy.lang.MetaClass getMetaClass()
           
 String getOutputDir()
           
 Object getProperty(String name)
           
 List getTestNGListeners()
          Returns a modifiable List of ITestNGListener objects that will be registered directly with the underlying runner.
protected  void interrupt()
          Prepares to enter interactive mode in response to user input.
 Object invokeMethod(String name, Object args)
           
static void main(Object args)
           
 void run(List paths, boolean interactiveStart)
          Executes the test suites represented by XML files, along with tests represented as Groovy files, whose paths are provided as a parameter to this method.
 void setFinder(TestInstanceFinder value)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setOutputDir(String value)
           
 void setProperty(String name, Object value)
           
 void setTestNGListeners(List value)
           
protected  void startInteractiveThread()
          Starts a thread that reads the runner's input stream for a directive to start interactive mode.
protected  void stopInteractiveThread()
          Instructs the input scanning thread to stop at the next convenient time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestRunner

public TestRunner()

TestRunner

public TestRunner(InputStream _in,
                  PrintStream out)

TestRunner

public TestRunner(InputStream _in,
                  PrintStream out,
                  groovy.util.AntBuilder ant)
Method Detail

getFinder

public TestInstanceFinder getFinder()

setFinder

public void setFinder(TestInstanceFinder value)

getTestNGListeners

public List getTestNGListeners()
Description copied from interface: ITestRunner
Returns a modifiable List of ITestNGListener objects that will be registered directly with the underlying runner. Note that this List may be modified / clobbered if configure() is called.

Specified by:
getTestNGListeners in interface ITestRunner

setTestNGListeners

public void setTestNGListeners(List value)

getOutputDir

public String getOutputDir()

setOutputDir

public void setOutputDir(String value)

configure

public void configure(File configFile)
Configures the runner by wiring together dependencies as specified by the configuration file.

Specified by:
configure in interface ITestRunner
Parameters:
configFile -

configure

public void configure(String configText)
Configures the runner by wiring together dependencies as specified by the configuration text.

Specified by:
configure in interface ITestRunner
Parameters:
configText -

configure

public void configure(IConfiguration config)

getClassLoader

public groovy.lang.GroovyClassLoader getClassLoader()
Returns the current GroovyClassLoader, which may be used by TestNG to load test and related classes. The underlying object may change if configure() is invoked.


run

public void run(List paths,
                boolean interactiveStart)
Executes the test suites represented by XML files, along with tests represented as Groovy files, whose paths are provided as a parameter to this method. The contextual class loader of the TestNG run is a GroovyClassLoader that is aware of any task classpaths specified in the Configuration.

Specified by:
run in interface ITestRunner
Parameters:
paths - paths to files that are either Lightest suite XML files, or Groovy scripts that are LightestTestCase's.
interactiveStart - whether to start the runner in interactive mode, if possible

getDuplicateSuiteNames

protected Set getDuplicateSuiteNames(TestNG testng)

startInteractiveThread

protected void startInteractiveThread()
Starts a thread that reads the runner's input stream for a directive to start interactive mode. This is typically whenever the user hits the Enter/Return key. The content of the line entered will be discarded.


stopInteractiveThread

protected void stopInteractiveThread()
Instructs the input scanning thread to stop at the next convenient time. If the thread is not currently running, this is a no-op.


interrupt

protected void interrupt()
Prepares to enter interactive mode in response to user input. Interactive mode cannot be entered when tests are being run in parallel. We can only know whether tests are being run in parallel after the TestNG suites have been set, e.g. after setSuites() has been called. This method will fail with an assertion error if called beforehand. If the current task dispatch strategy does not allow for interruption, this will be a no-op.


main

public static void main(Object args)

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public Object invokeMethod(String name,
                           Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(String name,
                        Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2009. All Rights Reserved.