@omni.kit.test.AsyncTestCase.subTest doesn't work

As per Dan North / Chris Matts / Liz Keogh (JBehave), best practice when writing testcases is to use public method names that begin ‘should’ rather than ‘test’. e.g. ‘should_save_customer_details’ instead of ‘test_database’, as it encourages developers to describe what their code should do.

In Python / unittest, we achieve this by decorating the method with @unittest.TestCase.subTest.

However, this (and related decorator @omni.kit.test.AsyncTestCase.subTest) don’t currently work within the Omniverse test framework. That is, @omni.kit.test.AsyncTestCase.subTest exists and one can use it, but it doesn’t cause the method to be added to TestRunner - the annotation is silently ignored.

image

The workaround is to continue to prefix the method name with ‘test_’ as per the third example.

I’m having trouble finding documentation on subTest as a decorator. I only see it used as a context manager. Can you share a reference if you have it?

My understanding is that the unittest framework requires tests to start with the name “test_”:

The simplest TestCase subclass will simply implement a test method (i.e. a method whose name starts with test) in order to perform specific testing code: