A TEST SCRIPT is a set of instructions that is performed on a system under test to verify that the system performs as expected. They can be written in either a human language (used for manual testing) or a scripting / programming language (used for automated testing). A test script is a part of a test case and a test case can have either a single test script or multiple test scripts. Multiple test scripts are associated with a single test case when:
- Each test script provides a different way to test the scenario in the test case. For instance, a test case might require several scripts to test the scenario in different test environments.
- Both manual and automated scripts exist to exercise the test case.
ISTQB Definition
- test script: A sequence of instructions for the execution of a test.
Some scripting languages used in automated testing are:
- JavaScript
- Perl
- Python
- Ruby
- Tcl
- Unix Shell Script
- VBScript
There are also many Test Automation Tools/Frameworks that generate the test scripts for you; without the need for actual coding. Many of these tools have their own scripting languages (some of them based on a core scripting language). For example, Sikuli, a GUI automation tool, uses Sikuli Script which is based on Python. A test script can be as simple as the one below:
def sample_test_script (self):
type ("TextA")
click (ImageButtonA)
assertExist (ImageResultA)
A test execution engine and a repository of test scripts (along with test data) are collectively known as a Test Harness.
Last Updated on September 9, 2020 by STF