|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase groovy.util.GroovyTestCase junitx.ddtunit.DDTTestCase
public abstract class DDTTestCase
This class is derived from TestCase
from JUnit.
It will
implement all neccessary features to run tests based on xml parameter data.
Field Summary |
---|
Fields inherited from class groovy.util.GroovyTestCase |
---|
TEST_SCRIPT_NAME_PREFIX |
Constructor Summary | |
---|---|
DDTTestCase()
|
|
DDTTestCase(String name)
|
Method Summary | |
---|---|
protected void |
addObjectToAssert(String assertId,
Object object)
Add object to make assertion against assert definition identified by assertId |
protected void |
assertObject(String assertId,
Object obj)
Directly assert expected against actual object during method execution. |
protected void |
assertObject(String assertId,
Object obj,
boolean mark)
Directly assert expected against actual object during method execution. |
int |
countMethodTests()
Count number of test datasets provided for method methodName. |
protected Object |
getGlobalObject(String objectId)
Retrieve object with specified identifier on a per class basis. |
protected Object |
getGlobalObject(String objectId,
String objectType)
Retrieve object with specified identifier on a per class basis. |
protected Object |
getObject(String objectId)
Retrieve object with specified identifier on a per method-test basis. |
protected Object |
getObject(String objectId,
String objectType)
Retrieve object with specified identifier on a per method-test basis. |
protected Object |
getResourceObject(String objectId)
Retrieve object with specified identifier on class independend basis. |
protected Object |
getResourceObject(String objectId,
String objectType)
Retrieve object with specified identifier on class independend basis. |
String |
getTestName()
|
protected abstract void |
initContext()
Implement method for initializing test context. |
protected void |
initTestData(String classId)
Initialize xml test data for specified classId in resource associagted to same name as classId using ResourceNameFactory . |
protected void |
initTestData(String resource,
String classId)
Initialize xml test data for specified classId in resource |
junit.framework.TestResult |
run()
Run complete selected testmethod by generating a separate result und return this after execution. |
void |
run(junit.framework.TestResult result)
Run complete selected testmethod by generating a separate result und return this after execution. |
void |
runBare()
Run a bare method cycle as defined in JUnit. |
String |
runInfo()
|
protected void |
runMethodTest()
Execute the testmethod without extra setUp and tearDown methods and no hooks to TestListener classes like TestRunner. |
protected void |
runTest()
Do not use this method to define tests. |
void |
setTestName(String testName)
|
protected void |
validateAsserts(boolean assertSupport)
Validate all assertions concerning the active method-test dataset. |
Methods inherited from class groovy.util.GroovyTestCase |
---|
assertArrayEquals, assertContains, assertContains, assertEquals, assertEquals, assertEquals, assertInspect, assertLength, assertLength, assertLength, assertScript, assertToString, fixEOLs, getMethodName, getName, getTestClassName, notYetImplemented, notYetImplemented, shouldFail, shouldFail, shouldFailWithCause |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
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, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface junitx.ddtunit.IDDTTestCase |
---|
getName |
Constructor Detail |
---|
public DDTTestCase()
public DDTTestCase(String name)
name
- of testmethod to executeMethod Detail |
---|
public junit.framework.TestResult run()
run
in interface IDDTTestCase
run
in class junit.framework.TestCase
public void run(junit.framework.TestResult result)
run
in interface junit.framework.Test
run
in interface IDDTTestCase
run
in class junit.framework.TestCase
result
- object generated externally, by a testrunner e.g..public void runBare() throws Throwable
runBare
in interface IDDTTestCase
runBare
in class junit.framework.TestCase
Throwable
- that might come up during testmethod execution.protected Object getObject(String objectId)
objectId
- specifies key for retrieval
protected Object getObject(String objectId, String objectType)
objectId
- specifies key for retrieval
protected Object getGlobalObject(String objectId)
objectId
- specifies key for retrieval
protected Object getGlobalObject(String objectId, String objectType)
objectId
- specifies key for retrieval
protected Object getResourceObject(String objectId)
objectId
- specifies key for retrieval
protected Object getResourceObject(String objectId, String objectType)
objectId
- specifies key for retrieval
protected void addObjectToAssert(String assertId, Object object)
assertId
- to identify assertobject
- used as actual object against expected object defined in
assertionprotected void assertObject(String assertId, Object obj)
assertId
- to retrieve expected assertobj
- to assert against expected valueprotected void assertObject(String assertId, Object obj, boolean mark)
assertId
- to retrieve expected assertobj
- to assert against expected valuemark
- true if validation should be marked as executedprotected void validateAsserts(boolean assertSupport)
protected abstract void initContext()
void initContext() {
initTestData("/mySpecialResource.xml", "ClassIdInResourceToUse");
}
protected void initTestData(String classId)
ResourceNameFactory
.
resource
- of xml based test dataprotected void initTestData(String resource, String classId)
resource
- of xml based test dataclassId
- of test data to processprotected void runTest()
test<name>()
instead.
runTest
in class junit.framework.TestCase
protected void runMethodTest() throws Throwable
Throwable
- on any exception that occurespublic int countMethodTests()
countMethodTests
in interface IDDTTestCase
public String runInfo()
runInfo
in interface IDDTTestCase
public String getTestName()
getTestName
in interface IDDTTestCase
public void setTestName(String testName)
setTestName
in interface IDDTTestCase
testName
- The testName to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |