com.netriser.xmltestsuite
Class TestResource

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--com.netriser.xmltestsuite.TestResource
All Implemented Interfaces:
TestResourceInterface
Direct Known Subclasses:
BrowserResource, ConfigurationResource, DBResource, DomainResource, HttpResource, MapResource, ResourceFactory, TestMonitor

public abstract class TestResource
extends junit.framework.Assert
implements TestResourceInterface

Superclass for resource objects. Resource objects provide resources to the test classes. They are singletons which are created once, even if a set of tests are run multiple times (e.g. through the junit gui application)

Provides initialisation placeholders setUptearDown to ensure compatibility with junit.
Provides logging facilities: verbose(), debug()

To implement a new resource,

To integrate an existing class into this sytem which already has a superclass, instead of extending from this class, modify the existing class to implement TestResourceInterface

Author:
david

Constructor Summary
TestResource()
           
 
Method Summary
static void debug(java.lang.String str)
          Prints str to System.err if debug flag is set
static boolean getDebugMode()
           
static boolean getVerboseMode()
           
static void setDebug(boolean b)
           
abstract  void setUp()
          Setup the resource before the tests are run
static void setVerbose(boolean b)
           
abstract  void tearDown()
          Tidy up the resource after the tests are run
 void useTestResult(junit.framework.TestResult resultCollector)
          Called when testing starts ie by Main::RunTest Provides opportunity to calll TestResult::addListener addListener requires class to implement TestListener interface
static void verbose(java.lang.String str)
          Prints str to System.err if verbose flag is set
 
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

TestResource

public TestResource()
Method Detail

setUp

public abstract void setUp()
Setup the resource before the tests are run

Specified by:
setUp in interface TestResourceInterface
See Also:
TestResourceInterface.setUp()

tearDown

public abstract void tearDown()
Tidy up the resource after the tests are run

Specified by:
tearDown in interface TestResourceInterface
See Also:
TestResourceInterface.tearDown()

useTestResult

public void useTestResult(junit.framework.TestResult resultCollector)
Description copied from interface: TestResourceInterface
Called when testing starts ie by Main::RunTest Provides opportunity to calll TestResult::addListener addListener requires class to implement TestListener interface

Specified by:
useTestResult in interface TestResourceInterface
Parameters:
resultCollector -
See Also:
TestResourceInterface.useTestResult(TestResult)

debug

public static void debug(java.lang.String str)
Prints str to System.err if debug flag is set


setDebug

public static void setDebug(boolean b)

getDebugMode

public static boolean getDebugMode()

verbose

public static void verbose(java.lang.String str)
Prints str to System.err if verbose flag is set

Since:

setVerbose

public static void setVerbose(boolean b)

getVerboseMode

public static boolean getVerboseMode()