Test Naming and Metadata
Design clear test identities and attach useful metadata so regression results can be filtered, reproduced, and debugged efficiently.
Learning objectives
- Explain why consistent test names and metadata matter in UVM regressions.
- Design test names that communicate intent without encoding excessive implementation detail.
- Record useful metadata such as the test name, random seed, configuration, and scenario.
- Use UVM reporting to make a failing regression easier to reproduce and triage.
Step 1: Understand the concept
A regression may execute hundreds or thousands of tests. When one fails, the test name should immediately tell you what scenario was intended, while the accompanying metadata should tell you how it was executed. Good naming and metadata turn a regression result into a reproducible debugging starting point.
A useful test record commonly includes the test name, random seed, configuration or mode, interface scenario, and the first meaningful failure. Keep these fields consistent across tests so scripts and engineers can search, group, and compare results.
axi4_burst_error_test communicates the scenario, while the seed and configuration describe
the particular execution.
Step 2: Study the example
Start by identifying the test identity, then report the execution metadata at the beginning of the test. The goal is not to print everything; it is to record the information that allows a failure to be found and reproduced.
class axi4_burst_error_test extends uvm_test;
`uvm_component_utils(axi4_burst_error_test)
function new(string name = "axi4_burst_error_test",
uvm_component parent = null);
super.new(name, parent);
endfunction
task run_phase(uvm_phase phase);
int seed;
seed = $get_initial_random_seed();
`uvm_info("TEST_META",
$sformatf("test=%s seed=%0d mode=%s",
get_type_name(), seed, "error_injection"),
UVM_LOW)
// Start the scenario after the metadata has been recorded.
endtask
endclass
Notice the separation of responsibilities. The class name identifies the verification intent, while the report records execution-specific information. If the test fails, the log contains enough context to locate the failing run before waveform debugging begins.
Good names vs. weak names
| Weak name | Better name | Why it helps |
|---|---|---|
test1 |
reset_register_test |
Communicates the scenario under verification. |
random_test |
axi4_random_burst_test |
Identifies the protocol and stimulus type. |
bad_packet |
packet_crc_error_test |
Describes the specific error condition. |
test_timeout_100_cycles |
timeout_handling_test |
Keeps variable configuration out of the stable test identity. |
Avoid names that are either too generic or overloaded with temporary implementation details. A test name should remain meaningful even if the sequence, timeout, seed, or internal component implementation changes.
Step 3: Build it in small pieces
- Define the intent. Write down the behavior being verified before choosing the test name.
- Choose a consistent naming pattern. Use stable terms such as protocol, scenario, feature, or expected error condition.
- Record execution metadata. Capture the test name, random seed, important mode/configuration, and other information required for reproduction.
- Make failures searchable. Use consistent report IDs and include transaction or scenario context in error messages.
- Verify reproducibility. Re-run a failing test using the recorded test name, seed, and relevant configuration.
Step 4: Make regression results actionable
Test metadata becomes especially valuable when a regression contains multiple failures. A useful failure record should let you answer four questions quickly:
- What test failed? — the stable test identity.
- Which execution failed? — the random seed and relevant configuration.
- What was being verified? — scenario, transaction, or feature context.
- What was the first useful symptom? — the earliest meaningful UVM error, assertion, or scoreboard mismatch.
`uvm_error("SB_MISMATCH",
$sformatf("test=%s seed=%0d id=%0d expected=%0h actual=%0h",
get_type_name(),
$get_initial_random_seed(),
id,
expected,
actual))
This is more useful than a generic message such as expected value incorrect.
The additional context reduces the amount of log searching required during triage.
Try it yourself
Design three test names for a register-based subsystem:
- A normal read/write test.
- A reset-during-access test.
- An invalid-address error test.
For each test, list at least four metadata fields you would record in the regression log. Then intentionally fail one test and determine whether another engineer could reproduce it using only the recorded test name, seed, and configuration.
test1, test2, and random_test.
Make the new names communicate verification intent while keeping runtime parameters in metadata.
Key takeaways
- Use stable test names to communicate verification intent and make regression results easy to identify.
- Keep changing execution details such as seeds and configuration values in metadata rather than embedding them in test names.
- Include enough context in UVM reports to connect a failure to its test, execution, and scenario.
- Good metadata shortens regression triage because engineers can reproduce failures without reconstructing the original run.