Libraries.Testing.Tester Documentation

This class provides us a test platform for running tests on our system. There are two ways to use it. First, if we provide it a Test object, we can call Run, which will execute the test on our system and keep track of whether or not the test passed. Second, if we prefer to run the computation on our own, we can pass a test object through Add, which already stores its pass or fail flag. Depending on the result, if a test passes, the system places it in a list of passed tests. If the test fails, it places it in a list of failed tests. This allows the system to keep a running tally of the total and provide output for the result.

Example Code

use Libraries.Testing.Tester
use Libraries.Testing.Test

Tester tests

Test result
result:SetMessage("This is a failed test.")

tests:Add(result)

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(Libraries.Testing.Test test)This action assumes a test has already been evaluated and adds it to the results for this run of the test suite.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetFailedTestsIterator()Returns an iterator over the passing tests.
GetFailingSize()Returns the number of failing tests.
GetHashCode()This action gets the hash code for an object.
GetPassedTestsIterator()Returns an iterator over the passing tests.
GetPassingSize()Returns the number of passing tests.
GetSize()Returns the total number of tests.
Run(Libraries.Testing.Test test)This action executes the test in question and tracks whether or not it passed.

Actions Documentation

Add(Libraries.Testing.Test test)

This action assumes a test has already been evaluated and adds it to the results for this run of the test suite.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        tests:Add(result)

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetFailedTestsIterator()

Returns an iterator over the passing tests.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        Iterator<Test> iterator = tests:GetFailedTestsIterator()
        repeat while iterator:HasNext()
            Test value = iterator:Next()
            output value:GetMessage()
        end

Return

Libraries.Containers.Iterator: an Iterator

GetFailingSize()

Returns the number of failing tests.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        output tests:GetFailingSize() //1

Return

integer: the number of failing tests.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetPassedTestsIterator()

Returns an iterator over the passing tests.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        Iterator<Test> iterator = tests:GetPassedTestsIterator()
        repeat while iterator:HasNext()
            Test value = iterator:Next()
            output value:GetMessage()
        end

Return

Libraries.Containers.Iterator: an Iterator

GetPassingSize()

Returns the number of passing tests.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        output tests:GetPassingSize() //0

Return

integer: the number of passing tests.

GetSize()

Returns the total number of tests.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        output tests:GetSize() //1

Return

integer: the number of total tests.

Run(Libraries.Testing.Test test)

This action executes the test in question and tracks whether or not it passed.

Example Code

use Libraries.Testing.Tester
        use Libraries.Testing.Test
        
        Tester tests
        
        Test result
        result:SetMessage("This is a failed test.")
        
        tests:Add(result)

Parameters