# Test and publish integrations


You can test or publish an integration from the [integration editor](https://docs.cloud.google.com/application-integration/docs/integrations-ui-layout) after you have added and configured the integration with the necessary [triggers](https://docs.cloud.google.com/application-integration/docs/trigger-overview), [tasks](https://docs.cloud.google.com/application-integration/docs/task-overview), and [edge](https://docs.cloud.google.com/application-integration/docs/edge-overview) connections. When you test an integration using the Google Cloud console, the integration is executed in the [synchronous mode](https://docs.cloud.google.com/application-integration/docs/triggers.md.txt#execution-modes).

## Required roles


To get the permissions that
you need to test or publish an integration,

ask your administrator to grant you the
following IAM roles on the project:

- Test an integration: [Application Integration Invoker](https://docs.cloud.google.com/iam/docs/roles-permissions/integrations.md.txt#integrations.integrationInvoker) (`roles/integrations.integrationInvoker`)
- Publish an integration: [Application Integration Deployer](https://docs.cloud.google.com/iam/docs/roles-permissions/integrations.md.txt#integrations.integrationDeployer) (`roles/integrations.integrationDeployer`)


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


These predefined roles contain

the permissions required to test or publish an integration. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to test or publish an integration:

- Test an integration: `integrations.integrations.invoke`
- Publish an integration: `integrations.integrationVersions.deploy`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

The Application Integration Editor (`roles/integrations.integrationEditor`) role
contains both permissions.

If the integration uses a run-as service account, you also need the Service Account User
(`roles/iam.serviceAccountUser`) role on that service account to test or publish it.
See [Grant Service
Account User](https://docs.cloud.google.com/application-integration/docs/authorization-changes-grant-access).

## Test an integration


Optionally, if you want to verify that your integration is working as intended, you can test it before publishing. Testing an integration lets you experiment with the integration input variable values, and helps in identifying any faults in the integration connection flow.


> [!NOTE]
> **Note:** Integrations that are configured with suspension-based tasks, such as [Approval task](https://docs.cloud.google.com/application-integration/docs/approval-task), [Suspend task](https://docs.cloud.google.com/application-integration/docs/run-suspend-task), or [Timer task](https://docs.cloud.google.com/application-integration/docs/run-timer-task), cannot be tested before [publishing](https://docs.cloud.google.com/application-integration/docs/test-publish-integrations.md.txt#publish-integrations) the integration.

<br />


To test run an integration, select one of the following options:

### Console

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

   [Go to Application Integration](https://console.cloud.google.com/integrations)
2. Click **Integrations** from the left navigation menu to open the **Integrations** page.
3. Select the integration that you want to test. <br />

4. In the designer navigation bar, click **Test** .


   If you have multiple triggers configured in your integration, then select the trigger from which you want to
   test run your integration. The **Test Integration** pane appears.
5. Click **Test integration** .


   Application Integration test runs the integration and displays the execution result in the **Test Integration** pane:
   - To edit the input variables, click **Edit input variables**.
   - To retest the integration, click **Retest integration**.
   - To restore the values, click **Restore values**.
   - To view and inspect the [execution logs](https://docs.cloud.google.com/application-integration/docs/viewing-logs) of the test run, click **View logs**.
   - If you have [enabled Cloud Logging](https://docs.cloud.google.com/application-integration/docs/cloud-logging.md.txt#enable-cloud-logging), then to view logs in Cloud Logging, click **View Cloud logs**.
   - To edit the integration without creating a new version of the integration, click **Edit integration**.
   - To close the test operation and return to the integration editor, click **Close**.

### API


Call the [`projects.locations.integrations.test`](https://docs.cloud.google.com/application-integration/docs/reference/rest/v1/projects.locations.integrations/test.md.txt) method.

The `clientId` field in the request body is required. Set it to your Google Cloud
project number, not the project ID.

To set the timeout of the flow, set the `X-Server-Timeout` field in the header. By default, the timeout is 120 seconds. For a list of pre-defined set of request parameters, see [System parameters](https://docs.cloud.google.com/apis/docs/system-parameters.md.txt).

## Publish an integration


Publishing an integration version deploys that integration version, and puts it in an [active state](https://docs.cloud.google.com/application-integration/docs/integration-versions.md.txt). Any previously published version of the integration will automatically be unpublished, and all the services that rely on the previously published integration version will automatically use the latest published version.


To publish an integration, select one of the following options:

### Console

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

   [Go to Application Integration](https://console.cloud.google.com/integrations)
2. Click **Integrations** from the left navigation menu to open the **Integrations** page.
3. Select the integration that you want to publish.<br />

4. In the designer navigation bar, click the **Version dropdown**, and select the integration version that you want to publish.
5. Click **Publish** .

   The **Autogenerate Integration description** dialog appears. If you want to generate a description, click **Sure, continue** . Otherwise, click **No, just publish**.


Upon successfully publishing your integration, you can view and inspect the [execution logs](https://docs.cloud.google.com/application-integration/docs/integration-execution-logs.md.txt) of the published integration. To view logs, click **Logs** in the toolbar of the integration editor.


By default, Application Integration locks an integration from editing when it is published. To make any changes to the published integration, click **Enable editing** in the integration editor. Editing a published integration will create a new version of that integration.

### API


Call the [`projects.locations.integrations.versions.publish`](https://docs.cloud.google.com/application-integration/docs/reference/rest/v1/projects.locations.integrations.versions/publish.md.txt) method.

### Unpublish an integration


Unpublishing an [active](https://docs.cloud.google.com/application-integration/docs/integration-versions.md.txt) integration version undeploys that integration version, and puts it in a [snapshot](https://docs.cloud.google.com/application-integration/docs/integration-versions.md.txt) state. Any services that rely on the published version of the integration will automatically be stopped.


To unpublish an integration, select one of the following options:

### Console

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

   [Go to Application Integration](https://console.cloud.google.com/integrations)
2. Click **Integrations** from the left navigation menu to open the **Integrations** page.
3. Select the integration that you want to unpublish.<br />

4. In the designer navigation bar, click the **Version dropdown**, and select the integration version that you want to unpublish.
5. Click **Unpublish** .


   After the integration is successfully unpublished, you can click **Enable editing** in the integration editor to edit the integration. Editing the integration will create a new version of that integration.

### API


Call the [`projects.locations.integrations.versions.unpublish`](https://docs.cloud.google.com/application-integration/docs/reference/rest/v1/projects.locations.integrations.versions/unpublish.md.txt) method.

## Quota and limits

For information about Application Integration quotas and limits, see [Quotas and limits](https://docs.cloud.google.com/application-integration/docs/quotas.md.txt).

## Best practice

- Define the usability of a [variable (input variable or output variable)](https://docs.cloud.google.com/application-integration/docs/variables.md.txt) before testing your integration. See Integration variables.
- Define [error handling](https://docs.cloud.google.com/application-integration/docs/error-handling.md.txt) for your integration.

## Quotas and limits

For information about quotas and limits, see [Quotas and limits](https://docs.cloud.google.com/application-integration/docs/quotas.md.txt).