Package org.eclipse.epsilon.eunit
Class EUnitTest
java.lang.Object
org.eclipse.epsilon.eunit.EUnitTest
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildren
(EUnitTest child) collectLeafTests
(List selectedOperations, EUnitTestResultType resultFilter) Collects the leaf tests contained in this node with results of a particular type into a new list.void
collectLeafTests
(List selectedOperations, EUnitTestResultType resultFilter, Collection<EUnitTest> collection) Collects the leaf tests contained in this node with results of a particular type into the provided collection.int
countLeafTests
(List selectedOperations) Returns the number of leaf tests contained in this node.int
countLeafTests
(List selectedOperations, EUnitTestResultType resultFilter) Returns the number of leaf tests contained in this node with results of a particular type.Returns a string explaining all the data/model bindings used in this node, including those done in its ancestors.Returns a string explaining the bindings (for data and for models) used in this node.Returns a list of all ancestor test cases (excluding this one) with a binding.Returns the name of the test case.long
Gets the CPU time used by the test, in milliseconds.long
Gets the end time of the test, measured in nanoseconds of CPU time of the thread running the test.long
Gets the end time of the test, as returned bySystem.currentTimeMillis()
.Returns the frame stack with the state where the test failed.Returns the name of the test case as it if were a JUnit method.Returns the model bindings for this test.Returns the name of the operation, orroot
if this is the root of the test tree.int
Returns the position of this node among its siblings: 1 if it is the first one, 2 if it is the second one, and so on.getQualifiedName
(String packageName) Returns the name of this test as if it was a JUnit test method, adding the specified package at the beginning.long
Gets the start time of the test, measured in nanoseconds of CPU time of the thread running the test.long
Gets the start time of the test, as returned bySystem.currentTimeMillis()
.Returns the exception for this test case, removing all wrapping EolInternalExceptions that the Epsilon PointExecutor may have added.long
Gets the wallclock time used by the test, in milliseconds.boolean
Returnstrue
iff this test has no children.boolean
Returnstrue
iff this test is the root of the test tree.boolean
isSelected
(List selectedOperations) Returnstrue
if this test case should be run with a certain list of selected operations to be tested.void
setDataValue
(Object dataValue) void
setDataVariableName
(String dataVariable) void
setEndCpuTime
(long endCpuTime) Gets the end time of the test, measured in nanoseconds of CPU time of the thread running the test.void
setEndWallclockTime
(long endWallclockTime) Sets the end time of the test, as returned bySystem.currentTimeMillis()
.void
setException
(Exception exception) void
setFrameStack
(FrameStack frameStack) Stores the frame stack storing the state of the EOL program when the error or failure happened.void
Changes the set of model bindings for this test.void
setOperation
(Operation operation) void
void
setResult
(EUnitTestResultType result) void
setStartCpuTime
(long startCpuTime) Sets the start time of the test, measured in nanoseconds of CPU time of the thread running the test.void
setStartWallclockTime
(long startWallclockTime) Sets the start time of the test, as returned bySystem.currentTimeMillis()
.toString()
-
Field Details
-
UNSET_TIME
public static final long UNSET_TIME- See Also:
-
-
Constructor Details
-
EUnitTest
public EUnitTest()
-
-
Method Details
-
getOperation
-
setOperation
-
getResult
-
setResult
-
getException
-
setException
-
getUnwrappedInternalException
Returns the exception for this test case, removing all wrapping EolInternalExceptions that the Epsilon PointExecutor may have added. -
getParent
-
setParent
-
getDataVariableName
-
setDataVariableName
-
getDataValue
-
setDataValue
-
getChildren
-
addChildren
-
setStartCpuTime
public void setStartCpuTime(long startCpuTime) Sets the start time of the test, measured in nanoseconds of CPU time of the thread running the test. -
getStartCpuTime
public long getStartCpuTime()Gets the start time of the test, measured in nanoseconds of CPU time of the thread running the test. -
setEndCpuTime
public void setEndCpuTime(long endCpuTime) Gets the end time of the test, measured in nanoseconds of CPU time of the thread running the test. -
getEndCpuTime
public long getEndCpuTime()Gets the end time of the test, measured in nanoseconds of CPU time of the thread running the test. -
getCpuTimeMillis
public long getCpuTimeMillis()Gets the CPU time used by the test, in milliseconds. CPU time includes both user and system operations, and is much more stable than wallclock time in regards to system load. -
getStartWallclockTime
public long getStartWallclockTime()Gets the start time of the test, as returned bySystem.currentTimeMillis()
. -
setStartWallclockTime
public void setStartWallclockTime(long startWallclockTime) Sets the start time of the test, as returned bySystem.currentTimeMillis()
. -
getEndWallclockTime
public long getEndWallclockTime()Gets the end time of the test, as returned bySystem.currentTimeMillis()
. -
setEndWallclockTime
public void setEndWallclockTime(long endWallclockTime) Sets the end time of the test, as returned bySystem.currentTimeMillis()
. -
getWallclockTimeMillis
public long getWallclockTimeMillis()Gets the wallclock time used by the test, in milliseconds. -
setFrameStack
Stores the frame stack storing the state of the EOL program when the error or failure happened. This method should receive a copy of the original, so it won't be modified by the following tests. -
getFrameStack
Returns the frame stack with the state where the test failed. -
getPosition
public int getPosition()Returns the position of this node among its siblings: 1 if it is the first one, 2 if it is the second one, and so on. Returns -1 if this is the root test. -
getOperationName
Returns the name of the operation, orroot
if this is the root of the test tree. -
getCaseName
Returns the name of the test case. Includes the name of the operation and all bindings performed, in a format suited for humans "myOp (x = 1)". -
getMethodName
Returns the name of the test case as it if were a JUnit method. Uses the [n] suffixes to indicate the position among the data and model bindings. For example, "myOp[1][2]" for the myOp operation, using the first value returned by the first@data
operation and the second value returned by the second@data
operation. Note: test cases with only one model binding do not get [1] at the end, to clean up the output a bit. -
explainBinding
Returns a string explaining the bindings (for data and for models) used in this node. If no bindings have been used, returns the empty string. -
explainAllBindings
Returns a string explaining all the data/model bindings used in this node, including those done in its ancestors. If no bindings have been used, returns the empty string. -
getAllBindings
Returns a list of all ancestor test cases (excluding this one) with a binding. -
getQualifiedName
Returns the name of this test as if it was a JUnit test method, adding the specified package at the beginning.- Parameters:
packageName
- Package name (as set in the EUnitModule).
-
toString
-
countLeafTests
Returns the number of leaf tests contained in this node. Returns 1 for leaf nodes, and 1 or more for inner nodes. Takes test case filtering into account. -
countLeafTests
Returns the number of leaf tests contained in this node with results of a particular type. Returns 1 for leaf nodes, and 1 or more for inner nodes. Takes test case filtering into account. -
collectLeafTests
Collects the leaf tests contained in this node with results of a particular type into a new list. Takes test filtering into account. -
collectLeafTests
public void collectLeafTests(List selectedOperations, EUnitTestResultType resultFilter, Collection<EUnitTest> collection) Collects the leaf tests contained in this node with results of a particular type into the provided collection. Takes test filtering into account. -
isSelected
Returnstrue
if this test case should be run with a certain list of selected operations to be tested. -
isLeafTest
public boolean isLeafTest()Returnstrue
iff this test has no children. -
isRootTest
public boolean isRootTest()Returnstrue
iff this test is the root of the test tree. -
setModelBindings
Changes the set of model bindings for this test. It is a sequence of strings with an even number of elements: each consecutive pair of elements A and B indicates that model A will be an alias for model B. Therefore, if we wanted to set the default model as an alias for model X, we would use 'Sequence {"", "X"}'.- Throws:
EolRuntimeException
- The map includes a key or a value that is not a String.
-
getModelBindings
Returns the model bindings for this test. By default, no model bindings are used, and this method returnsnull
. This map cannot be changed: if you want to make changes to it, you'll need to make a copy. Trying to change it will throw anUnsupportedOperationException
.
-