|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--com.netriser.xmltestsuite.TestResource | +--com.netriser.xmltestsuite.ResourceFactory
The factory class which handles resource creation and initialisation.
To obtain a resource use @link #getResource(String)
DBReource dbresource = (DBResource) ResourceFactory getResource("com.netriser.xmltestsuite.DBResource");For all the current resources, convenience methods have been added, so this can be simplified to
DBReource dbresource = ResourceFactory getDbResource()
This package uses a factory pattern to handle resouce creation and initialisation. It ensures that resource objects are created once only, and that the initialisation (setup) and tidyup (teardown) is performed once per run.
This is particularly important when using the gui version of the junit runner,
This factory is designed to be flexible, and can be used to instantiate any class. See @link TestResourceInterface and @link TestResource for more details.
To avoid complex coding in the resource classes to deal with dependancies, resources are inialised by the factory object on a "most recently accessed, inialised first" basis. Whilst not foolproof it works well with existing classes and will work if you follow the guidelines for new classes.
Constructor Summary | |
ResourceFactory()
|
Method Summary | |
static BrowserResource |
getBrowserResource()
|
static org.w3c.dom.Document |
getConfiguration()
|
static DBResource |
getDBResource()
|
static DomainResource |
getDomainResource()
|
static HttpResource |
getHttpResource()
|
static MapResource |
getMapResource()
|
static TestResourceInterface |
getResource(java.lang.String className)
|
TestResourceInterface |
getResourceByClassName(java.lang.String className)
|
static TestMonitor |
getTestMonitor()
|
static java.lang.String |
getText(org.w3c.dom.Node node)
|
static ResourceFactory |
resourceFactory()
Method resourceFactory. |
void |
setTestResult(junit.framework.TestResult testCollector)
setTestResult. |
void |
setUp()
Setup the resource before the tests are run |
void |
setUp(org.w3c.dom.Document configuration)
|
void |
tearDown()
Tidy up the resource after the tests are run |
Methods inherited from class com.netriser.xmltestsuite.TestResource |
debug, getDebugMode, getVerboseMode, setDebug, setVerbose, useTestResult, verbose |
Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResourceFactory()
Method Detail |
public void setTestResult(junit.framework.TestResult testCollector)
testCollector
- public void setUp(org.w3c.dom.Document configuration)
public void setUp()
TestResource
setUp
in interface TestResourceInterface
setUp
in class TestResource
TestResourceInterface.setUp()
public void tearDown()
TestResource
tearDown
in interface TestResourceInterface
tearDown
in class TestResource
TestResourceInterface.tearDown()
public TestResourceInterface getResourceByClassName(java.lang.String className)
public static ResourceFactory resourceFactory()
public static TestResourceInterface getResource(java.lang.String className)
public static org.w3c.dom.Document getConfiguration()
public static DBResource getDBResource()
public static MapResource getMapResource()
public static HttpResource getHttpResource()
public static TestMonitor getTestMonitor()
public static BrowserResource getBrowserResource()
public static DomainResource getDomainResource()
public static java.lang.String getText(org.w3c.dom.Node node)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |