[英]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. 我尝试使用TestLoader.loadTestFromModule
在每个模块中加载测试,但它始终返回空的测试套件。 What is the easiest way to achieve this? 最简单的方法是什么?
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. 真的是初学者的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.