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 java.lang.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 java.util.Map<java.lang.Integer,EolRunConfiguration>
expectedConfigIDs
Used to identify which scenario to compare our results with.protected static java.util.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 java.util.List<java.lang.String>
getFrameStackAsString(EolRunConfiguration config)
static java.util.Collection<OperationContributor>
getOperationContributors(EolRunConfiguration config)
static java.util.List<ModuleElement>
getStackTraceModuleElements(EolRunConfiguration config)
protected boolean
onFail(java.lang.String message)
Actions to perform if the message isnull
.protected static void
setUpEquivalenceTest(java.util.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 java.util.Collection<? extends EolRunConfiguration> expectedConfigs
The oracle configurations
-
expectedConfigIDs
protected static java.util.Map<java.lang.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(java.util.Collection<? extends EolRunConfiguration> expectedConfs)
This should be called insetUpBeforeClass()
.- Parameters:
expectedConfs
- The oracle configurations.
-
_0test0
public abstract void _0test0() throws java.lang.Exception
Subclasses should simply callbeforeTests()
in this method. Additional setup functionality may also be provided here.- Throws:
java.lang.Exception
-
zzz_AfterAll
public void zzz_AfterAll() throws java.lang.Exception
- Throws:
java.lang.Exception
-
afterClass
public static void afterClass() throws java.lang.Exception
- Throws:
java.lang.Exception
-
beforeTests
protected final void beforeTests() throws java.lang.Exception
Pre-requisite for testing.- Throws:
java.lang.Exception
-
onFail
protected boolean onFail(java.lang.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.
-
testModuleCanExecute
protected void testModuleCanExecute() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testScenariosMatch
protected void testScenariosMatch() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getFrameStackAsString
public static java.util.List<java.lang.String> getFrameStackAsString(EolRunConfiguration config)
-
testFrameStacks
public void testFrameStacks() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getStackTraceModuleElements
public static java.util.List<ModuleElement> getStackTraceModuleElements(EolRunConfiguration config)
-
testExecutorFactories
public void testExecutorFactories() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getOperationContributors
public static java.util.Collection<OperationContributor> getOperationContributors(EolRunConfiguration config)
-
testOperationContributorRegistries
public void testOperationContributorRegistries() throws java.lang.Exception
- Throws:
java.lang.Exception
-
-