Class EolEquivalenceTests<C extends EolRunConfiguration>
- java.lang.Object
-
- org.eclipse.epsilon.eol.engine.test.acceptance.util.EolEquivalenceTests<C>
-
- Direct Known Subclasses:
EclModuleEquivalenceTests
,EgxModuleEquivalenceTests
,EolModuleEquivalenceTests
,EplModuleEquivalenceTests
,EvlModuleEquivalenceTests
public abstract class EolEquivalenceTests<C extends EolRunConfiguration> extends Object
A series of tests which use the standard EolModule as an oracle and test the concurrent implementations in various configurations (different number of threads) against it to ensure identical results and behavioural equivalence. The tests are carried out in the context of scenarios. A scenario is a given combination of script (EOL file) and model to execute the script on. Since each scenario is independent, it requires its own IEolModule. For this reason, each EolRunConfiguration has an identifier so that each scenario can be uniquely identified and different modules under the same scenario can then be compared.
Regarding test ordering, only the testModuleCanExecute() method is required to be run before the others (for obvious reasons). Note that since the expected configurations are our oracles, they are assumed to pass and are exempt from testing; hence being executed in setUpBeforeClass().
This test class is intended to be extended by tests for extensions of EOL. For a reference implementation/example, please see EvlModuleEquivalenceTests. A basic implementation would need to provide the following:- A constructor which calls super(C configUnderTest)
- A setUpBeforeClass static method (annotated with @BeforeClass) which assigns
expectedConfigs and subsequently calls setUpEquivalenceTest()
- A static method returning an Iterable
annotated with @Parameters
- An implementation of _0test0() which simply calls the #beforeTests() method
- The class should be annotated with @FixMethodOrder(MethodSorters.NAME_ASCENDING)
- An implementation of _0test0() which simply calls the #beforeTests() method
- Author:
- Sina Madani
- See Also:
EolAcceptanceTestUtil
-
-
Field Summary
Fields Modifier and Type Field Description protected C
expectedConfig
The scenario and module combination under test.protected static Map<Integer,EolRunConfiguration>
expectedConfigIDs
Used to identify which scenario to compare our results with.protected static Collection<? extends EolRunConfiguration>
expectedConfigs
The oracle configurationsprotected C
testConfig
The scenario and module combination under test.
-
Constructor Summary
Constructors Constructor Description EolEquivalenceTests(C configUnderTest)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
_0test0()
Subclasses should simply callbeforeTests()
in this method.static void
afterClass()
protected void
beforeTests()
Pre-requisite for testing.static List<String>
getFrameStackAsString(EolRunConfiguration config)
static Collection<OperationContributor>
getOperationContributors(EolRunConfiguration config)
static List<ModuleElement>
getStackTraceModuleElements(EolRunConfiguration config)
protected boolean
onFail(String message)
Actions to perform if the message isnull
.protected static void
setUpEquivalenceTest(Collection<? extends EolRunConfiguration> expectedConfs)
This should be called insetUpBeforeClass()
.void
testExecutorFactories()
void
testFrameStacks()
protected void
testModuleCanExecute()
void
testOperationContributorRegistries()
protected void
testScenariosMatch()
void
zzz_AfterAll()
-
-
-
Field Detail
-
expectedConfigs
protected static Collection<? extends EolRunConfiguration> expectedConfigs
The oracle configurations
-
expectedConfigIDs
protected static Map<Integer,EolRunConfiguration> expectedConfigIDs
Used to identify which scenario to compare our results with.
-
expectedConfig
protected final C extends EolRunConfiguration expectedConfig
The scenario and module combination under test. This is the parameterised test variable.
-
testConfig
protected final C extends EolRunConfiguration testConfig
The scenario and module combination under test. This is the parameterised test variable.
-
-
Constructor Detail
-
EolEquivalenceTests
public EolEquivalenceTests(C configUnderTest)
-
-
Method Detail
-
setUpEquivalenceTest
protected static void setUpEquivalenceTest(Collection<? extends EolRunConfiguration> expectedConfs)
This should be called insetUpBeforeClass()
.- Parameters:
expectedConfs
- The oracle configurations.
-
_0test0
public abstract void _0test0() throws Exception
Subclasses should simply callbeforeTests()
in this method. Additional setup functionality may also be provided here.- Throws:
Exception
-
beforeTests
protected final void beforeTests() throws Exception
Pre-requisite for testing.- Throws:
Exception
-
onFail
protected boolean onFail(String message)
Actions to perform if the message isnull
. Generally useful for printing more detailed diagnostics than is provided by the testing framework.- Parameters:
message
- The message to fail with. Ifnull
, no action is taken.- Returns:
- whether the message is null, for convenience.
-
getFrameStackAsString
public static List<String> getFrameStackAsString(EolRunConfiguration config)
-
getStackTraceModuleElements
public static List<ModuleElement> getStackTraceModuleElements(EolRunConfiguration config)
-
getOperationContributors
public static Collection<OperationContributor> getOperationContributors(EolRunConfiguration config)
-
-