Write Clear and Effective Tests
Create tests that read like well-structured guides while thoroughly examining your application. For optimal clarity and maintainability:- Targeted Focus – Each test should validate just one functionality or behavior, making debugging straightforward.
- Simplicity First – Keep test steps simple.
- Precise Assertions – Craft assertions that mirror actual user interactions, ensuring key behaviors are verified without excessive detail.
Validate Outcomes, Not Transient States
Validate what the user cares about — the result of an action, not loading spinners or transition text. Transient states may vanish before the screenshot is captured, causing flaky tests.Use Wait Blocks Sparingly
Steps have built-in retry logic — they automatically wait for elements to appear. Only add waits for known significant delays (afterkill_app, system-level pauses like geofence detection).
Arrange-Act-Assert
The AAA approach offers a structured methodology for creating robust and maintainable tests:- Arrange - Set up the test environment
- Act - Execute the code to test
- Assert - Verify the results
Utilize Variables for Flexibility
Incorporating variables into your tests enhances adaptability and maintainability:- Data-Driven Testing – Execute tests with multiple data sets without duplicating test logic.
- Credential Management – Reference information without hardcoding it.
- Dynamic Content Handling – Adapt to changing content by updating variables rather than test steps.
- Parameterization – Create more generic test steps that can be reused with different inputs.