ballerina.test package

public struct AssertError

The error struct for assertion errors

Field Name Data Type Description Default Value
msg string The assertion error message
cause error The assertion error message
stackTrace StackFrame[] The assertion error message
category string The assertion error message

public function assertBooleanEquals ( boolean actual , boolean expected , string errorMessage )

Asserts whether the given boolean values are equal. If it is not, a AssertError is thrown with the given errorMessage.

Parameter Name Data Type Description
actual boolean Actual boolean value
expected boolean Expected boolean value
errorMessage string Assertion error message

public function assertFail ( string errorMessage )

Assert failure is triggered based on user discretion. AssertError is thrown with the given errorMessage

Parameter Name Data Type Description
errorMessage string Assertion error message

public function assertFalse ( boolean condition , string errorMessage )

Asserts whether the given condition is false. If it is not, a AssertError is thrown with the given errorMessage

Parameter Name Data Type Description
condition boolean Boolean condition to evaluate
errorMessage string Assertion error message

public function assertFloatArrayEquals ( float[] actual , float[] expected , string errorMessage )

Asserts whether the given float arrays are equal. If it is not, a AssertError is thrown with the given errorMessage including differed float values and array index.

Parameter Name Data Type Description
actual float[] Actual float array
expected float[] Expected float array
errorMessage string Assertion error message

public function assertFloatEquals ( float actual , float expected , string errorMessage )

Asserts whether the given float values are equal. If it is not, a AssertError is thrown with the given errorMessage.

Parameter Name Data Type Description
actual float Actual float value
expected float Expected float value
errorMessage string Assertion error message

public function assertIntArrayEquals ( int[] actual , int[] expected , string errorMessage )

Asserts whether the given integer arrays are equal. If it is not, a AssertError is thrown with the given errorMessage including differed integer values and array index.

Parameter Name Data Type Description
actual int[] Actual integer array
expected int[] Expected integer array
errorMessage string Assertion error message

public function assertIntEquals ( int actual , int expected , string errorMessage )

Asserts whether the given integer values are equal. If it is not, a AssertError is thrown with the given errorMessage.

Parameter Name Data Type Description
actual int Actual integer value
expected int Expected integer value
errorMessage string Assertion error message

public function assertStringArrayEquals ( string[] actual , string[] expected , string errorMessage )

Asserts whether the given string arrays are equal. If it is not, a AssertError is thrown with the given errorMessage including differed string values and array index.

Parameter Name Data Type Description
actual string[] Actual string array
expected string[] Expected string array
errorMessage string Assertion error message

public function assertStringEquals ( string actual , string expected , string errorMessage )

Asserts whether the given string values are equal. If it is not, a AssertError is thrown with the given errorMessage.

Parameter Name Data Type Description
actual string Actual string value
expected string Expected string value
errorMessage string Assertion error message

public function assertTrue ( boolean condition , string errorMessage )

Asserts whether the given condition is true. If it is not, a AssertError is thrown with the given errorMessage

Parameter Name Data Type Description
condition boolean Boolean condition to evaluate
errorMessage string Assertion error message

public function createBallerinaError ( string errorMessage , string category ) ( AssertError )

Creates an AssertError with custom message and category

Parameter Name Data Type Description
errorMessage string Custom message for the ballerina error
category string error category

public function startService ( string serviceName ) ( string )

Starts the service specified in the 'serviceName' argument

Parameter Name Data Type Description
serviceName string Name of the service to start