in order to have a process-conform-code and traceability to test-requirements i need to change the naming convention of a unittest-testcase from "test" to "TestItem".
I tried already doing it with decorators in front of a testcase see following example, however the testitem2 wont be executed in the "unittest.main()" because only the testcase with "test" executes.
class TestClass(unittest.TestCase)
@TestItem
def TestItem_TestItem1(self):
self.assertEqual('foo'.upper(), 'FOO')
print(TestClass.TestItem_TestItem1.__name__+' done\n.)
def test_testitem2(self):
self.assertEqual('footwo'.upper(), 'FOOTWO')
print(TestClass.test_testitem2.__name__+' done\n.)
if __name__== '__main__':
unittest.main()
Actual results:
test_testitem2 done.
Ran 1 test in 0.00s
How can i do the trick? Any suggestions?
Aucun commentaire:
Enregistrer un commentaire