Test script

A test script is a sequence of instructions for carrying out a test. In manual testing it is the numbered list of steps a person follows, and in test automation it is the code a tool runs. A script carries one or more test cases out, and is written for whoever, or whatever, performs them.

The longer version

The ISTQB glossary defines a test script as "a sequence of instructions for the execution of a test". The wording covers two things that look different on the page. A manual script is prose: open the newsletter sign-up page, type an address with no at sign, press Subscribe, check that the form refuses it and says why. An automated script is code that does the same through a browser driver or an API client and asserts on the outcome. Both tell an executor exactly what to do and in what order, and neither leaves the route to the reader's judgement.

A test case and a test script do different jobs. A case fixes one check: the preconditions, the inputs, any steps and the expected result. A script is the instruction sequence, in prose or in code, that carries one or more cases out. A manual case often holds its own steps, and in that form the words are used interchangeably. They separate once tests are automated. One case may be carried out by a manual script this month and by code the next, and a single automated script can run several cases in a row by looping over rows of data.

The level of detail is a choice. A script precise enough for a newcomer to follow gives the same result whoever runs it, which is what a regression run or an audit needs. That precision has a cost, since every renamed button or reordered screen means editing the scripts that mention it. Detailed scripts suit checks that are repeated or handed over, and one-off investigation is better served by a charter and notes. In the ISTQB Foundation syllabus, manual and automated test scripts are created during test implementation, the activity that follows test design.

Common questions

What is a test script in software testing?

A test script in software testing is a set of instructions that tells a person or a tool how to carry out a test, step by step. Manual scripts are written as numbered steps with the data to enter, and automated scripts are written as code that a test runner executes.

What is the difference between a test script and a test case?

A test case fixes one check: its preconditions, inputs, any steps and the expected result. A test script is the instruction sequence, prose or code, that carries one or more cases out. Where a manual case holds its own steps, the two words are treated as one, and the distinction matters most when one case is run both by hand and by code.

Is a test script always automated?

A test script can be manual or automated. The ISTQB Foundation syllabus refers to manual and automated test scripts side by side. In everyday speech the word often means automation code, so it is worth saying which kind is meant when the context does not make it clear.

What does a manual test script contain?

A manual test script usually contains an identifier, the starting conditions, numbered steps with the exact data to enter, the expected result after each step or at the end, and space to record what happened. The steps are written so that someone who has never used the feature can follow them.

Who writes test scripts?

Testers write manual scripts, often with input from a business analyst or product owner on the expected results. Automated scripts are written by test automation engineers, developers or testers who code. In keyword-driven frameworks, people who do not program assemble scripts from keywords that engineers have implemented.

Bug reports that arrive ready to triage.

Collect replay, console, network and browser context with the Free plan.

<script src="…/widget.js" data-key="pb_pub_…">