raccoon.core.uitest
Class UiTester

java.lang.Object
  extended by raccoon.core.types.AbsComponent
      extended by raccoon.core.types.AbsLoadable
          extended by raccoon.core.types.AbsConfigurableLoadable
              extended by raccoon.core.uitest.UiTester
All Implemented Interfaces:
IUnitTester, IBaseComponent, IConfigurable, ILoadable, ILogable

public class UiTester
extends AbsConfigurableLoadable
implements IUnitTester

The primary unit testing service.

Since:
Raccoon v1.0
Version:
$Id: UiTester.java,v 1.1 2004/08/08 20:19:20 crouvrais Exp $
Author:
Cedric ROUVRAIS

Field Summary
static java.lang.String MESSAGES_NOT_RECEIVED
          The user friendly message indicating a failure of the test.
static java.lang.String UNIT_FILE
          The name of the property UnitFile
 
Fields inherited from class raccoon.core.types.AbsConfigurableLoadable
mConfigurableManager
 
Fields inherited from class raccoon.core.types.AbsLoadable
mIsLoaded
 
Fields inherited from class raccoon.core.types.AbsComponent
mIsInError
 
Constructor Summary
UiTester()
          Default constructor, required for dynamic instanciation
 
Method Summary
 void configureParameters()
          Configures the various parameters for this component.
(package private)  UiTestResult executeTest(UiTest pTest)
          Executes a single test case.
(package private)  ReceivedMessage findMessage(IComparator pComparator, java.util.ArrayList pResultOfComparator, java.util.Map pMessages)
          Checks if the given message is located in the list of messages.
 int getNbUnitCase()
          The number of test contained in this instance.
 java.lang.String getUnitFile()
          The XML file that contains the configuration for this Suite instance.
(package private)  UiTestResult isReceived(UiTest pTest)
          Checks if the expected messages where all received.
 void load()
          Invoked by the service manager to start this component once it has been configured.
(package private)  void loadExpected(UiTest pTest)
          Retrieves from the file system the messages that are expected for this test.
(package private)  void loadIgnoreList(java.util.Iterator pWalker)
           
(package private)  void loadSubscribers(java.util.Iterator pWalker)
          Loads the subscribers via the service manager attached to this component.
 IUnitCaseResult run()
          Executes the test case that was defined during the invocation of setUp(int).
(package private)  void setServiceManager(IServiceManager pServiceManager)
          For unit testing purposes exclusively!
 void setUnitFile(java.lang.String pFileName)
          Defines the XML File that is to be used to configure this instance
 void setUp(int pUnitCaseId)
          Prepares the system to execute the specified test case
(package private)  IUnitPlayer setUp(UiTest pTest)
          Prepares the given unit test for execution.
 void tearDown()
          Deactivates the current unit test
(package private)  void tearDown(UiTest pTest)
          Tears down the specified test case.
 
Methods inherited from class raccoon.core.types.AbsConfigurableLoadable
isStable, setConfigurableManager, setLogger
 
Methods inherited from class raccoon.core.types.AbsLoadable
getLog, isInError, isInitialised, isRunning, unload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIT_FILE

public static final java.lang.String UNIT_FILE
The name of the property UnitFile

See Also:
Constant Field Values

MESSAGES_NOT_RECEIVED

public static final java.lang.String MESSAGES_NOT_RECEIVED
The user friendly message indicating a failure of the test.

See Also:
Constant Field Values
Constructor Detail

UiTester

public UiTester()
Default constructor, required for dynamic instanciation

Method Detail

configureParameters

public void configureParameters()
Configures the various parameters for this component. This method should configure the instance of IConfigurableManager provided during the invocation of AbsConfigurableLoadable.setConfigurableManager(raccoon.api.types.IConfigurableManager).

Specified by:
configureParameters in interface IConfigurable
Overrides:
configureParameters in class AbsConfigurableLoadable

setServiceManager

void setServiceManager(IServiceManager pServiceManager)
For unit testing purposes exclusively!

Parameters:
pServiceManager - just to test internally this component

getUnitFile

public java.lang.String getUnitFile()
The XML file that contains the configuration for this Suite instance.

Returns:
the name of the XML file that is currently being used.

setUnitFile

public void setUnitFile(java.lang.String pFileName)
                 throws RaccoonException,
                        java.lang.IllegalArgumentException
Defines the XML File that is to be used to configure this instance

Specified by:
setUnitFile in interface IUnitTester
Parameters:
pFileName - the name of the XML file to use.
Throws:
RaccoonException - if this component is already running: the component can't be changed. Error code is ErrorCodes.COMPONENT_INITIALISED
java.lang.IllegalArgumentException - if the parameter is null, the message is obtained via MsgHelper.formatNullParamter(java.lang.String, java.lang.Class)

load

public void load()
          throws LoadableException
Invoked by the service manager to start this component once it has been configured.

When extended bare in mind that the member variable mIsLoaded should be set to false and then set to true once all the init code has been performed.

Checks if all the required properties are set.

Specified by:
load in interface ILoadable
Overrides:
load in class AbsConfigurableLoadable
Throws:
LoadableException - if this component isn't initialisable or is already running.

getNbUnitCase

public int getNbUnitCase()
The number of test contained in this instance.

Specified by:
getNbUnitCase in interface IUnitTester
Returns:
the number of unit cases in this instance.

setUp

public void setUp(int pUnitCaseId)
           throws RaccoonException
Prepares the system to execute the specified test case

Specified by:
setUp in interface IUnitTester
Parameters:
pUnitCaseId - the id of the test case to execute
Throws:
RaccoonException - if this component isn't loaded.
RaccoonException - if the specified unit case doesn't exist.

run

public IUnitCaseResult run()
                    throws RaccoonException
Executes the test case that was defined during the invocation of setUp(int).

Specified by:
run in interface IUnitTester
Returns:
a HashMap where the key is the name of the UiTest and the value is the result of the execution of the test.
Throws:
RaccoonException - if setUp(int) wasn't invoked or if something went wrong.

executeTest

UiTestResult executeTest(UiTest pTest)
                   throws RaccoonException
Executes a single test case.

Parameters:
pTest - the test case to execute.
Returns:
the result of the execution.
Throws:
RaccoonException - if an error occurred during the execution of the test.

setUp

IUnitPlayer setUp(UiTest pTest)
            throws RaccoonException
Prepares the given unit test for execution.

Parameters:
pTest - the unit test to prepare for execution
Returns:
the unit player associated to this test.
Throws:
RaccoonException - the setup process fails.

loadSubscribers

void loadSubscribers(java.util.Iterator pWalker)
               throws RaccoonException
Loads the subscribers via the service manager attached to this component.

Parameters:
pWalker - an iterator of ComponentFile representing the subscribers to load.
Throws:
RaccoonException - if a subscriber isn't defined in the current context.

loadIgnoreList

void loadIgnoreList(java.util.Iterator pWalker)
              throws RaccoonException
Throws:
RaccoonException

loadExpected

void loadExpected(UiTest pTest)
            throws RaccoonException
Retrieves from the file system the messages that are expected for this test.

Parameters:
pTest - the test for which the expected messages are to be loaded.
Throws:
RaccoonException - if the one of the expected message is invalid.

isReceived

UiTestResult isReceived(UiTest pTest)
Checks if the expected messages where all received.

Parameters:
pTest - the test for which the check is to be done.
Returns:
the result of the test, null if the expected message wasn't received.

findMessage

ReceivedMessage findMessage(IComparator pComparator,
                            java.util.ArrayList pResultOfComparator,
                            java.util.Map pMessages)
Checks if the given message is located in the list of messages.

Parameters:
pMessages - the list of messages that may contain the given message.
Returns:
the result of the search, null if the message wasn't located.

tearDown

void tearDown(UiTest pTest)
        throws RaccoonException
Tears down the specified test case.

Parameters:
pTest - the test case to tear down
Throws:
RaccoonException - if soemthing goes wrong.

tearDown

public void tearDown()
              throws RaccoonException
Deactivates the current unit test

Specified by:
tearDown in interface IUnitTester
Throws:
RaccoonException - if the tear down process fails.


Copyright null null. All Rights Reserved.