TPTP 4.3.0 Testing Tools Project
Public API Specification

org.eclipse.hyades.test.common.junit
Class HyadesTestSuite

java.lang.Object
  extended byjunit.framework.TestSuite
      extended byorg.eclipse.hyades.test.common.junit.HyadesTestSuite
All Implemented Interfaces:
IHyadesTest, junit.framework.Test

public class HyadesTestSuite
extends junit.framework.TestSuite
implements IHyadesTest

This class extends the TestSuite class adding the expected behavior defined in the org.eclipse.hyades.test.java.junit.IHyadesTest interface.

By redefining addTest(Test) and addTestSuite(Class), instances of this class will be set as the parent of any instance of IHyadesTest passed as parameter. This is done transparently so the test developer won't need to add any additional code to provide the backward hierarchy navigability.

By redefining run(TestResult) the iteration information is also calculated in a transparent way.

Since:
1.0.1

Nested Class Summary
static class HyadesTestSuite.AsynchronousThread
           
 
Constructor Summary
HyadesTestSuite()
          Constructor for HyadesTestSuite.
HyadesTestSuite(java.lang.Class theClass)
          Constructor for HyadesTestSuite.
HyadesTestSuite(java.lang.String name)
          Constructor for HyadesTestSuite.
 
Method Summary
 void addTest(junit.framework.Test test)
          Sets this test as the parent of the added Test if it implements IHyadesTest.
 void addTestSuite(java.lang.Class testClass)
           
protected  void adjustIteration()
          Calculates the current iteration comparing the number of executions with the number of tests of the suite.
protected  void doRun(junit.framework.TestResult result)
           
 IHyadesTestArbiter getArbiter()
          Gets the arbiter that evaluates this test suite.
 java.lang.String getId()
          Returns the id of the test
 int getIteration()
          Returns the current iteration of the test or -1 if the iteration cannot be calculated.
static java.lang.String getIterationsString(IHyadesTest parentTest)
          Deprecated. Use getIterationsString(String, IHyadesTest) instead.
static java.lang.String getIterationsString(java.lang.String parentEventID, IHyadesTest parentTest)
           
 junit.framework.Test getParent()
          Returns the parent of this test.
protected static int getParentIteration(IHyadesTest parent)
           
protected  int getPreviousParentIteration()
           
 java.lang.String getTestInvocationId()
          Gets the test invocation id.
 boolean isLoop()
          Returns whether or not this test implements a loop.
 boolean isSynchronous()
          Returns whether this test is synchronous or asynchronous.
 void run(junit.framework.TestResult result)
          If the test result is an instance of HyadesTestResult this method notifies the start and end events of this test suite to the registered listeners of the test result.
protected  void runFinished(junit.framework.Test test)
           
 void runTest(junit.framework.Test test, junit.framework.TestResult result)
           
 HyadesTestSuite setArbiter(IHyadesTestArbiter arbiter)
          Sets the arbiter that evaluates this test suite.
 IHyadesTest setId(java.lang.String id)
          Sets the test id
 IHyadesTest setLoop(boolean loop)
          Sets whether this test implements a loop
 void setParent(junit.framework.Test parent)
          Sets the parent of this test.
protected  void setPreviousParentIteration(int iteration)
           
 IHyadesTest setSynchronous(boolean synchronous)
          Sets wheter this test must be executed synchronously or asynchronously.
 IHyadesTest setTestInvocationId(java.lang.String testInvocationId)
          Sets the test invocation id.
 java.lang.String toJUnitString()
          Returns the default JUnit toString value.
 java.lang.String toString()
          Returns this test's hierarchy.
protected  void waitUntilFinished()
           
 
Methods inherited from class junit.framework.TestSuite
countTestCases, createTest, getName, getTestConstructor, setName, testAt, testCount, tests
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.hyades.test.common.junit.IHyadesTest
getName
 
Methods inherited from interface junit.framework.Test
countTestCases
 

Constructor Detail

HyadesTestSuite

public HyadesTestSuite()
Constructor for HyadesTestSuite.


HyadesTestSuite

public HyadesTestSuite(java.lang.Class theClass)
Constructor for HyadesTestSuite.

Parameters:
theClass -

HyadesTestSuite

public HyadesTestSuite(java.lang.String name)
Constructor for HyadesTestSuite.

Parameters:
name -
Method Detail

getId

public java.lang.String getId()
Description copied from interface: IHyadesTest
Returns the id of the test

Specified by:
getId in interface IHyadesTest
See Also:
IHyadesTest.getId()

setId

public IHyadesTest setId(java.lang.String id)
Description copied from interface: IHyadesTest
Sets the test id

Specified by:
setId in interface IHyadesTest
Returns:
this test
See Also:
IHyadesTest.setId(String)

getTestInvocationId

public java.lang.String getTestInvocationId()
Description copied from interface: IHyadesTest
Gets the test invocation id.

Specified by:
getTestInvocationId in interface IHyadesTest
Returns:
String
See Also:
IHyadesTest.getTestInvocationId()

setTestInvocationId

public IHyadesTest setTestInvocationId(java.lang.String testInvocationId)
Description copied from interface: IHyadesTest
Sets the test invocation id.

Specified by:
setTestInvocationId in interface IHyadesTest
Parameters:
testInvocationId -
Returns:
this test
See Also:
IHyadesTest.setTestInvocationId(java.lang.String)

setParent

public void setParent(junit.framework.Test parent)
Description copied from interface: IHyadesTest
Sets the parent of this test.

Specified by:
setParent in interface IHyadesTest
Parameters:
parent -
See Also:
IHyadesTest#setParent(TestSuite)

getParent

public junit.framework.Test getParent()
Description copied from interface: IHyadesTest
Returns the parent of this test.

Specified by:
getParent in interface IHyadesTest
Returns:
Test
See Also:
IHyadesTest.getParent()

getIteration

public int getIteration()
Description copied from interface: IHyadesTest
Returns the current iteration of the test or -1 if the iteration cannot be calculated.

Specified by:
getIteration in interface IHyadesTest
Returns:
int
See Also:
IHyadesTest.getIteration()

setSynchronous

public IHyadesTest setSynchronous(boolean synchronous)
Description copied from interface: IHyadesTest
Sets wheter this test must be executed synchronously or asynchronously.

Specified by:
setSynchronous in interface IHyadesTest
Parameters:
synchronous -
Returns:
this test
See Also:
IHyadesTest.setSynchronous(boolean)

isSynchronous

public boolean isSynchronous()
Description copied from interface: IHyadesTest
Returns whether this test is synchronous or asynchronous.

Specified by:
isSynchronous in interface IHyadesTest
Returns:
boolean
See Also:
IHyadesTest.isSynchronous()

isLoop

public boolean isLoop()
Description copied from interface: IHyadesTest
Returns whether or not this test implements a loop.

Specified by:
isLoop in interface IHyadesTest
Returns:
boolean
See Also:
IHyadesTest.isLoop()

setLoop

public IHyadesTest setLoop(boolean loop)
Description copied from interface: IHyadesTest
Sets whether this test implements a loop

Specified by:
setLoop in interface IHyadesTest
Parameters:
loop -
Returns:
this test
See Also:
IHyadesTest.setLoop(boolean)

setArbiter

public HyadesTestSuite setArbiter(IHyadesTestArbiter arbiter)
Sets the arbiter that evaluates this test suite.

Parameters:
arbiter -
Returns:
this test suite

getArbiter

public IHyadesTestArbiter getArbiter()
Gets the arbiter that evaluates this test suite.


addTestSuite

public void addTestSuite(java.lang.Class testClass)
See Also:
TestSuite.addTestSuite(Class)

addTest

public void addTest(junit.framework.Test test)
Sets this test as the parent of the added Test if it implements IHyadesTest.

Parameters:
test -
See Also:
TestSuite.addTest(Test)

run

public void run(junit.framework.TestResult result)
If the test result is an instance of HyadesTestResult this method notifies the start and end events of this test suite to the registered listeners of the test result.

Specified by:
run in interface junit.framework.Test
See Also:
Test.run(junit.framework.TestResult)

doRun

protected void doRun(junit.framework.TestResult result)

runTest

public void runTest(junit.framework.Test test,
                    junit.framework.TestResult result)
See Also:
TestSuite.runTest(junit.framework.Test, junit.framework.TestResult)

adjustIteration

protected void adjustIteration()
Calculates the current iteration comparing the number of executions with the number of tests of the suite.


getPreviousParentIteration

protected int getPreviousParentIteration()

setPreviousParentIteration

protected void setPreviousParentIteration(int iteration)

getParentIteration

protected static int getParentIteration(IHyadesTest parent)

waitUntilFinished

protected void waitUntilFinished()

runFinished

protected void runFinished(junit.framework.Test test)

toJUnitString

public java.lang.String toJUnitString()
Description copied from interface: IHyadesTest
Returns the default JUnit toString value.

Specified by:
toJUnitString in interface IHyadesTest
Returns:
String
See Also:
IHyadesTest.toJUnitString()

toString

public java.lang.String toString()
Returns this test's hierarchy.

See Also:
Object.toString()

getIterationsString

public static java.lang.String getIterationsString(IHyadesTest parentTest)
Deprecated. Use getIterationsString(String, IHyadesTest) instead.

Parameters:
parentTest -
Returns:

getIterationsString

public static java.lang.String getIterationsString(java.lang.String parentEventID,
                                                   IHyadesTest parentTest)

TPTP 4.3.0 Testing Tools Project
Public API Specification