Class EUnitTest

java.lang.Object
org.eclipse.epsilon.eunit.EUnitTest

public class EUnitTest extends Object
  • Field Details

  • Constructor Details

    • EUnitTest

      public EUnitTest()
  • Method Details

    • getOperation

      public Operation getOperation()
    • setOperation

      public void setOperation(Operation operation)
    • getResult

      public EUnitTestResultType getResult()
    • setResult

      public void setResult(EUnitTestResultType result)
    • getException

      public Exception getException()
    • setException

      public void setException(Exception exception)
    • getUnwrappedInternalException

      public Throwable getUnwrappedInternalException()
      Returns the exception for this test case, removing all wrapping EolInternalExceptions that the Epsilon PointExecutor may have added.
    • getParent

      public EUnitTest getParent()
    • setParent

      public void setParent(EUnitTest parent)
    • getDataVariableName

      public String getDataVariableName()
    • setDataVariableName

      public void setDataVariableName(String dataVariable)
    • getDataValue

      public Object getDataValue()
    • setDataValue

      public void setDataValue(Object dataValue)
    • getChildren

      public List<EUnitTest> getChildren()
    • addChildren

      public void addChildren(EUnitTest child)
    • 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 by System.currentTimeMillis().
    • setStartWallclockTime

      public void setStartWallclockTime(long startWallclockTime)
      Sets the start time of the test, as returned by System.currentTimeMillis().
    • getEndWallclockTime

      public long getEndWallclockTime()
      Gets the end time of the test, as returned by System.currentTimeMillis().
    • setEndWallclockTime

      public void setEndWallclockTime(long endWallclockTime)
      Sets the end time of the test, as returned by System.currentTimeMillis().
    • getWallclockTimeMillis

      public long getWallclockTimeMillis()
      Gets the wallclock time used by the test, in milliseconds.
    • setFrameStack

      public void setFrameStack(FrameStack frameStack)
      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

      public FrameStack 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

      public String getOperationName()
      Returns the name of the operation, or root if this is the root of the test tree.
    • getCaseName

      public String 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

      public String 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

      public String 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

      public 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

      public List<EUnitTest> getAllBindings()
      Returns a list of all ancestor test cases (excluding this one) with a binding.
    • getQualifiedName

      public String getQualifiedName(String packageName)
      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

      public String toString()
      Overrides:
      toString in class Object
    • countLeafTests

      public int countLeafTests(List selectedOperations)
      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.
      See Also:
    • countLeafTests

      public int countLeafTests(List selectedOperations, EUnitTestResultType resultFilter)
      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.
      See Also:
    • collectLeafTests

      public List<EUnitTest> collectLeafTests(List selectedOperations, EUnitTestResultType resultFilter)
      Collects the leaf tests contained in this node with results of a particular type into a new list. Takes test filtering into account.
      See Also:
    • 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

      public boolean isSelected(List selectedOperations)
      Returns true if this test case should be run with a certain list of selected operations to be tested.
    • isLeafTest

      public boolean isLeafTest()
      Returns true iff this test has no children.
    • isRootTest

      public boolean isRootTest()
      Returns true iff this test is the root of the test tree.
    • setModelBindings

      public void setModelBindings(ModelBindings mb) throws EolRuntimeException
      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

      public ModelBindings getModelBindings()
      Returns the model bindings for this test. By default, no model bindings are used, and this method returns null. 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 an UnsupportedOperationException.