Performance Optimization

This guide provides tips for optimizing test execution performance in TrueAssert.

Overview

Test performance depends on several factors:

  • Test complexity (number of steps)

  • Page load times

  • Network latency

  • Agent availability

  • Session reuse

Optimization Strategies

1. Use Session Management

Impact: High - Can save 10-15 seconds per test run

How:

  • Configure login settings for projects

  • Enable session reuse

  • Sessions are validated quickly (2-3 seconds)

  • Full login only when needed (10-15 seconds)

Best Practice: Always set up login settings for authenticated tests.

2. Optimize Test Steps

Impact: Medium - Reduces execution time

How:

  • Remove unnecessary steps

  • Combine related actions

  • Use efficient selectors

  • Avoid redundant waits

Best Practice: Review tests regularly and remove unnecessary steps.

3. Use Efficient Selectors

Impact: Medium - Faster element location

How:

  • Prefer ID selectors (fastest)

  • Use data-testid (very fast)

  • Avoid complex XPath (slower)

  • Use CSS when simple (slightly faster)

Best Practice: Use ID or data-testid selectors when possible.

4. Minimize Waits

Impact: Medium - Reduces idle time

How:

  • Only wait when necessary

  • Use specific waits (wait for element) not generic delays

  • Remove redundant waits

  • Wait for actual conditions, not arbitrary time

Best Practice: Add waits only when elements load asynchronously.

5. Parallel Execution

Impact: High - Run multiple tests simultaneously

How:

  • Run independent tests in parallel

  • Use multiple agents if available

  • Distribute tests across agents

Best Practice: Group independent tests and run them together.

Performance Metrics

Typical Execution Times

Simple Test (5-10 steps):

  • Without login: 10-20 seconds

  • With session reuse: 12-25 seconds

  • With full login: 25-40 seconds

Complex Test (20+ steps):

  • Without login: 30-60 seconds

  • With session reuse: 35-70 seconds

  • With full login: 50-90 seconds

Factors Affecting Performance

  1. Number of Steps: More steps = longer execution

  2. Page Load Times: Slow pages = longer execution

  3. Network Latency: High latency = longer execution

  4. Agent Availability: No agents = queued execution

  5. Session Reuse: Reused sessions = faster execution

Optimization Checklist

Before Test Creation

During Test Creation

After Test Creation

Regular Maintenance

Common Performance Issues

Issue 1: Too Many Waits

Problem: Tests have excessive wait steps

Solution: Remove unnecessary waits, use specific element waits

Issue 2: Slow Selectors

Problem: Tests use slow, complex selectors

Solution: Update to ID or data-testid selectors

Issue 3: No Session Reuse

Problem: Tests always do full login

Solution: Set up session management, enable session reuse

Issue 4: Redundant Steps

Problem: Tests have duplicate or unnecessary steps

Solution: Review and remove redundant steps

Best Practices Summary

  1. Use Session Management: Always set up login settings

  2. Optimize Selectors: Use ID or data-testid

  3. Minimize Steps: Remove unnecessary steps

  4. Efficient Waits: Wait only when needed

  5. Regular Review: Review and optimize regularly


← Back to Documentation

Last updated