简体   繁体   中英

How to run all test-cases from several modules?

I have several modules full of test-cases and 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM