Overview

Optimizing your TestDriver tests can significantly reduce execution time, ensuring faster feedback for developers and smoother CI/CD workflows. While TestDriver’s AI-powered capabilities are robust, using them efficiently is key to achieving the best performance.


Tips for improving performance

1. Use parallel testing

Parallel testing allows you to split your test actions into multiple files and run them simultaneously. This can drastically reduce the total runtime of your test suite.

How to implement parallel testing

  • Divide your test steps into smaller, independent YAML files.
  • Use the run command or GitHub matrix strategy to execute these files in parallel.

The run command is used in your test files to run other test files. This is useful for breaking down large tests into smaller, more manageable pieces. To run multiple separate tests, use the GitHub matrix strategy.

Example:

strategy:
  matrix:
    test_file: 
      - tests/login.yaml
      - tests/search.yaml
      - tests/cart.yaml

2. Use optimized matching methods

For actions like hover-text, wait-for-text, and scroll-until-text, use the turbo matching method instead of ai. The turbo method uses text similarity to quickly compute the most relevant match, making it about 40% faster than the ai method.

Example

command: hover-text
text: Sign In
description: login button
action: click
method: turbo

3. Use async asserts

The assert command supports the async: true property, allowing you to create non-blocking assertions. This means your tests can continue running while the assertion is being validated, saving valuable time.

Example

command: assert
expect: The user is logged in
async: true

Best practices

  • Minimize AI Matching: Use AI-powered matching methods only when necessary. For common actions, rely on optimized methods like turbo.
  • Break Down Tests: Split large, monolithic test files into smaller, focused tests to enable parallel execution.
  • Leverage Asynchronous Features: Use async properties wherever possible to avoid blocking test execution.
  • Monitor Performance: Regularly review test execution times and identify bottlenecks.

Notes

  • Optimizing performance not only saves time but also reduces resource usage, making your CI/CD pipelines more efficient.
  • For large test suites, combining parallel testing with optimized matching methods can lead to significant time savings.
  • Always balance performance optimizations with test reliability to ensure accurate results.