I have a test suite object that is run like this
suite = unittest.defaultTestLoader.discover("./tests")
unittest.TextTestRunner().run(suite)
So there are a bunch of python files in the tests folder which contain a lot of methods which tests something.
I wanna run the tests one by one and identify each test somehow.
So I asked chat gpt , how to do this
It gave me this
for test_case in suite:
for test in test_case:
print(test.id())
but got this error
AttributeError: 'TestSuite' object has no attribute 'id'
The reason I want to go through the testsuite object is that I don't want to write the code to find each test file.
So if there is any way please help me
I think you need to drill down one more level
for test_case in suite:
for tests in test_case:
for test in tests:
print(test.id())