Skip to content

Testing

BI has a built-in robust test framework, which allows you to ensure that your applications are reliable. The Ballerina-powered test framework provides support for assertions, data providers, mocking, and code coverage features, which enable programmers to write comprehensive tests.

Test a simple function

Follow the steps below to get started with testing in your BI project.

1. Create a BI Project Open WSO2 BI and create a new project. Add an artifact of type automation to your project.

2. Add a Sample Function In the generated main.bal file, add the following function:

public function intAdd(int a, int b) returns int {
    return a + b;
}

3. Create a Unit Test Navigate to the Testing extension from the left-hand navigation panel. Create a new unit test and include an assertion to validate the output of the intAdd function.

4. Run the Tests Use the Run Test option to execute the newly added test case, or choose to run all the tests under the DEFAULT_GROUP.

Testing a simple function

For further details on the Ballerina test framework, you can refer to Ballerina Testing Guide.