Class EUnitTest


  • public class EUnitTest
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long UNSET_TIME  
    • Constructor Summary

      Constructors 
      Constructor Description
      EUnitTest()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChildren​(EUnitTest child)  
      java.util.List<EUnitTest> collectLeafTests​(java.util.List selectedOperations, EUnitTestResultType resultFilter)
      Collects the leaf tests contained in this node with results of a particular type into a new list.
      void collectLeafTests​(java.util.List selectedOperations, EUnitTestResultType resultFilter, java.util.Collection<EUnitTest> collection)
      Collects the leaf tests contained in this node with results of a particular type into the provided collection.
      int countLeafTests​(java.util.List selectedOperations)
      Returns the number of leaf tests contained in this node.
      int countLeafTests​(java.util.List selectedOperations, EUnitTestResultType resultFilter)
      Returns the number of leaf tests contained in this node with results of a particular type.
      java.lang.String explainAllBindings()
      Returns a string explaining all the data/model bindings used in this node, including those done in its ancestors.
      java.lang.String explainBinding()
      Returns a string explaining the bindings (for data and for models) used in this node.
      java.util.List<EUnitTest> getAllBindings()
      Returns a list of all ancestor test cases (excluding this one) with a binding.
      java.lang.String getCaseName()
      Returns the name of the test case.
      java.util.List<EUnitTest> getChildren()  
      long getCpuTimeMillis()
      Gets the CPU time used by the test, in milliseconds.
      java.lang.Object getDataValue()  
      java.lang.String getDataVariableName()  
      long getEndCpuTime()
      Gets the end time of the test, measured in nanoseconds of CPU time of the thread running the test.
      long getEndWallclockTime()
      Gets the end time of the test, as returned by System.currentTimeMillis().
      java.lang.Exception getException()  
      FrameStack getFrameStack()
      Returns the frame stack with the state where the test failed.
      java.lang.String getMethodName()
      Returns the name of the test case as it if were a JUnit method.
      ModelBindings getModelBindings()
      Returns the model bindings for this test.
      Operation getOperation()  
      java.lang.String getOperationName()
      Returns the name of the operation, or root if this is the root of the test tree.
      EUnitTest getParent()  
      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.
      java.lang.String getQualifiedName​(java.lang.String packageName)
      Returns the name of this test as if it was a JUnit test method, adding the specified package at the beginning.
      EUnitTestResultType getResult()  
      long getStartCpuTime()
      Gets the start time of the test, measured in nanoseconds of CPU time of the thread running the test.
      long getStartWallclockTime()
      Gets the start time of the test, as returned by System.currentTimeMillis().
      long getWallclockTimeMillis()
      Gets the wallclock time used by the test, in milliseconds.
      boolean isLeafTest()
      Returns true iff this test has no children.
      boolean isRootTest()
      Returns true iff this test is the root of the test tree.
      boolean isSelected​(java.util.List selectedOperations)
      Returns true if this test case should be run with a certain list of selected operations to be tested.
      void setDataValue​(java.lang.Object dataValue)  
      void setDataVariableName​(java.lang.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 by System.currentTimeMillis().
      void setException​(java.lang.Exception exception)  
      void setFrameStack​(FrameStack frameStack)
      Stores the frame stack storing the state of the EOL program when the error or failure happened.
      void setModelBindings​(ModelBindings mb)
      Changes the set of model bindings for this test.
      void setOperation​(Operation operation)  
      void setParent​(EUnitTest parent)  
      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 by System.currentTimeMillis().
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • EUnitTest

        public EUnitTest()
    • Method Detail

      • getOperation

        public Operation getOperation()
      • setOperation

        public void setOperation​(Operation operation)
      • getException

        public java.lang.Exception getException()
      • setException

        public void setException​(java.lang.Exception exception)
      • setParent

        public void setParent​(EUnitTest parent)
      • getDataVariableName

        public java.lang.String getDataVariableName()
      • setDataVariableName

        public void setDataVariableName​(java.lang.String dataVariable)
      • getDataValue

        public java.lang.Object getDataValue()
      • setDataValue

        public void setDataValue​(java.lang.Object dataValue)
      • getChildren

        public java.util.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 java.lang.String getOperationName()
        Returns the name of the operation, or root if this is the root of the test tree.
      • getCaseName

        public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.util.List<EUnitTest> getAllBindings()
        Returns a list of all ancestor test cases (excluding this one) with a binding.
      • getQualifiedName

        public java.lang.String getQualifiedName​(java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • countLeafTests

        public int countLeafTests​(java.util.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:
        collectLeafTests(List, EUnitTestResultType)
      • countLeafTests

        public int countLeafTests​(java.util.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(List, EUnitTestResultType)
      • collectLeafTests

        public void collectLeafTests​(java.util.List selectedOperations,
                                     EUnitTestResultType resultFilter,
                                     java.util.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​(java.util.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.