Python--nose Instance Example

Source: Internet
Author: User

1.

Script Example:

Execution Result:

2.

Script Example:

Execution Result:

The order of execution can be seen from the above:

The following conclusions can be drawn broadly:

1) The order of the tests is generally carried out in the order of the modules-----

2) then according to the test case name in ascending order, such as test_square than test_sub first execution;

3) When a test module contains both a test function and a test class, it must be the setup (if defined) that executes the teardown (if defined) after the module test isexecuted. Also , the setup and Setdown of the module are executed only once .

4) Each test method in the test class executes the setup (if defined) before execution, and executes the teardown (if defined). And the execution of each test method is the same, and the new method is executed again in the order->teardown the Setup-> execution method.

Above example Execution Order: module setup-Class 1setup--Class 1 Method-Class 1teardown-class 1setup-Class 1 Method-Class 1teardown-(class 2setup)-Class 2 Method-(class 2teardown)-module Method- Module teardown

In a function or functional use case organization, setup and teardown are executed only once, starting and ending respectively.

Python--nose Instance Example

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.