Skip to main content

Configure test suites

You can use CI/CD Manager API to configure default test suites for Server Tests, Smoke Tests, and Behavior Tests builds.

All sample requests in this guide include the following path parameters:

Parameter nameDescription
tenantIdTenant ID.
starSystemIdID of the star system (physical star system) that includes the InsuranceSuite application for which you modify the CI/CD configuration.
applicationIdInsuranceSuite application which includes the build. For example:
- PC for PolicyCenter
- BC for BillingCenter
- CC for ClaimCenter
- CM for ContactManager

Note:

In the request URLs, substitute {baseUrl} with the correct URL for your region. For details, see Base URLs.

Get configuration

To retrieve a list of currently configured test suites, send the following GET request:

curl -X 'GET' \
'{baseUrl}/api/v2/tenants/{tenantId}/starsystems/{starSystemId}/cicd-configs/{applicationId}/insurer-config' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'

The response contains a JSON object with the CI/CD configuration for the selected InsuranceSuite application. For each build, check the suites parameter in testSuitesConfig object. It contains the following details of the configured test suites:

  • suiteName – name of the test suite.
  • branchRules - a parameter with information about rules for matching the test suite for branches. It consists of the following lists:
    • include - a list of branches or branch patterns for which the specified suite should be included in the test builds.
    • exclude - a list of branches or branch patterns for which the specified suite should be excluded from running in the test builds.
Note:

For branch patterns in include and exclude parameters, * is the only allowed wildcard which means zero or more characters. For example:

  • * as all branches.
  • release/* as branches that are starting with release/.
  • *-test as branches that are ending with -test.

Additionally, testSuitesConfig contains the runCompileOnEmptySuitesList parameter. This parameter shows if a code compilation of InsuranceSuite applications should be executed when there are no matching test suites for a branch or a branch pattern.

Example response
{
...
"gunitServerTests": {
...,
"testSuitesConfig": {
"runCompileOnEmptySuitesList": true,
"suites": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
}
]
},
},
"gunitSmokeTests": {
...,
"testSuitesConfig": {
"runCompileOnEmptySuitesList": true,
"suites": [
{
"suiteName": "com.guidewire.test.ExampleSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
}
]
},
},
"behaviorTests": {
...,
"testSuitesConfig": {
"runCompileOnEmptySuitesList": true,
"suites": [
{
"suiteName": "com.guidewire.test.ExampleSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
}
]
},
},
}

Add test suites

To add a new test suite to a build, send the following PATCH request:

curl -X 'PATCH' \
'{baseUrl}/api/v2/tenants/{tenantId}/starsystems/{starSystemId}/cicd-configs/{applicationId}/insurer-config' \
-H 'Accept: */*' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json-patch+json' \
-d '{body}'

Where {body} contains the suite configuration:

  • Follow the JSON Patch format.
  • For Server Tests, use gunitServerTests.
  • For Smoke Tests, use gunitSmokeTests.
  • For Behavior Tests, use behaviorTests.

For example, to add a test suite to the Server Tests build but include it only when the build runs on the default branch, use the following:

Request body
[
{
"op": "add",
"path": "/gunitServerTests/testSuitesConfig/suites/-",
"value": {
"suiteName": "gw.suites.SomeTestSuite",
"branchRules": {
"include": ["master"],
"exclude": []
}
}
}
]

For a successful request, you'll receive the 200 status code.

Verify changes in TeamCity

Once you add test suites to a build, you can verify the new configuration in TeamCity:

  1. Go to the modified build and select Run.

    TeamCity will run the build.

  2. In the Build Log tab, check the progression of the TeamCity build.

    You can see which suites are being run and for which branches.

Note:

It might take a few minutes for the changes to be applied to the build.

TeamCity interface with the test suite settings highlighted.


Modify test suites

You can modify the include and exclude branch rules for the already configured test suites.

First, get the current configuration for a selected build. Because of the JSON Patch format, you must take the entire value of the suites parameter, even if you only modify a single test suite:

Example configuration
{
...
"gunitServerTests": {
...
"testSuitesConfig": {
...
"suites": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
},
{
"suiteName": "gw.suites.SomeTestSuite",
"branchRules": {
"include": ["master"],
"exclude": []
}
}
],
...
},
....
},
...
}

Then, send the following PATCH request:

curl -X 'PATCH' \
'{baseUrl}/api/v2/tenants/{tenantId}/starsystems/{starSystemId}/cicd-configs/{applicationId}/insurer-config' \
-H 'Accept: */*' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json-patch+json' \
-d '{body}'

Where {body} contains an updated configuration. Follow the JSON Patch format:

  • For value, insert a list of test suites.
  • Modify the values of include and exclude parameters for the selected suites.

For example, to modify the previously configured gw.suites.SomeTestSuite test suite to run on all the branches, change include to contain * and make exclude an empty array:

Request body
[
{
"op": "replace",
"path": "/gunitServerTests/testSuitesConfig/suites",
"value": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
},
{
"suiteName": "gw.suites.SomeTestSuite",
"branchRules": {
"include": ["*"],
"exclude": []
}
}
]
}
]

For a successful request, you'll receive the 200 status code.

Verify changes in TeamCity

Once you modify test suite parameters, you can verify the new configuration in TeamCity:

  1. Go to the modified build and select Run.

    TeamCity will run the build.

  2. In the Build Log tab, check the progression of the TeamCity build.

    You can see which suites are being run and for which branches.

Note:

It might take a few minutes for the changes to be applied to the build.

TeamCity build log view with the modified suites highlighted.


Remove test suites

You can also remove test suites from a build.

First, get the current configuration for a selected build. Because of the JSON Patch format, you must take the entire value of the suites parameter, even if you only remove a single test suite:

{
...
"gunitServerTests": {
...
"testSuitesConfig": {
...
"suites": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
},
{
"suiteName": "gw.suites.SomeTestSuite",
"branchRules": {
"include": ["*"],
"exclude": []
}
}
],
...
},
....
},
...
}

Then, send the following PATCH request:

curl -X 'PATCH' \
'{baseUrl}/api/v2/tenants/{tenantId}/starsystems/{starSystemId}/cicd-configs/{applicationId}/insurer-config' \
-H 'Accept: */*' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json-patch+json' \
-d '{body}'

Where {body} contains an updated configuration:

  • Follow the JSON Patch format.
  • For value, insert the list of test suites you want to keep.

For example, if the Server Tests build has two suites configured: gw.suites.PCExampleServerSuite and gw.suites.SomeTestSuite, and you want to remove gw.suites.SomeTestSuite, the request body might like this:

Request body
[
{
"op": "replace",
"path": "/gunitServerTests/testSuitesConfig/suites",
"value": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"branchRules": {
"include": ["*"],
"exclude": ["master"]
}
}
]
}
]

For a successful request, you'll receive the 200 status code.

Verify changes in TeamCity

Once you remove a test suite, you can verify the new configuration in TeamCity:

  1. Go to the modified build and select Run.

    TeamCity will run the build.

  2. In the Build Log tab, check the progression of the TeamCity build.

    You can see which suites are being run and for which branches.

Note:

It might take a few minutes for the changes to be applied to the build.

TeamCity build log steps after the removal of a suite.

Set the code compilation

By default, the compilation of an InsuranceSuite application is always executed. This rule applies even when no test suites match a branch on which the tests are executed.

To control this behavior, send the following PATCH request:

curl -X 'PATCH' \
'{baseUrl}/api/v2/tenants/{tenantId}/starsystems/{starSystemId}/cicd-configs/{applicationId}/insurer-config' \
-H 'Accept: */*' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json-patch+json' \
-d '{body}'

Where {body} contains an updated configuration:

  • Follow the JSON Patch format.
  • For Server Tests, use gunitServerTests.
  • For Smoke Tests, use gunitSmokeTests.
  • For Behavior Tests, use behaviorTests.

For example, to disable compilation when no test suites are matching for Server Tests, use the following:

Request body
[
{
"op": "replace",
"path": "/gunitServerTests/testSuitesConfig/runCompileOnEmptySuitesList",
"value": false
}
]

For a successful request, you'll receive the 200 status code.

Verify changes in TeamCity

To verify changes in TeamCity, do the following:

  1. Go to the modified build and select the ellipsis next to the Run button.
  2. Open the Parameters tab.
  3. Check if run_compile_on_empty_suite_list is selected:

TeamCity interface with the run compile setting highlighted.