Chapter 04Lesson 03120–160 min

Test Cases, Tasks, Suites, Names, Documentation, and Metadata: Configuration, Design Patterns, and Trade-Offs

Choose suite boundaries, naming, metadata, tags, initialization scope, and stable paths deliberately by connecting each design decision to maintainability, selection, evidence quality, and CI behavior.

ArchitectureTrade-offsMetadata vs tagsStable identitySelection

Learning objectives

  • Compare file suites, directory suites, broad/narrow suite boundaries, and custom naming with explicit trade-offs.
  • Decide when information belongs in a name, documentation, metadata, tags, or source structure.
  • Use initialization files only at meaningful directory boundaries and avoid hidden child-scope assumptions.
  • Understand how path/name changes affect CI selectors, reruns, ownership, historical reporting, and parallel planning.
  • Produce a small suite-architecture decision record for a realistic synthetic project.

Version scope. The design guidance targets Robot Framework 7.4.2. The Name suite setting and current initialization defaults are stable features introduced before this release. Do not copy pre-6.1 assumptions about directory initialization or pre-7.0 parent-suite matching behavior into new projects.

1. Treat suite structure as architecture, not folder decoration

Suite hierarchy is part of the automation product’s public surface. Humans see it in reports, CI selectors depend on it, ownership rules map to it, and historical trends aggregate around it. A good hierarchy groups cases that share business responsibility or lifecycle while keeping each file small enough to review and diagnose.

The goal is not maximum nesting. Every level should answer a useful question such as “which product area?”, “which workflow family?”, or “which evidence boundary?” If a directory exists only because a repository template created it, it may not deserve a suite identity.

2. Decision model for a suite boundary

A suite boundary should have semantic ownership, not merely mirror every filesystem folder
flowchart TD
A[Candidate group of tests/tasks] --> B{Shared business responsibility?}
B -- No --> C[Keep separate]
B -- Yes --> D{Need shared suite metadata/lifecycle?}
D -- Yes --> E[Directory suite + __init__.robot]
D -- No --> F{Small cohesive set?}
F -- Yes --> G[Focused file suite]
F -- No --> H[Directory suite with focused child files]
E --> I[Record stable name and owner]
G --> I
H --> I
I --> J[Review selectors and history before renaming/moving]

This flow is intentionally conservative. Initialization files add suite configuration and lifecycle, so using one in every directory creates more hidden context. Prefer them where the directory genuinely represents a suite boundary.

3. File suite versus directory suite

Choice Strengths Costs / risks Good fit
Focused file suite Easy local execution; clear source ownership; compact result node. Can become oversized; direct execution may skip intended parents. A cohesive feature/workflow with a small case set.
Directory suite Scales hierarchy; shared suite metadata/lifecycle; child files stay focused. More parent context; execution-root mistakes become important. Product area, release gate, or operational domain with multiple child suites.
Very broad single file Minimal tree depth. Mixed responsibility, slow diagnosis, merge conflicts, vague ownership. Rarely appropriate except small data-driven patterns.
Deep directory tree Fine-grained grouping. Long names, fragile selectors, report noise, lifecycle complexity. Only when every level carries durable meaning.

4. Concise names versus documentation

A name should be short enough to scan in a report yet specific enough to distinguish the node. Documentation should carry the explanation that would make the name unreadably long. For example, Checkout Contract is a better suite name than Checkout Contract Tests That Run Against The Synthetic Fixture Before Every Release; the latter detail belongs in documentation.

Custom Name is useful when source names include implementation-oriented prefixes or when a durable human identity should survive a local filename convention. It is not a license to make path and report identity unrelated without documentation. Future maintainers still need to map a result node back to source.

5. Metadata versus tags

Metadata and tags solve different lookup problems. Suite metadata answers “what context describes this suite?” Tags answer “which executable items belong to this selectable class?” Using metadata as a selector or tags as a dumping ground for paragraphs creates brittle automation.

Information Recommended home Reason
Owner team Suite metadata Describes the suite as a whole.
Requirement or component identifier Suite metadata or test-level documentation/tag depending selection need Use metadata for context; use a tag only if cases need selection/grouping.
Smoke/regression classification Tags Directly useful for include/exclude selection and statistics.
Long rationale / test charter Documentation Narrative is readable and does not pollute selectors.
Secret token or credential None of these Use secret management; result-facing fields are not secret stores.

6. Initialization at directory boundaries versus per-file configuration

Place a __init__.robot where the directory has real suite identity or shared suite-level lifecycle/configuration. Do not use it as a hidden “global imports” file. Child suite files do not inherit its user keywords and variables automatically, and parent initialization outside the execution root is ignored.

If every child needs the same reusable keyword library, an explicit resource import makes the dependency visible. If every child should receive a common test tag or timeout because they belong to the same release boundary, the appropriate initialization setting can express that suite-level policy.

7. Stable paths versus frequent reorganization

Repository cleanup often looks harmless: rename api_health.robot, move it to a new folder, or change a directory Name. Each can change suite full names and therefore CI selectors, dashboards, rerun records, links, ownership mappings, and historical trend continuity.

Treat a hierarchy change like an interface migration:

  1. inventory selectors and consumers;
  2. record old and new full names;
  3. update CI and reporting configuration in the same change;
  4. preserve a migration note for historical results;
  5. run a dry-run from the production execution root to prove the new tree.

8. Execute a child directly or select it under the root?

Approach Benefits Risk Recommended use
Execute child path directly Fast local focus; minimal tree. Skips higher __init__.robot behavior and changes full names. Isolated development when parent behavior is intentionally irrelevant.
Execute root + --suite Preserves parent hierarchy/lifecycle and stable full names. Parses a wider tree; selector must be maintained. CI, release gates, and investigations where root context matters.
Execute root + tags Flexible cross-suite selection. Tags need governance and may select a broad set. Smoke/regression/risk slices spanning multiple suites.

9. Tests versus tasks: separate semantics before optimizing structure

Do not choose *** Tasks *** merely because an automation is long-running, and do not choose *** Test Cases *** merely because the team already has test reporting. The question is intent. A test validates an outcome as release/quality evidence. A task performs an operation. Both can fail, but their failure means different things to the organization.

When one repository contains both, keep separate roots, jobs, artifact policies, and ownership where practical. That prevents a task failure from masquerading as a product regression or a test failure from being treated as an operational workflow interruption.

10. Worked scenario: choose a structure for a release platform

Suppose a team owns checkout, identity, and catalog validation. They need a release smoke slice across all three, component ownership, and a nightly synthetic maintenance task.

automation/
├── acceptance/
│   ├── __init__.robot          # Name=Release Acceptance, Owner metadata
│   ├── checkout/
│   │   └── smoke.robot
│   ├── identity/
│   │   └── smoke.robot
│   └── catalog/
│       └── smoke.robot
└── tasks/
    ├── __init__.robot          # Name=Synthetic Operations Tasks
    └── nightly_maintenance.robot

Give each smoke test a smoke tag rather than creating a second duplicate “smoke-only” hierarchy. Put component ownership at the narrowest stable suite level that actually has distinct ownership. Keep the task root separate because its outcome has operational meaning rather than release assertion meaning.

11. Decision table for code review

Review question Healthy signal Warning signal
Does every suite level have durable meaning? Business/component/release boundary is explicit. Nested only because directories already exist.
Can a result name map back to source? Custom names are documented and predictable. Names are heavily customized with no source mapping.
Are selectors stable? Full names/tags are versioned and reviewed. CI uses vague wildcards to survive constant renames.
Is initialization visible? Few meaningful __init__.robot boundaries. Every directory contains hidden lifecycle/import behavior.
Are evidence fields safe? Metadata/documentation contain non-sensitive context. Credentials or internal sensitive data are embedded.
Are tests/tasks separated by intent? Independent roots and artifact semantics. Mixed operational and quality failures share one ambiguous gate.

12. Knowledge check

When is a directory suite preferable to a single large suite file?

Why not use metadata instead of tags for a smoke selection?

A developer moves a file but keeps every test body unchanged. Why can this still be a breaking automation change?

Should a resource import be hidden in a parent __init__.robot so every child gets it automatically?

Why might CI prefer root execution plus --suite over direct child execution?

13. Summary and next step

Suite architecture is a maintainability and operations decision. Use focused files, meaningful directory suites, concise names, explanatory documentation, safe metadata, governed tags, and sparse initialization boundaries. Treat reorganization as an observable identity migration.

Lesson 4 intentionally breaks these assumptions—wrong roots, duplicate names, secret metadata, initialization misconceptions, and mixed responsibility—then diagnoses them from first-failure evidence.

Next lesson

Test Cases, Tasks, Suites, Names, Documentation, and Metadata: Diagnostics, Failure Modes, and Production Practices

Continue with Test Cases, Tasks, Suites, Names, Documentation, and Metadata: Diagnostics, Failure Modes, and Production Practices. It builds directly on the state, evidence, and operating assumptions established here, so carry those constraints forward rather than treating the next page as an isolated topic.

Further reading

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.