Python scripts solve some tedious Test Problems

Source: Internet
Author: User
Python scripts solve some tedious Test Problems

Release: | Author: Unknown | Source: LED testing software testing network editing | view: 47 | go to the software testing forum for discussion

Python scripts solve some tedious Test ProblemsSoftware Testing

Use the Python script: The Upload File named “stab_case.txt "to delete the files under the specified folder (including subfolders.

# Coding = UTF-8

Import OS

Workdir = OS. getcwd () # do not modify

# Provides a complete set of reports on board troubleshooting error cases. You do not need to change the report name unless the generated report name changes.

G_resulttxtname = pai'stab_case.txt ',]

# IfProgramYou do not need to set it when copying data to cases \ case.

# Otherwise, it is written as the absolute path for storing such cases: 'e: \ render \ cases \ case'

Casepath = workdir

Def deletefile (filepath ):

Try:

If not OS. Path. exists (filepath ):

Print filepath, "not exist! "

Return 0

If not OS. Path. isfile (filepath ):

Print filepath, "is not a file! "

Return 0

OS. Remove (filepath)

Print "delete", filepath, "succeded! "

Return 1

Except t:

Print "delete", filepath, "failed! "

Pass

Return 0

Def analysereport (txtpath ):

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.