Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of TestRunner execution Test in python

Shulou Source: shulou.com Published: 2022-06-03 15:33:52 11月02日 Update

This article shares with you the content of a sample analysis of TestRunner execution tests in python. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Description

1. First instantiate the object of TextTestRunner.

2. Call the run method of the object.

3. You only need to put suite as a parameter in the run method and execute the test case in suite.

Example

Import unittestimport testcase_01 suite = unittest.TestSuite () # suite.addTest (testcase_01.my_test ("test_001")) # suite.addTest (testcase_01.my_test ("test_002")) # just adds the test case to the test suite Not executing the test case suite.addTest (unittest.makeSuite (testcase_01.my_test)) runner = unittest.TextTestRunner () # instantiating the TextTestRunner object runner.run (suite) # calling the object's run method Thank you for reading! This is the end of this article on "sample analysis of TestRunner execution tests in python". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Tests objects examples methods examples analysis content more articles good practical parameters just suites articles see knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Redmi Linux OPPO Reno Xiaomi