Class TestReport


  • public class TestReport
    extends java.lang.Object
    A test report captures the description and results of a test.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String description
      The test description.
      protected java.lang.String name
      The test name .
      protected java.lang.String reason
      The failure reason.
      protected boolean succeeded
      The test success.
    • Constructor Summary

      Constructors 
      Constructor Description
      TestReport()
      Create a new test report.
      TestReport​(java.lang.String name, java.lang.String description)
      Create a new test report.
      TestReport​(java.lang.String name, java.lang.String description, boolean succeded, java.lang.String reason)
      Create a new test report.
      TestReport​(java.lang.String name, java.lang.String description, java.lang.Exception reason)
      Create a new test report.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription()
      Get the description.
      java.lang.String getName()
      Get the name.
      java.lang.String getReason()
      Get the failure reason.
      boolean isFinished()
      Is the test finished, i.e.
      boolean isSucceeded()
      Has the test succeeded.
      void setDescription​(java.lang.String description)
      Set the description.
      void setFailed​(java.lang.Exception reason)
      Set the report result to failed and set the failure reason.
      void setFailed​(java.lang.String reason)
      Set the report result to failed and set the failure reason.
      void setName​(java.lang.String name)
      Set the name.
      void setReason​(java.lang.String reason)
      Set the failure reason.
      void setSucceeded​(boolean succeded)
      Set the test success.
      java.lang.String toString()
      Returns a string representation of the object.
      • Methods inherited from class java.lang.Object

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

      • name

        protected java.lang.String name
        The test name .
      • description

        protected java.lang.String description
        The test description.
      • succeeded

        protected boolean succeeded
        The test success.
      • reason

        protected java.lang.String reason
        The failure reason.
    • Constructor Detail

      • TestReport

        public TestReport()
        Create a new test report.
      • TestReport

        public TestReport​(java.lang.String name,
                          java.lang.String description)
        Create a new test report.
      • TestReport

        public TestReport​(java.lang.String name,
                          java.lang.String description,
                          boolean succeded,
                          java.lang.String reason)
        Create a new test report.
      • TestReport

        public TestReport​(java.lang.String name,
                          java.lang.String description,
                          java.lang.Exception reason)
        Create a new test report.
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name.
        Returns:
        The name.
      • setName

        public void setName​(java.lang.String name)
        Set the name.
        Parameters:
        name - The name.
      • getDescription

        public java.lang.String getDescription()
        Get the description.
        Returns:
        The description.
      • setDescription

        public void setDescription​(java.lang.String description)
        Set the description.
        Parameters:
        description - The description.
      • isSucceeded

        public boolean isSucceeded()
        Has the test succeeded.
        Returns:
        True, if test was successful.
      • isFinished

        public boolean isFinished()
        Is the test finished, i.e. failed or succeeded?
      • setSucceeded

        public void setSucceeded​(boolean succeded)
        Set the test success.
        Parameters:
        succeded - True on success.
      • getReason

        public java.lang.String getReason()
        Get the failure reason.
        Returns:
        The failure reason.
      • setReason

        public void setReason​(java.lang.String reason)
        Set the failure reason.
        Parameters:
        reason - The failure reason.
      • setFailed

        public void setFailed​(java.lang.Exception reason)
        Set the report result to failed and set the failure reason.
        Parameters:
        reason - The failure reason.
      • setFailed

        public void setFailed​(java.lang.String reason)
        Set the report result to failed and set the failure reason.
        Parameters:
        reason - The failure reason.
      • toString

        public java.lang.String toString()
        Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the object.