Test Case Naming Conventions - SatelliteQE/robottelo GitHub Wiki
Robottelo test names should make the expected behavior obvious from the module and function name alone.
Test modules follow:
test_<feature>.py
Examples:
test_activationkey.pytest_repository.pytest_install_foremanctl.py
The most common patterns in the repository are:
| Pattern | Use for |
|---|---|
test_positive_<action>_<entity> |
expected success path |
test_negative_<action>_<entity> |
expected failure or validation path |
test_post_<action>_<entity> |
post-upgrade verification |
Examples:
test_positive_create_with_nametest_negative_create_with_invalid_nametest_positive_check_installer_hammer_pingtest_post_upgrade_fdi_version
These names are not only for style. Consistent naming makes it much easier to:
- scan large modules quickly
- understand the expected outcome before reading the body
- spot duplicate or overlapping tests
- filter mentally between happy-path, negative, and upgrade coverage
- Put the behavior first, not the implementation detail.
- Prefer clear entity names over abbreviations unless the abbreviation is already common in the codebase.
- Add suffixes such as
with_<condition>,by_<selector>, orusing_<path>when they improve clarity. - Keep names stable unless the test intent materially changes.
test_positive_create_with_nametest_negative_create_with_invalid_nametest_positive_delete_by_id
test_create_1test_footest_ui_case
Those names hide the outcome or the behavior that matters.
| Entity | Common abbreviation |
|---|---|
| Activation Key | ak |
| Content View | cv |
| Content View Filter | cvf |
| Content View Version | cvv |
| Lifecycle Environment | lce |
| Organization | org |
| Repository | repo |
| Content Host | chost |
Use abbreviations sparingly. If the expanded form is clearer, prefer the full name.
Common naming fragments that read well in Robottelo:
create_with_<value>update_<field>delete_by_<selector>add_<association>remove_<association>search_by_<field>promote_with_<condition>
These are guidelines, not a rigid grammar. Clarity matters more than forcing a template that reads awkwardly.
The function name is only part of the test identity. Functional tests should
also include the required testimony-style docstring metadata, especially
:id:, :steps:, and :expectedresults:.
Usually no. Rename it when the intent, expected behavior, or coverage focus changed, not just because the internals changed.
When it is already common and readable in the repo, such as ak, cv, repo,
or lce. If the abbreviation makes the test harder to scan, spell it out.