Recently I used Perl to write a lot of automated testing tools. I have used some modules and I think it is quite good to record them. I may need to use them in the future.
Smart: Comments
Smart comments provides debugging and tracingCodeYou can print a variable value or trace and display the progress of a loop.
The most ingenious thing is that when you finishProgramWhen you do not need the debugging code, you only need to comment out
Use smart: comments;
This line is enough. When you need to debug the code again, you do not need to add the tracing code again. You just need to reactivate the above line of code.
If you do not use the preceding statement to activate smart comments explicitly in the program, you can activate the smart comments module explicitly when running the script:
$ Perl-msmart: Comments $ application. pl
Provides Perl with functions similar to C ++ macros
If a piece of code needs to be used repeatedly in multiple places, but writing a function is not very suitable. In this case, the best way is to use a macro definition similar to C ++, insert this macro as needed. You can use the filter: CPP module. After installing this module, it is no different from the macro of C ++.
Operate Excel files in perl
currently, many test cases and test reports for testing are written in Excel. Automated testing is required, it is best to use a Perl script to automatically read data from Excel and record the test results in the corresponding position. You can use the following modules to complete the related work:
if you need to read an existing Excel file (PARSE), you can use spreadsheet: parseexcel, applicable to Excel 95-2003. If you are using Excel 2007, you need to use the spreadsheet: XLSX module.
to create a new Excel file and write data, use the spreadsheet: writeexcel module.
to open an Excel file [...]