Article Title: Use the Bashshell script for functional testing. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Create script
Functional testing is a key part of software development-and Bash loaded into Linux can help you easily complete functional testing. In this article, Angel Rivera describes how to use the Bash shell script to test the functions of a Linux application by running a command. Because this script depends on the return code of the command line, you cannot apply this method to GUI applications.
Functional testing is a phase of the development cycle in which software applications are tested to ensure that software functions are as expected while correctly handling code errors. This is usually done after the unit test of a single module is completed, before the system test of the entire product under load/heavy load conditions.
There are many test tools available on the market to help with functional testing. However, you need to obtain them first, and then install and configure them, which will take up your precious time and energy. Bash can help you avoid these troubles and speed up the testing process.
The Bash shell script has the following advantages:
The Bash shell script has been installed and configured in Linux. You don't have to spend any time preparing it. You can use a text editor provided by Linux such as vi to create and modify Bash shell scripts. You do not need to obtain specialized tools for creating test programs.
If you already know how to develop the Bourne or Korn shell script, it is sufficient to use the Bash shell script. For you, the learning curve does not exist.
Bash shell provides a large number of programming structures for developing very simple to moderately complex scripts.
Suggestions for porting scripts from Korn to Bash
If you already have existing Korn shell scripts and want to port them to Bash, consider the following:
The "print" command of Korn cannot be used in Bash. Instead, the "echo" command is used instead.
The first line of the script must be:
Modify:
Create a Bash shell script for functional testing. these basic steps and suggestions apply to many client/server applications running on Linux.
Record the prerequisites and main steps for running the script:
Divide an operation into several logical groups.
Follow these steps:
Provide comments and instructions in each shell script;
Make an initial backup to create a baseline;
Check the input parameters and environment variables;
Try to provide "usuage" feedback;
Try to provide a "quiet" running mode;
Provide a function termination script when an error occurs;
If possible, provide functions that can execute a single task;
Capture the output of each script when the output is being generated;
Capture the return code of each command line in each script;
Calculates the number of failed transactions;
The error message is highlighted in the output file for identification;
If possible, "real-time" file generation;
Provide feedback during script execution;
Provides a summary of script execution;
Provides an output file that is easy to interpret;
If possible, you can clear the script and return the baseline.
[1] [2] [3] [4] [5] [6] [7] Next page