com.googlecode.lightest.core
Class LightestTestCase

java.lang.Object
  extended by com.googlecode.lightest.core.LightestContextAware
      extended by com.googlecode.lightest.core.LightestTestCase
All Implemented Interfaces:
ITaskProvider, groovy.lang.GroovyObject

public class LightestTestCase
extends LightestContextAware
implements groovy.lang.GroovyObject, ITaskProvider

The base class for all testcase classes runnable in the Lightest framework. In order to enable any domain specific API's in this testcase, an implementation of IDomainSpecificApi should be set with setApi(). One technique to do this is to subclass this class, set the API in a @BeforeTest method (or constructor), and derive test classes from that subclass.


Constructor Summary
LightestTestCase()
           
 
Method Summary
 void assign(ITestContext context)
          Assigns this test class instance to a task dispatcher.
 boolean canRunIn(ITestEnvironment env)
          Used to indicate whether the current test class can run in the given environment; i.e. whether the environment satisfies the basic requirements for the test.
 IDomainSpecificApi getApi()
           
 TaskNodeBuilder getBuilder()
          Returns the builder this task provider uses to create task nodes to be sent for dispatch.
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
 Object invokeMethod(String name, Object args)
           
 void setApi(IDomainSpecificApi value)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(String name, Object value)
           
 void setUp()
          Performs per-method setup.
 void tearDown(ITestContext testngContext)
          Here we tamper with the TestNG suite internals so the suite result is available for intermediate report generation.
 void unassign()
          Unbinds the assigned task dispatcher from this test class.
 
Methods inherited from class com.googlecode.lightest.core.LightestContextAware
getContext, getDispatcher, getEnv, getPrefs, setDispatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightestTestCase

public LightestTestCase()
Method Detail

getApi

public IDomainSpecificApi getApi()

setApi

public void setApi(IDomainSpecificApi value)

assign

public final void assign(ITestContext context)
Assigns this test class instance to a task dispatcher. Overriding methods must invoke this via super.


setUp

public final void setUp()
Performs per-method setup. Overriding methods must invoke this via super.


tearDown

public final void tearDown(ITestContext testngContext)
Here we tamper with the TestNG suite internals so the suite result is available for intermediate report generation. We are bad!!! Overriding methods must invoke this via super.


unassign

public final void unassign()
Unbinds the assigned task dispatcher from this test class. Overriding methods must invoke this via super.


getBuilder

public TaskNodeBuilder getBuilder()
Description copied from interface: ITaskProvider
Returns the builder this task provider uses to create task nodes to be sent for dispatch.

Specified by:
getBuilder in interface ITaskProvider

canRunIn

public boolean canRunIn(ITestEnvironment env)
Used to indicate whether the current test class can run in the given environment; i.e. whether the environment satisfies the basic requirements for the test. The default implementation simply returns true; subclasses should override this method to change its behavior. Although this method hints at which dispatchers are appropriate for this test class, different implementations of IDispatcherAssignmentStrategy may ignore it.

Parameters:
env - the environment for which to tell whether this test can run

getMetaClass

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

setMetaClass

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

invokeMethod

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

getProperty

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

setProperty

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


Copyright © 2009. All Rights Reserved.