com.googlecode.lightest.core
Class TestRegistry

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

public class TestRegistry
extends Object
implements groovy.lang.GroovyObject

The test registry is used to keep track of two things: 1) the pending tests, i.e. ones that are scheduled to run but have not yet had results reported against them; and 2) the id of each test result - which is used to cross-reference between the default generated testng-results.xml and the LightestTestResult object passed into ILightestReporter methods. All operations are thread-safe.


Constructor Summary
TestRegistry()
           
TestRegistry(List tests)
           
TestRegistry(TestRegistry other)
           
 
Method Summary
 void add(List tests)
          Adds a list of TestInstance's to the registry.
 void add(TestInstance test)
          Adds a single TestInstance to the registry.
 Map getData()
          Returns an immutable mapping of TestInstance's to their counting tickers.
 Object getId(ITestResult result)
          Returns the Integer id this result was resolved with, or null if the result is not registered.
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
 Set getUniqueClassNames()
          Returns a Set of unique class names associated with all registered test instances.
 Object invokeMethod(String name, Object args)
           
 TestRegistry match(String className)
          Returns a new test registry, filtered by class name.
 TestRegistry match(String suiteName, String testName)
          Returns a new test registry, filtered by suite name and test name.
 void resolve(String suiteName, String testName, ITestResult result, int id)
          Removes the first test instance associated with the TestNG test result, if any, and adds in a result to replace it.
 void resolve(TestNGContext testngContext, ITestResult result, int id)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(String name, Object value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestRegistry

public TestRegistry()

TestRegistry

public TestRegistry(List tests)

TestRegistry

public TestRegistry(TestRegistry other)
Method Detail

add

public void add(TestInstance test)
Adds a single TestInstance to the registry.

Parameters:
test - the test instance to add

add

public void add(List tests)
Adds a list of TestInstance's to the registry.

Parameters:
tests - the test instances to add

resolve

public void resolve(TestNGContext testngContext,
                    ITestResult result,
                    int id)

resolve

public void resolve(String suiteName,
                    String testName,
                    ITestResult result,
                    int id)
Removes the first test instance associated with the TestNG test result, if any, and adds in a result to replace it.

Parameters:
suiteName -
testName -
result -

getData

public Map getData()
Returns an immutable mapping of TestInstance's to their counting tickers. Ordering of entries in the map should be preserved for subsequent iterations across the map.


getId

public Object getId(ITestResult result)
Returns the Integer id this result was resolved with, or null if the result is not registered.

Parameters:
result -

getUniqueClassNames

public Set getUniqueClassNames()
Returns a Set of unique class names associated with all registered test instances.


match

public TestRegistry match(String suiteName,
                          String testName)
Returns a new test registry, filtered by suite name and test name.

Parameters:
suiteName -
testName -

match

public TestRegistry match(String className)
Returns a new test registry, filtered by class name.

Parameters:
className -

toString

public String toString()
Overrides:
toString in class Object

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.