com.atlassian.jira.functest.framework
Class TestSuiteBuilder

java.lang.Object
  extended by com.atlassian.jira.functest.framework.TestSuiteBuilder

public final class TestSuiteBuilder
extends Object

Divides up a set of tests such that they can be performed in parallel. It does this by taking a set of tests and dividing them up into composite test of roughly even size.

If a passed test is annotated with Splitable then its individual test methods will be broken out into the different tests. All other tests have all their test methods within the same batch.


Nested Class Summary
 class TestSuiteBuilder.ParallelEnvironmentTestSuite
           
 
Constructor Summary
TestSuiteBuilder()
          Create a no-op splitter, that is, the passed tests will not be batched.
TestSuiteBuilder(int batch, int maxBatch)
          Create a splitter that will return the given batch from the specified number of total batches.
 
Method Summary
 TestSuiteBuilder addSingleTestMethod(Class<? extends junit.framework.TestCase> testClass, String methodName)
          Adds an individual test method to the suite.
 TestSuiteBuilder addTest(Class<? extends junit.framework.TestCase> test)
           
 TestSuiteBuilder addTests(Class<? extends junit.framework.TestCase>... tests)
           
 TestSuiteBuilder addTests(Collection<Class<? extends junit.framework.TestCase>> tests)
          Add the passed tests to the splitter for division.
 TestSuiteBuilder batch(int batch)
           
 junit.framework.Test build()
          Create the composite test that represents the batch.
 TestSuiteBuilder log(boolean log)
           
 TestSuiteBuilder maxBatch(int maxBatch)
           
 TestSuiteBuilder parallel(boolean parallel)
           
 String toString()
           
 TestSuiteBuilder watch(long timeout, long delay, TimeUnit unit, Class<? extends junit.framework.Test>... classes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestSuiteBuilder

public TestSuiteBuilder(int batch,
                        int maxBatch)
Create a splitter that will return the given batch from the specified number of total batches.

Parameters:
batch - the batch the splitter should return. A value of -1 can be specified when maxBatch is also passed -1. This indicates that no batching should be performed.
maxBatch - the number of batches that splitter should divide the tests into. A value of -1 can be specified when batch is also passed -1. This indicates that no batching should be performed.

TestSuiteBuilder

public TestSuiteBuilder()
Create a no-op splitter, that is, the passed tests will not be batched. Same as @{code TestSplitter(-1, -1) }.

Method Detail

addTests

public TestSuiteBuilder addTests(Collection<Class<? extends junit.framework.TestCase>> tests)
Add the passed tests to the splitter for division.

Parameters:
tests - the set of tests to divide.
Returns:
a reference to this.

addTests

public TestSuiteBuilder addTests(Class<? extends junit.framework.TestCase>... tests)

addTest

public TestSuiteBuilder addTest(Class<? extends junit.framework.TestCase> test)

addSingleTestMethod

public TestSuiteBuilder addSingleTestMethod(Class<? extends junit.framework.TestCase> testClass,
                                            String methodName)
Adds an individual test method to the suite. This is currently experimental and only intended to be used in "blame" mode.

Parameters:
testClass - the TestCase class
methodName - method name
Returns:
this TestSuiteBuilder

log

public TestSuiteBuilder log(boolean log)

batch

public TestSuiteBuilder batch(int batch)

maxBatch

public TestSuiteBuilder maxBatch(int maxBatch)

parallel

public TestSuiteBuilder parallel(boolean parallel)

watch

public TestSuiteBuilder watch(long timeout,
                              long delay,
                              TimeUnit unit,
                              Class<? extends junit.framework.Test>... classes)

build

public junit.framework.Test build()
Create the composite test that represents the batch.

Returns:
the composite test that represents the batch.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2014 Atlassian. All Rights Reserved.