import ballerina/test;
import ballerina/io;
@test:Config {
groups:["g1"]
}
function testFunction1 () {
io:println("I'm in test belonging to g1!");
test:assertTrue(true , msg = "Failed!");
}@test:Config {
groups:["g1","g2"]
}
function testFunction2 () {
io:println("I'm in test belonging to g1 and g2!");
test:assertTrue(true , msg = "Failed!");
}@test:Config
function testFunction3 () {
io:println("I'm the ungrouped test");
test:assertTrue(true , msg = "Failed!");
}
Testerina GroupsYou can tag your test cases with a single or multiple group names (one or more) This allows you to control the execution of selected tests. In order to execute tests belonging to a selected test group, you can name the test groups to be executed when you run tests. In the same way you can exclude executing tests. |
|
import ballerina/test;
import ballerina/io;
|
|
@test:Config {
groups:["g1"]
}
function testFunction1 () {
io:println("I'm in test belonging to g1!");
test:assertTrue(true , msg = "Failed!");
}
|
Test function |
@test:Config {
groups:["g1","g2"]
}
function testFunction2 () {
io:println("I'm in test belonging to g1 and g2!");
test:assertTrue(true , msg = "Failed!");
}
|
|
@test:Config
function testFunction3 () {
io:println("I'm the ungrouped test");
test:assertTrue(true , msg = "Failed!");
}
|
|
$ ballerina test testerina-groups.bal --groups g1,g2
---------------------------------------------------------------------------
T E S T S
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Running Tests of Package: .
---------------------------------------------------------------------------
I'm in test belonging to g1 and g2!
I'm in test belonging to g1!
|
|
Tests run: 2, Passed: 2, Failures: 0, Skipped: 0 - in TestSuite
|
|
---------------------------------------------------------------------------
Results:
|
|
Tests run: 2, Passed: 2, Failures: 0, Skipped: 0
---------------------------------------------------------------------------
Summary:
................................................................... SUCCESS
---------------------------------------------------------------------------
|
|
$ ballerina test testerina-groups.bal --groups g1
---------------------------------------------------------------------------
T E S T S
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Running Tests of Package: .
---------------------------------------------------------------------------
I'm in test belonging to g1 and g2!
|
|
Tests run: 1, Passed: 1, Failures: 0, Skipped: 0 - in TestSuite
|
|
---------------------------------------------------------------------------
Results:
|
|
Tests run: 1, Passed: 1, Failures: 0, Skipped: 0
---------------------------------------------------------------------------
Summary:
|
|
................................................................... SUCCESS
---------------------------------------------------------------------------
|
|
$ ballerina test testerina-groups.bal --groups default
---------------------------------------------------------------------------
T E S T S
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Running Tests of Package: .
---------------------------------------------------------------------------
I'm the ungrouped test
|
|
Tests run: 1, Passed: 1, Failures: 0, Skipped: 0 - in TestSuite
|
|
---------------------------------------------------------------------------
Results:
|
|
Tests run: 1, Passed: 1, Failures: 0, Skipped: 0
---------------------------------------------------------------------------
Summary:
................................................................... SUCCESS
---------------------------------------------------------------------------
|
|
$ ballerina test testerina-groups.bal --exclude-groups g2
|
|
---------------------------------------------------------------------------
T E S T S
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Running Tests of Package: .
---------------------------------------------------------------------------
I'm the ungrouped test
I'm in test belonging to g1!
|
|
Tests run: 2, Passed: 2, Failures: 0, Skipped: 0 - in TestSuite
|
|
---------------------------------------------------------------------------
Results:
|
|
Tests run: 2, Passed: 2, Failures: 0, Skipped: 0
---------------------------------------------------------------------------
Summary:
................................................................... SUCCESS
---------------------------------------------------------------------------
|
|