Testing script generally refers to a series of instructions for a specific test, which can be executed by automated test tools.In order to improve the maintainability and reusability of test scripts, they must be built before execution.It may be found that some operations will occur in severalTest processMedium.Therefore, the target of these operations should be determined purposefully, so that their implementation can be reused.Test scripts are computer-readable instructions that automatically execute the test process (or part of the test process).Test script can be created (recorded) or automatically generated by test automation tools, or completed by programming language, or by integrating the first three methods.
When changing the target software, you need toTest processMake local and controllable changes.This will make the test process and test script more adaptable to changes in the target software.For example, suppose that the login portion of the software has changed.After traversing alltest caseIn, only the test process and test script for login need to be changed.
The test script is for a test process.A test process often needs a lot of data to test.All input data of the script obtained through automatic recording are constant and fixed.
If you need to use a test script to test multiple groups of data, you need to parameterize the script and change the fixed constant to a variable from the data source.
definition
Announce
edit
Test scripting language is a kind of scripting language. To be precise, it is a branch of scripting language in the field of testingAutomated software testingBasis of design.To understand the test script language, it is necessary to have some understanding of the script language.
scripting language (scripting language) is a programming language that mainly interprets during execution, such as the common perl, python, php, tcl, guile, ruby, and various shells of UNIX systems are scripting languages, whose execution efficiency is not as high as that of compiled programs, such as programs written in C, C++, Java, Pascal, and other languages.
When scripting language is applied to the field of testing, it can be called testingscripting language All the script languages mentioned above can be used as test script languages, especially the tcl language is called the de facto test script language standard by the industry.With the development of software testing, various testing tools have also been launched. In order to protect intellectual property rights or trade secrets, most of these commercial software use their own test script languages, such as MI's TSL language.
classification
Announce
edit
Linear script: the script obtained by recording manually executed test instances.This script includes all keystrokesFunction keys、arrowControl keys of control test software and number keys for data input.
Structured script: similar toStructured ProgrammingStructured scripts contain instructions that control script design.These instructions are either control structures or call structures.
Shared script: The script may be used by multiple test cases.
Data driven script technology: store test input in a separate file, rather than in a script.
Keyword driven script: logical extension of more complex data driven technology.
Development history
Announce
edit
Here we review the history of script language with the development of tcl language. Commercial test script language is generally developed with the development of commercial test software, and will not be introduced in detail here.
Professor John Ousterhout, inventor of Tcl/Tk, wasberkeley university Professor.In his teaching process, he found that in integrated circuit CAD design, a lot of time was spent on programmingtesting environmentOn.In addition, once the environment changes, the code should be modified to adapt to the new environment.This laborious and inefficient method forced Professor Ousterhout to try to find a new programming language, which should not only have good code reusability, but also be easy to learn, which led to the emergence of Tcl (Tool Command Language) language.
Tcl's original idea was to follow a component-based approach to programming, that is, instead of writing hundreds of lines of program code for a single application program, it would be better to find a way to divide the program into small, reusable components with certain "complete" functions.These small components are small enough to basically meet the needs of some independent applications, and other parts can be generated based on the functions of these small components.Different components have different functions for different purposes and can be used by other applications.Of course, this language also needs good extensibility so that users can add new functional modules to it.Finally, these components need to be "glued" together with a strong and flexible "glue" so that each component can "communicate" with each other and work together.Program design is like a jigsaw puzzle. This design idea coincides with the later Java.Finally, in the spring of 1988, the powerful and flexible glue Tcl language was invented.
In the 1980sgraphical user interfaceWhen it became popular, Professor Ousterhout needed a powerful and flexible control integration tool to enable component-based design.These ideas came into being when we first thought about Tcl. Professor Ousterhout thinks that embedded command languages like Tcl arescripting language It will be useful for integrating components.Professor Ousterhout decided to create some GUI components as an extension of Tcl and use Tcl to integrate these components into the GUI to practice this theory.This extension becomes Tk.
Tcl was founded withOpen sourceBy the early 1990s, the Tcl language had been widely developed and supported by large manufacturers, such as SUN, and gradually formed a tcl community, which gradually led to the development of commercially profitable products. At the same time, Tcl will continue to develop open source productsTCL languageIt has entered two different development tracks, and also promoted the development and application of tcl language.
work
Announce
edit
characteristic
1. The characteristics of scripting languages can be seen from the following comparison between tcl/tk and C++and java.
2. High performance of C++, Tcl/Tk and Java
3.C++
4.Tcl/Tk
5.Java
6. Running program speed
7. Quick
8. Comparable with C++
9. Slow
10. Commissioning difficulty
11. Complex code needs to be recompiled after each modification
12. Simply modify the code and run it directly
13. It is relatively simple to modify the code and recompile it to ByteCode, and the compilation speed is very slow
The basic working principle of scripting language can be illustrated with the following diagram
script interpreter
scriptinterpreterIt is the core of scripting language work. It completes the execution of all specific instructions or functions. The extension implements the interface with other languages, making it possible for scripting language to run C/C++, java and other functions;At the same time, commands and functions can be defined in the user's specific application, which makes the application more flexible;As an interpreter, it also provides basic built-in instructions or functions. The built-in commands (functions) provided by different manufacturers and versions of the interpreter may be different.