The site that you are currently viewing is a static version of the Software Factory documentation delivered with the

version v7.2.
For up-to-date documentation, see the latest version.

Assist Tests development

Introduction

This practice shows how GenAI coding assistants can help design reliable, reviewable, and maintainable tests faster. It is intended for software engineers and test engineers who need to improve behavioral coverage, explore edge cases, and strengthen confidence without losing human control. The assistant is useful for generating candidate scenarios and draft tests, but engineers remain responsible for correctness, relevance, determinism, and CI stability. To get useful results, provide clear acceptance criteria, the system under test contract, and the main project conventions and tooling constraints.

Key principles

  • Start with behavior and expected outcomes: define what correct behavior looks like before generating test code, including failure cases and invariants.
  • Prefer contract-focused tests: validate observable outcomes, domain rules, and risks rather than internal implementation details.
  • Keep tests deterministic and reviewable: avoid unstable timing, randomness, unnecessary external dependencies, and large hard-to-review diffs.
  • Work in small, controlled iterations: ask for a test plan first, generate a few high-value cases, run them quickly, then refine based on failures and coverage gaps.

Examples

  • Boundary and negative testing: ask the assistant for three edge cases or invalid inputs and the expected outcome, then keep only the cases that protect meaningful behavior.
  • Coverage-guided improvement: use the coverage report to identify one missing branch and generate a targeted test that would fail if the behavior regressed.
  • Refining brittle tests: ask the assistant to simplify fixtures, reduce over-mocking, and improve assertion clarity while preserving the original behavioral intent.

Drawbacks / anti-patterns

  • Blindly trusting generated tests: accepting tests that pass but don’t validate meaningful behavior (false confidence).
  • Over-mocking and testing internals: brittle tests that break on refactoring and assert call sequences instead of outcomes.
  • Snapshot/golden-file spam generation: large snapshots or tests that are easy to approve and hard to review (possible unreliable)
  • Coverage vanity: optimizing for coverage percentage instead of risk coverage and defect detection.
  • Hallucinated dependencies: tests importing non-existent helpers, using wrong APIs, or inventing fixtures that are not present in the codebase.
  • Flaky test generation: time-dependent assertions, randomness without seeding, reliance on external services without proper isolation.