Skip to main content

Test Automation

Automating tests using the ProjectAutomation framework.

Overview

The ProjectAutomation framework enables you to programmatically discover and run tests, making it ideal for custom test runners, CI/CD integration, and selective test execution.

Loading the Project Graph

Start by loading the project graph:

Discovering Test Targets

Test targets can be identified by their product type:

Test Target Types

Unit Tests

Targets with product == "unit_tests":

UI Tests

Targets with product == "ui_tests":

Example: Run All Tests

Example: Selective Test Execution

Run only specific tests based on criteria:

Example: Test Dependency Analysis

Analyze test target dependencies:

Example: Code Coverage Analysis

Run tests with code coverage:

Example: Parallel Test Execution

Run tests in parallel for faster execution:

Best Practices

  1. Parallel Execution: Run independent tests in parallel to reduce total test time.
  2. Selective Testing: Filter tests based on changes, affected targets, or test type.
  3. Code Coverage: Enable code coverage for unit tests to track test quality.
  4. Retry Logic: Implement retry logic for flaky tests.
  5. Result Reporting: Generate detailed test reports for CI/CD integration.
  6. Test Isolation: Ensure tests are isolated and can run independently.