> **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 › IntegTestCase
Implements: IConstruct, IDependable

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

## Example

```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,
});
```

## Initializer

```ts
new IntegTestCase(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
