Functions of ballerina.test package
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | boolean | Actual boolean value |
expected | boolean | Expected boolean value |
errorMessage | string | Assertion error message |
function assertFail(string errorMessage)
Assert failure is triggered based on user discretion. AssertError is thrown with the given errorMessage
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
errorMessage | string | Assertion error message |
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
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
condition | boolean | Boolean condition to evaluate |
errorMessage | string | Assertion error message |
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | float[] | Actual float array |
expected | float[] | Expected float array |
errorMessage | string | Assertion error message |
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | float | Actual float value |
expected | float | Expected float value |
errorMessage | string | Assertion error message |
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | int[] | Actual integer array |
expected | int[] | Expected integer array |
errorMessage | string | Assertion error message |
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | int | Actual integer value |
expected | int | Expected integer value |
errorMessage | string | Assertion error message |
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | string[] | Actual string array |
expected | string[] | Expected string array |
errorMessage | string | Assertion error message |
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.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
actual | string | Actual string value |
expected | string | Expected string value |
errorMessage | string | Assertion error message |
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
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
condition | boolean | Boolean condition to evaluate |
errorMessage | string | Assertion error message |
function createBallerinaError(string errorMessage, string category) (AssertError )
Creates a AssertError with custom message and category
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
errorMessage | string | Custom message for the ballerina error |
category | string | error category |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
AssertError |
function startService(string serviceName) (string )
Starts the service specified in the 'serviceName' argument
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
serviceName | string | Name of the service to start |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string |
Structs of ballerina.test package
struct AssertError
Fields:
Field Name | Data Type | Description |
---|---|---|
msg | string | |
cause | error | |
stackTrace | stackFrame[] | |
category | string |