Using the flaky plug-in to run failure cases in UI Automation tests

Source: Internet
Author: User

In UI Automation testing, sometimes it is often prompted to run the use case failure, in a single step or a single use case debugging, the use case is successful, the failure factor is mainly the environment, code or front-end positioning and other reasons.

You can read this article "How we make UI testing stable" in detail, but, here, we don't discuss the problem, let's look at the optimization

The original automation framework in the project was basic nose, with an option in nose:

--failed run the tests that failed in the last              test Run.

You can run the use cases that failed in the last test individually, but it seems to deviate from my idea, my requirement is to run the use case again after the failure, then report the normal output

Coincidentally, just see there is a flaky can support this demand, specific introduction and installation, have predecessors wrote: http://blog.csdn.net/liuchunming033/article/details/45916389

However, there are some differences in the nose framework, as follows:

#Coding:utf-8" "Created on June 22, 2016 @author:huzq" " fromNose.toolsImportWith_setupImportLogging fromTest_caseImportNew fromNose.toolsImportOk_ fromNose.toolsImporteq_ImportNoseImportOS fromNose.plugins.attribImportattr fromNose.plugins.skipImportskiptestImportSYS fromPdbImportSet_trace#TODO:JFJFJFLog = Logging.getlogger (__name__) @attr (mode=1) deftest_learn_1 (): U" "Test Canceled" "    Print 'XXX'    #Raise Skiptest    #print "test_lean_1"    #Pass    #assert 1==2Eq_ (6, 7, Msg=u"Error") @attr (mode=2) deftest_lean_2 (): U" "Test Failed" "    Try:        Print "test_learn_2"Ok_ (4==3,msg="XXX")        Printsys._getframe (). F_code.co_nameexceptException:Printsys._getframe (). F_code.co_name @attr (Mode=2) deftest_lean_3 (): U" "Test Success" "    Pass     defsetUp ():#set_trace ()    Print "0001 Test SetUp"    defTearDown ():Print "0001 Test teardown"

Use the flaky method as follows:

E:\workspace\nosetest_lear\test_case>nosetests-v test_case_0001.py--with-flaky   #带flaky运行, run one time by default, The final output flaky brief report e:\workspace\nosetest_lear\test_case>nosetests-v test_case_0001.py--with-flaky  -- No-flaky-report    #没有flaky报告输出E: \workspace\nosetest_lear\test_case>nosetests-v test_case_0001.py-- With-flaky--no-flaky-report  --max-runs=3--min-passes=1 #成功后只运行一次, run 2 times after failure

  

Using the flaky plug-in to run failure cases in UI Automation tests

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.