> **Experimental**
>
> `@aws-cdk/integ-tests-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# IntegTestCase

An integration test case. Allows the definition of test properties that apply to all stacks under this case.

It is recommended that you use the IntegTest construct since that will create
a default IntegTestCase

Extends: [Construct](/cdk/api/v2/docs/constructs.Construct.html) › IntegTestCase
Implements: [IConstruct](/cdk/api/v2/docs/constructs.IConstruct.html), [IDependable](/cdk/api/v2/docs/constructs.IDependable.html)

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/test-case.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/integ-tests-alpha/lib/test-case.ts#L36)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as integ_tests_alpha from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { cloud_assembly_schema } from 'aws-cdk-lib';

declare const stack: cdk.Stack;
const integTestCase = new integ_tests_alpha.IntegTestCase(this, 'MyIntegTestCase', {
  stacks: [stack],

  // the properties below are optional
  allowDeleteFailures: false,
  allowDestroy: ['allowDestroy'],
  assertionStack: stack,
  cdkCommandOptions: {
    deploy: {
      args: {
        all: false,
        app: 'app',
        assetMetadata: false,
        caBundlePath: 'caBundlePath',
        changeSetName: 'changeSetName',
        ci: false,
        color: false,
        concurrency: 123,
        context: {
          contextKey: 'context',
        },
        debug: false,
        ec2Creds: false,
        exclusively: false,
        execute: false,
        force: false,
        ignoreErrors: false,
        json: false,
        lookups: false,
        notices: false,
        notificationArns: ['notificationArns'],
        output: 'output',
        outputsFile: 'outputsFile',
        parameters: {
          parametersKey: 'parameters',
        },
        pathMetadata: false,
        profile: 'profile',
        proxy: 'proxy',
        requireApproval: cloud_assembly_schema.RequireApproval.NEVER,
        reuseAssets: ['reuseAssets'],
        roleArn: 'roleArn',
        rollback: false,
        stacks: ['stacks'],
        staging: false,
        strict: false,
        toolkitStackName: 'toolkitStackName',
        trace: false,
        usePreviousParameters: false,
        verbose: false,
        versionReporting: false,
      },
      enabled: false,
      expectedMessage: 'expectedMessage',
      expectError: false,
    },
    destroy: {
      args: {
        all: false,
        app: 'app',
        assetMetadata: false,
        caBundlePath: 'caBundlePath',
        color: false,
        context: {
          contextKey: 'context',
        },
        debug: false,
        ec2Creds: false,
        exclusively: false,
        force: false,
        ignoreErrors: false,
        json: false,
        lookups: false,
        notices: false,
        output: 'output',
        pathMetadata: false,
        profile: 'profile',
        proxy: 'proxy',
        roleArn: 'roleArn',
        stacks: ['stacks'],
        staging: false,
        strict: false,
        trace: false,
        verbose: false,
        versionReporting: false,
      },
      enabled: false,
      expectedMessage: 'expectedMessage',
      expectError: false,
    },
  },
  diffAssets: false,
  hooks: {
    postDeploy: ['postDeploy'],
    postDestroy: ['postDestroy'],
    preDeploy: ['preDeploy'],
    preDestroy: ['preDestroy'],
  },
  providerLogLevel: lambda.ApplicationLogLevel.INFO,
  regions: ['regions'],
  stackUpdateWorkflow: false,
});
```

Python:

```python
from aws_cdk.cloud_assembly_schema import CdkCommands, DeployCommand, DeployOptions, DestroyCommand, DestroyOptions, Hooks
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.integ_tests_alpha as integ_tests_alpha
import aws_cdk as cdk
from aws_cdk import aws_lambda as lambda_
from aws_cdk import cloud_assembly_schema

# stack: cdk.Stack

integ_test_case = integ_tests_alpha.IntegTestCase(self, "MyIntegTestCase",
    stacks=[stack],

    # the properties below are optional
    allow_delete_failures=False,
    allow_destroy=["allowDestroy"],
    assertion_stack=stack,
    cdk_command_options=CdkCommands(
        deploy=DeployCommand(
            args=DeployOptions(
                all=False,
                app="app",
                asset_metadata=False,
                ca_bundle_path="caBundlePath",
                change_set_name="changeSetName",
                ci=False,
                color=False,
                concurrency=123,
                context={
                    "context_key": "context"
                },
                debug=False,
                ec2_creds=False,
                exclusively=False,
                execute=False,
                force=False,
                ignore_errors=False,
                json=False,
                lookups=False,
                notices=False,
                notification_arns=["notificationArns"],
                output="output",
                outputs_file="outputsFile",
                parameters={
                    "parameters_key": "parameters"
                },
                path_metadata=False,
                profile="profile",
                proxy="proxy",
                require_approval=cloud_assembly_schema.RequireApproval.NEVER,
                reuse_assets=["reuseAssets"],
                role_arn="roleArn",
                rollback=False,
                stacks=["stacks"],
                staging=False,
                strict=False,
                toolkit_stack_name="toolkitStackName",
                trace=False,
                use_previous_parameters=False,
                verbose=False,
                version_reporting=False
            ),
            enabled=False,
            expected_message="expectedMessage",
            expect_error=False
        ),
        destroy=DestroyCommand(
            args=DestroyOptions(
                all=False,
                app="app",
                asset_metadata=False,
                ca_bundle_path="caBundlePath",
                color=False,
                context={
                    "context_key": "context"
                },
                debug=False,
                ec2_creds=False,
                exclusively=False,
                force=False,
                ignore_errors=False,
                json=False,
                lookups=False,
                notices=False,
                output="output",
                path_metadata=False,
                profile="profile",
                proxy="proxy",
                role_arn="roleArn",
                stacks=["stacks"],
                staging=False,
                strict=False,
                trace=False,
                verbose=False,
                version_reporting=False
            ),
            enabled=False,
            expected_message="expectedMessage",
            expect_error=False
        )
    ),
    diff_assets=False,
    hooks=Hooks(
        post_deploy=["postDeploy"],
        post_destroy=["postDestroy"],
        pre_deploy=["preDeploy"],
        pre_destroy=["preDestroy"]
    ),
    provider_log_level=lambda_.ApplicationLogLevel.INFO,
    regions=["regions"],
    stack_update_workflow=False
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.integtests.alpha.*;
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.cloud_assembly_schema.*;

Stack stack;

IntegTestCase integTestCase = IntegTestCase.Builder.create(this, "MyIntegTestCase")
        .stacks(List.of(stack))

        // the properties below are optional
        .allowDeleteFailures(false)
        .allowDestroy(List.of("allowDestroy"))
        .assertionStack(stack)
        .cdkCommandOptions(CdkCommands.builder()
                .deploy(DeployCommand.builder()
                        .args(DeployOptions.builder()
                                .all(false)
                                .app("app")
                                .assetMetadata(false)
                                .caBundlePath("caBundlePath")
                                .changeSetName("changeSetName")
                                .ci(false)
                                .color(false)
                                .concurrency(123)
                                .context(Map.of(
                                        "contextKey", "context"))
                                .debug(false)
                                .ec2Creds(false)
                                .exclusively(false)
                                .execute(false)
                                .force(false)
                                .ignoreErrors(false)
                                .json(false)
                                .lookups(false)
                                .notices(false)
                                .notificationArns(List.of("notificationArns"))
                                .output("output")
                                .outputsFile("outputsFile")
                                .parameters(Map.of(
                                        "parametersKey", "parameters"))
                                .pathMetadata(false)
                                .profile("profile")
                                .proxy("proxy")
                                .requireApproval(RequireApproval.NEVER)
                                .reuseAssets(List.of("reuseAssets"))
                                .roleArn("roleArn")
                                .rollback(false)
                                .stacks(List.of("stacks"))
                                .staging(false)
                                .strict(false)
                                .toolkitStackName("toolkitStackName")
                                .trace(false)
                                .usePreviousParameters(false)
                                .verbose(false)
                                .versionReporting(false)
                                .build())
                        .enabled(false)
                        .expectedMessage("expectedMessage")
                        .expectError(false)
                        .build())
                .destroy(DestroyCommand.builder()
                        .args(DestroyOptions.builder()
                                .all(false)
                                .app("app")
                                .assetMetadata(false)
                                .caBundlePath("caBundlePath")
                                .color(false)
                                .context(Map.of(
                                        "contextKey", "context"))
                                .debug(false)
                                .ec2Creds(false)
                                .exclusively(false)
                                .force(false)
                                .ignoreErrors(false)
                                .json(false)
                                .lookups(false)
                                .notices(false)
                                .output("output")
                                .pathMetadata(false)
                                .profile("profile")
                                .proxy("proxy")
                                .roleArn("roleArn")
                                .stacks(List.of("stacks"))
                                .staging(false)
                                .strict(false)
                                .trace(false)
                                .verbose(false)
                                .versionReporting(false)
                                .build())
                        .enabled(false)
                        .expectedMessage("expectedMessage")
                        .expectError(false)
                        .build())
                .build())
        .diffAssets(false)
        .hooks(Hooks.builder()
                .postDeploy(List.of("postDeploy"))
                .postDestroy(List.of("postDestroy"))
                .preDeploy(List.of("preDeploy"))
                .preDestroy(List.of("preDestroy"))
                .build())
        .providerLogLevel(ApplicationLogLevel.INFO)
        .regions(List.of("regions"))
        .stackUpdateWorkflow(false)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.IntegTests.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.IntegTests.Alpha;
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK.Cloud_assembly_schema;

Stack stack;

var integTestCase = new IntegTestCase(this, "MyIntegTestCase", new IntegTestCaseProps {
    Stacks = new [] { stack },

    // the properties below are optional
    AllowDeleteFailures = false,
    AllowDestroy = new [] { "allowDestroy" },
    AssertionStack = stack,
    CdkCommandOptions = new CdkCommands {
        Deploy = new DeployCommand {
            Args = new DeployOptions {
                All = false,
                App = "app",
                AssetMetadata = false,
                CaBundlePath = "caBundlePath",
                ChangeSetName = "changeSetName",
                Ci = false,
                Color = false,
                Concurrency = 123,
                Context = new Dictionary<string, string> {
                    { "contextKey", "context" }
                },
                Debug = false,
                Ec2Creds = false,
                Exclusively = false,
                Execute = false,
                Force = false,
                IgnoreErrors = false,
                Json = false,
                Lookups = false,
                Notices = false,
                NotificationArns = new [] { "notificationArns" },
                Output = "output",
                OutputsFile = "outputsFile",
                Parameters = new Dictionary<string, string> {
                    { "parametersKey", "parameters" }
                },
                PathMetadata = false,
                Profile = "profile",
                Proxy = "proxy",
                RequireApproval = RequireApproval.NEVER,
                ReuseAssets = new [] { "reuseAssets" },
                RoleArn = "roleArn",
                Rollback = false,
                Stacks = new [] { "stacks" },
                Staging = false,
                Strict = false,
                ToolkitStackName = "toolkitStackName",
                Trace = false,
                UsePreviousParameters = false,
                Verbose = false,
                VersionReporting = false
            },
            Enabled = false,
            ExpectedMessage = "expectedMessage",
            ExpectError = false
        },
        Destroy = new DestroyCommand {
            Args = new DestroyOptions {
                All = false,
                App = "app",
                AssetMetadata = false,
                CaBundlePath = "caBundlePath",
                Color = false,
                Context = new Dictionary<string, string> {
                    { "contextKey", "context" }
                },
                Debug = false,
                Ec2Creds = false,
                Exclusively = false,
                Force = false,
                IgnoreErrors = false,
                Json = false,
                Lookups = false,
                Notices = false,
                Output = "output",
                PathMetadata = false,
                Profile = "profile",
                Proxy = "proxy",
                RoleArn = "roleArn",
                Stacks = new [] { "stacks" },
                Staging = false,
                Strict = false,
                Trace = false,
                Verbose = false,
                VersionReporting = false
            },
            Enabled = false,
            ExpectedMessage = "expectedMessage",
            ExpectError = false
        }
    },
    DiffAssets = false,
    Hooks = new Hooks {
        PostDeploy = new [] { "postDeploy" },
        PostDestroy = new [] { "postDestroy" },
        PreDeploy = new [] { "preDeploy" },
        PreDestroy = new [] { "preDestroy" }
    },
    ProviderLogLevel = ApplicationLogLevel.INFO,
    Regions = new [] { "regions" },
    StackUpdateWorkflow = false
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import integ_tests_alpha "github.com/aws/aws-cdk-go/awscdkintegtestsalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var stack Stack

integTestCase := integ_tests_alpha.NewIntegTestCase(this, jsii.String("MyIntegTestCase"), &IntegTestCaseProps{
	Stacks: []Stack{
		stack,
	},

	// the properties below are optional
	AllowDeleteFailures: jsii.Boolean(false),
	AllowDestroy: []*string{
		jsii.String("allowDestroy"),
	},
	AssertionStack: stack,
	CdkCommandOptions: &CdkCommands{
		Deploy: &DeployCommand{
			Args: &DeployOptions{
				All: jsii.Boolean(false),
				App: jsii.String("app"),
				AssetMetadata: jsii.Boolean(false),
				CaBundlePath: jsii.String("caBundlePath"),
				ChangeSetName: jsii.String("changeSetName"),
				Ci: jsii.Boolean(false),
				Color: jsii.Boolean(false),
				Concurrency: jsii.Number(123),
				Context: map[string]*string{
					"contextKey": jsii.String("context"),
				},
				Debug: jsii.Boolean(false),
				Ec2Creds: jsii.Boolean(false),
				Exclusively: jsii.Boolean(false),
				Execute: jsii.Boolean(false),
				Force: jsii.Boolean(false),
				IgnoreErrors: jsii.Boolean(false),
				Json: jsii.Boolean(false),
				Lookups: jsii.Boolean(false),
				Notices: jsii.Boolean(false),
				NotificationArns: []*string{
					jsii.String("notificationArns"),
				},
				Output: jsii.String("output"),
				OutputsFile: jsii.String("outputsFile"),
				Parameters: map[string]*string{
					"parametersKey": jsii.String("parameters"),
				},
				PathMetadata: jsii.Boolean(false),
				Profile: jsii.String("profile"),
				Proxy: jsii.String("proxy"),
				RequireApproval: awscdk.Cloud_assembly_schema.RequireApproval_NEVER,
				ReuseAssets: []*string{
					jsii.String("reuseAssets"),
				},
				RoleArn: jsii.String("roleArn"),
				Rollback: jsii.Boolean(false),
				Stacks: []*string{
					jsii.String("stacks"),
				},
				Staging: jsii.Boolean(false),
				Strict: jsii.Boolean(false),
				ToolkitStackName: jsii.String("toolkitStackName"),
				Trace: jsii.Boolean(false),
				UsePreviousParameters: jsii.Boolean(false),
				Verbose: jsii.Boolean(false),
				VersionReporting: jsii.Boolean(false),
			},
			Enabled: jsii.Boolean(false),
			ExpectedMessage: jsii.String("expectedMessage"),
			ExpectError: jsii.Boolean(false),
		},
		Destroy: &DestroyCommand{
			Args: &DestroyOptions{
				All: jsii.Boolean(false),
				App: jsii.String("app"),
				AssetMetadata: jsii.Boolean(false),
				CaBundlePath: jsii.String("caBundlePath"),
				Color: jsii.Boolean(false),
				Context: map[string]*string{
					"contextKey": jsii.String("context"),
				},
				Debug: jsii.Boolean(false),
				Ec2Creds: jsii.Boolean(false),
				Exclusively: jsii.Boolean(false),
				Force: jsii.Boolean(false),
				IgnoreErrors: jsii.Boolean(false),
				Json: jsii.Boolean(false),
				Lookups: jsii.Boolean(false),
				Notices: jsii.Boolean(false),
				Output: jsii.String("output"),
				PathMetadata: jsii.Boolean(false),
				Profile: jsii.String("profile"),
				Proxy: jsii.String("proxy"),
				RoleArn: jsii.String("roleArn"),
				Stacks: []*string{
					jsii.String("stacks"),
				},
				Staging: jsii.Boolean(false),
				Strict: jsii.Boolean(false),
				Trace: jsii.Boolean(false),
				Verbose: jsii.Boolean(false),
				VersionReporting: jsii.Boolean(false),
			},
			Enabled: jsii.Boolean(false),
			ExpectedMessage: jsii.String("expectedMessage"),
			ExpectError: jsii.Boolean(false),
		},
	},
	DiffAssets: jsii.Boolean(false),
	Hooks: &Hooks{
		PostDeploy: []*string{
			jsii.String("postDeploy"),
		},
		PostDestroy: []*string{
			jsii.String("postDestroy"),
		},
		PreDeploy: []*string{
			jsii.String("preDeploy"),
		},
		PreDestroy: []*string{
			jsii.String("preDestroy"),
		},
	},
	ProviderLogLevel: awscdk.Aws_lambda.ApplicationLogLevel_INFO,
	Regions: []*string{
		jsii.String("regions"),
	},
	StackUpdateWorkflow: jsii.Boolean(false),
})
```

## Initializer

TypeScript:

```ts
new IntegTestCase(scope: Construct, id: string, props: IntegTestCaseProps)
```

Python:

```python
IntegTestCase(scope: Construct, id: str, props: IntegTestCaseProps)
```

Java:

```java
new IntegTestCase(Construct scope, String id, IntegTestCaseProps props)
```

C# / .NET:

```csharp
new IntegTestCase(Construct scope, string id, IntegTestCaseProps props)
```

Golang:

```go
NewIntegTestCase(Scope Construct, Id *string, Props IntegTestCaseProps)
```

## Construct Props

- `allowDeleteFailures`: boolean = false — Whether to allow resources that fail to delete during a stack update.

  When false, the test will fail if CloudFormation skips deleting a resource
  during a stack update. When true, only a warning is printed.

- `allowDestroy`: string[] — List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.

  **Default:** do not allow destruction of any resources on update

  This list should only include resources that for this specific
  integration test we are sure will not cause errors or an outage if
  destroyed. For example, maybe we know that a new resource will be created
  first before the old resource is destroyed which prevents any outage.

  e.g. ['AWS::IAM::Role']

- `assertionStack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — Specify a stack to use for assertions.

  **Default:** a stack is created for you

- `cdkCommandOptions`: [CdkCommands](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.CdkCommands.html) — Additional options to use for each CDK command.

  **Default:** runner default options

- `diffAssets`: boolean = false — Whether or not to include asset hashes in the diff Asset hashes can introduces a lot of unneccessary noise into tests, but there are some cases where asset hashes _should_ be included.

  For example
  any tests involving custom resources or bundling

- `hooks`: [Hooks](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.Hooks.html) — Additional commands to run at predefined points in the test workflow.

  **Default:** no hooks

  e.g. { postDeploy: ['yarn', 'test'] }

- `providerLogLevel`: [ApplicationLogLevel](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.ApplicationLogLevel.html) = ApplicationLogLevel.FATAL — The log level of the provider lambda function.

- `regions`: string[] — Limit deployment to these regions.

  **Default:** can run in any region

- `stacks`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html)[] (required) — Stacks to be deployed during the test.

- `stackUpdateWorkflow`: boolean = true — Run update workflow on this test case This should only be set to false to test scenarios that are not possible to test as part of the update workflow.

## Properties

- `assertions`: [IDeployAssert](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.IDeployAssert.html) — Make assertions on resources in this test case.

- `manifest`: [IntegManifest](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.IntegManifest.html) — The integration test manifest for this test case.

  Manifests are used
  by the integration test runner.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

## Methods

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
