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 GCC project (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

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}'

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

  • suiteName – name of the test suite.
  • preMerge – whether the test suite is included in the builds which run on all branches except for the default branch.
  • postMerge – whether the test suite is included in the builds which run on the default branch.
Example response
{
...
"gunitServerTests": {
...
"suites": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"preMerge": true,
"postMerge": false
}
],
},
"gunitSmokeTests": {
...
"suites": [
{
"suiteName": "com.guidewire.test.ExampleSuite",
"preMerge": true,
"postMerge": false
}
],
},
"behaviorTests": {
...
"suites": [
{
"suiteName": "com.guidewire.test.ExampleSuite",
"preMerge": true,
"postMerge": false
}
],
},
}

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 behaviourTests.

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/suites/-",
"value": {
"suiteName": "gw.suites.SomeTestSuite",
"preMerge": false,
"postMerge": true
}
}
]

For a successful request, you will 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 the ellipsis next to the Run button.
  2. Open the Parameters tab.
  3. Check the values of the post_merge_suite_names and pre_merge_suite_names parameters:

Names of test suites in TeamCity


Modify test suites

You can modify the values of preMerge and postMerge parameters 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": {
...
"suites": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"preMerge": true,
"postMerge": false
},
{
"suiteName": "gw.suites.SomeTestSuite",
"preMerge": false,
"postMerge": true
}
],
....
},
...
}

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 preMerge and postMerge parameters for selected suites.

For example, to modify the previously configured gw.suites.SomeTestSuite test suite to run on all branches, change preMerge to true:

Request body
[
{
"op": "replace",
"path": "/gunitServerTests/suites",
"value": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"preMerge": true,
"postMerge": false
},
{
"suiteName": "gw.suites.SomeTestSuite",
"preMerge": true,
"postMerge": true
}
]
}
]

For a successful request, you will 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 the ellipsis next to the Run button.
  2. Open the Parameters tab.
  3. Check the values of the post_merge_suite_names and pre_merge_suite_names parameters:

Modified confoguration in TeamCity


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": {
...
"suites": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"preMerge": true,
"postMerge": false
},
{
"suiteName": "gw.suites.SomeTestSuite",
"preMerge": true,
"postMerge": true
}
],
....
},
...
}

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/suites",
"value": [
{
"suiteName": "gw.suites.PCExampleServerSuite",
"preMerge": true,
"postMerge": false
}
]
}
]

For a successful request, you will 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 the ellipsis next to the Run button.
  2. Open the Parameters tab.
  3. Check the values of the post_merge_suite_names and pre_merge_suite_names parameters:

Parameters after removal of example suite