Set up E2E tests
End-to-end tests validate complete workflows from start to finish in your Application SDK application. This guide walks you through creating the directory structure, configuration files, and test implementations for E2E testing.
Prerequisites
Before you begin, make sure you have:
- An Application SDK application project
- Understanding of the Application SDK test framework
- Access to test credentials for your data source
Prepare test environment
-
Create a
testsfolder at the root of your application:mkdir -p tests/e2eThe
testsfolder can also contain other test types likeunitandintegrationtests in their own subdirectories. -
Create a dedicated folder for each testing scenario within the
e2edirectory using the formattest_{app}_{workflow}_{scenario}.For example, to test a Redshift workflow with IAM user authentication:
mkdir -p tests/e2e/test_redshift_workflow_iam_user_authentication -
Create a
schemasubfolder in your test scenario folder:mkdir -p tests/e2e/test_redshift_workflow_iam_user_authentication/schema -
Create a
rawsubfolder for unprocessed data schemas:mkdir -p tests/e2e/test_redshift_workflow_iam_user_authentication/schema/raw -
Create
schema/raw/schema.yamlwith your Pandera schema definition:Example raw data schema
schema_type: dataframeversion: 0.22.1columns:table_catalog:title: Table Catalog Name Checkdescription: Check if the catalog name of records in the raw data is matched as expecteddtype: strnullable: falsechecks:str_matches:value: devoptions:raise_warning: falseunique: falsecoerce: falserequired: trueregex: falsetable_schema:title: Table Schema Name Checkdescription: Check if the schema name of records in the raw data is matched as expecteddtype: strnullable: falsechecks:isin:value: ['workflows', 'public']options:raise_warning: falseunique: falsecoerce: falserequired: trueregex: falsetable_name:title: Check Table Namesdescription: Check if the table names are within the expected listdtype: strnullable: falseunique: falsecoerce: falserequired: trueregex: falsechecks:check_record_count_ge:value: 1776options:raise_warning: falseindex: nulldtype: nullcoerce: falsestrict: falsename: nullordered: falseunique: nullreport_duplicates: allunique_column_names: trueadd_missing_columns: falsetitle: Raw Column Pandera Schemadescription: Pandera schema definition for the raw column outputThis schema validates that the raw data contains the expected columns with appropriate data types and constraints, and verifies that the data includes at least the specified number of records.
-
Create a
transformedsubfolder for processed data schemas:mkdir -p tests/e2e/test_redshift_workflow_iam_user_authentication/schema/transformed -
Create similar YAML files in
schema/transformed/for data after your application has processed and transformed it. -
Create
config.yamlin your test scenario folder with the test configuration:Example configuration file
test_workflow_args:credentials:username: $E2E_REDSHIFT_USERNAMEpassword: $E2E_REDSHIFT_PASSWORDhost: $E2E_REDSHIFT_HOSTport: $E2E_REDSHIFT_PORTextra:database: "dev"authType: "basic"type: "all"database: "dev"metadata:exclude-filter: "{}"include-filter: '{"^dev$":["^workflows$","^public$"]}'temp-table-regex: ""extraction-method: "direct"connection:connection_name: "dev"connection_qualified_name: "default/redshift/1738930739"test_name: "test_redshift_workflow_empty_exclude"server_config:server_host: "http://localhost:8000"server_version: "workflows/v1"expected_api_responses:auth:success: truemessage: "Authentication successful"metadata:success: truepreflight_check:success: truedata:databaseSchemaCheck:success: truesuccessMessage: "Schemas and Databases check successful"failureMessage: ""tablesCheck:success: truesuccessMessage: "Tables check successful. Table count: 155"failureMessage: ""Replace credential values with environment variables (like
$E2E_REDSHIFT_USERNAME) that GitHub Actions populates from secrets. -
Create a Python test file in your test scenario folder. Name it to match the folder name. For example:
test_redshift_workflow_iam_user_authentication.pyimport unittestfrom application_sdk.test_utils.e2e.base import BaseTestclass TestRedshiftWorkflowIamUserAuthentication(unittest.TestCase, BaseTest):extracted_output_base_path = ("./local/dapr/objectstore/artifacts/apps/redshift/workflows")The test class:
- inherits from both
unittest.TestCaseandBaseTest - Sets
extracted_output_base_pathto specify where the workflow stores its output, and inherits all standard E2E test methods fromBaseTest.
- inherits from both
You can override methods from BaseTest to customize test behavior or add additional test methods specific to your scenario.
- Run your E2E test to verify the setup:
pytest tests/e2e/test_redshift_workflow_iam_user_authentication/
The test discovers the config.yaml file, loads schema files from the schema/ directory, executes the test workflow, validates data using the schemas, and reports results.
See also
- Test configuration: Complete reference for test configuration options and structure patterns
- Test framework: Understanding the Application SDK testing framework