Invoked uvm_component_utils, still get 'cannot register with the factory' error

Hi guys, I’m hitting a runtime error and I just can’t seem to figure out what is wrong.

I have a test class:


class a_test extends a_test_base;

	`uvm_component_utils(a_test)
...

Code compiles correctly in VCS but…I’m getting the following error:

UVM_WARNING @ 0.000 ns: reporter [BDTYP] Cannot create a component of type ‘a_test’ because it is not registered with the factory.
UVM_FATAL @ 0.000 ns: reporter [INVTST] Requested test from command line +UVM_TESTNAME=a_test not found.

Could there be any other thing that is required to register a class to the factory other than invoke the `uvm_component_utils() macro? I thought that was all that was needed?

In reply to silverace99:

Did you include the test as part of your test package? Did you import the test package at the testbench top level where run_test() is called?

In reply to cgales:

In reply to silverace99:
Did you include the test as part of your test package? Did you import the test package at the testbench top level where run_test() is called?

I did not import the test package at the top level. Doing so solved my problem thank you!

I think I had not run across this problem before because previously in practice code I had placed the testbench top and the test class all in a single package, so it wasn’t necessary to explicitly import at tb top.