unittest -官网文档学习笔记-Grouping tests

class unittest.TestSuite(tests=())

  This class represents an aggregation of individul tests cases and test suites. The class presents the interface needed by the test runner to allow it to be run as any other test case. Running a TestSuite instance is the same as iterating over the suite, running each test individually.

  if tests is given, it must be an iterable of individual test cases or other test suites that will be used to build the suite initially. Additional methods are provided to add test cases and suites to the collection later on.

addTest(test)
  Add a TestCase or TestSuite to the suiet.

addTests(tests)
  Add all the tests from an iterable of TestCase and TestSuite instances to this test suite.
  This is equivalet to iterating over tests, calling addTest() for each element.

TestSuite shares the following methods with TestCase:

run(result)

debug()

countTestCases()

__iter__()

 

In the typical usage of a TestSuite object, the run() method is invoked by a TestRunner rather than by the end-user test harness.

posted @ 2015-07-11 18:15  isister  阅读(249)  评论(0编辑  收藏  举报