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 ):