See the supported connectors for Application Integration.

Create test cases

This document describes how to create test cases for your integrations. For information about test cases, supported test configurations, and its limitations, see Introduction to test cases.

Before you begin

  • To get the permission that you need to create test cases, ask your administrator to grant you the Application Integration Editor (roles/integrations.integrationEditor) IAM role on project. For more information about granting roles, see Manage access to projects, folders, and organizations.

    This predefined role contains the integrations.googleapis.com/testCases.create permission, which is required to create test cases.

    You might also be able to get this permission with custom roles or other predefined roles.

  • Ensure that your integration is in the DRAFT state. If your integration is in the PUBLISHED state, click Enable Editing. A new version in the DRAFT state is created in the integration for you. The following figure shows the edit lock in the integration editor.

    Integrations edit lock Integrations edit lock

Create a test case

To create a test case, select one of the following options:

Console

  1. In the Google Cloud console, go to the Application Integration page.

    Go to Application Integration

  2. In the navigation menu, click Integrations.

    The Integrations page appears listing all the integrations available in the Google Cloud project.

  3. Select an existing integration for which you want to create a test.

    This opens the integration in the integration editor.

  4. Click Test Case and then click + Create a new test case. The Create test case pane appears:

    image showing the Create  test case pane iimage showing the Create test case pane

    Then, do the following:

    1. From the Trigger list, select a trigger.
    2. In the Test name field, enter a name for your test.
    3. Optionally, in the Description field, enter a description for your test.
    4. Click Create.

      In the Integration editor page, the designer canvas displays Test case mode is active.

  5. Configure the test configuration for your trigger and tasks.

API

Call the projects.locations.integrations.versions.testCases.create method and provide any relevant parameters. For example:

POST https://integrations.googleapis.com/v1/{parent=projects/PROJECT_ID/locations/LOCATION/integrations/INTEGRATION_NAME/versions/INTEGRATION_VERSION}/testCases

Replace the following:

  • PROJECT_ID: the ID of the Google Cloud project
  • LOCATION: the region where the integration is located
  • INTEGRATION_NAME: the name of the integration
  • INTEGRATION_VERSION: the version of the integration

The request body contains the TestCase resource. For example:

 
{
    "displayName": "example-test-case",
    "triggerId": "api_trigger/example-trigger",
    "testTaskConfigs": [{
      "taskNumber": "1",
      "mockConfig": {
        "mockStrategy": "NO_MOCK_STRATEGY"
      },
      "task": "FieldMappingTask"
    }],
}

Configure test configurations

After creating a test case, you can configure test configurations for your triggers and tasks.

What's next