开发者

How to run all test-cases from several modules?

开发者 https://www.devze.com 2023-01-11 04:18 出处:网络
I have several modules full of test-cases and开发者_如何学Go would like to create one module that runs them all. I tried loading the tests in each of the modules using TestLoader.loadTestFromModule, b

I have several modules full of test-cases and开发者_如何学Go would like to create one module that runs them all. I tried loading the tests in each of the modules using TestLoader.loadTestFromModule, but it always returns empty test-suites. What is the easiest way to achieve this?


Have a look at nose. It can also be called programmatically, and it may thus be used to call your tests once you've configured it.


Ok, the problem there was that I handed in the modules-names as strings, when I should have been handing in module-objects like this:

import unittest
import SomeTestModule

loader = unittest.TestLoader()
loader.loadTestsFromModule(SomeTestModule)

Really a beginners mistake.

0

精彩评论

暂无评论...
验证码 换一张
取 消