|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.clarkware.junitperf.TestFactory
The TestFactory class creates thread-local
TestSuite instances.
This factory class should be used in cases when a stateful test
is intended to be decorated by a LoadTest. A stateful
test is defined as any test that defines test-specific state in
its setUp() method.
Use of the TestFactory ensures that each thread spawned
by a LoadTest contains its own TestSuite
containing all tests defined in the specified TestCase
class.
A typical usage scenario is as follows:
Test testFactory = new TestFactory(YourTestCase.class); LoadTest test = new LoadTest(testFactory, number_of_users, ...); ...
Of course, static variables cannot be protected externally, so tests intended to be run in a multithreaded environment should ensure that the use of static variables is thread-safe.
This class is dependent on Java 2. For earlier platforms a local cache implementation should be changed to use, for example, a HashMap to track thread-local information.
Test,
LoadTest| Constructor Summary | |
TestFactory(java.lang.Class testClass)
Constructs a TestFactory instances. |
|
| Method Summary | |
int |
countTestCases()
Returns the number of tests in this test. |
void |
run(junit.framework.TestResult result)
Runs an instance of the Test class and
collects its result in the specified TestResult. |
java.lang.String |
toString()
Returns the test description. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TestFactory(java.lang.Class testClass)
TestFactory instances.testClass - The TestCase class to
be run by multiple threads.| Method Detail |
public void run(junit.framework.TestResult result)
Test class and
collects its result in the specified TestResult.
Each invocation of this method triggers the creation of a
new Test class instance as specified in the
construction of this TestFactory.
run in interface junit.framework.Testresult - Test result.public int countTestCases()
countTestCases in interface junit.framework.Testpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||