public class LoadTestRule
extends org.junit.rules.ErrorCollector
AlfrescoPeople JUnit rule.
That rule is used to create a
fixed number of Alfresco users. Then LoadTestRule will do the following for each of your JUnit 4 @Test methods:
LoadTestRule.LoadTest marker annotation:
AlfrescoPeople rule will be created and started.
public class YourTestClass
{
// We need to ensure that JUnit Rules in the same 'group' (in this case the 'static' group) execute in the correct
// order. To do this we do not annotate the JUnit Rule fields themselves, but instead wrap them up in a RuleChain.
// Initialise the spring application context with a rule.
public static final ApplicationContextInit APP_CONTEXT_RULE = new ApplicationContextInit();
public static final AlfrescoPeople TEST_USERS = new AlfrescoPeople(APP_CONTEXT_RULE, 32);
@ClassRule public static RuleChain STATIC_RULE_CHAIN = RuleChain.outerRule(APP_CONTEXT_RULE)
.around(TEST_USERS);
@Rule public LoadTestRule loadTestRule = new LoadTestRule(TEST_USERS);
@Test public void aNormalTestMethod()
{
ensureFeatureFooWorks()
}
@LoadTest @Test public void aLoadTestMethod()
{
ensureFeatureFooWorks()
}
public void ensureFeatureFooWorks() {}
}
| Modifier and Type | Class and Description |
|---|---|
static interface |
LoadTestRule.LoadTest
This annotation is a marker used to identify a JUnit @Test method as a "load test".
|
| Constructor and Description |
|---|
LoadTestRule(AlfrescoPeople people) |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
int |
getCount()
Gets the number of users/concurrent threads that this Rule has been configured to use.
|
public LoadTestRule(AlfrescoPeople people)
public int getCount()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRuleapply in class org.junit.rules.VerifierCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.