In any real-life activity, what happens before an event determines the way that event happens, whether it happens at all, as well as the eventual outcome.
Software testing also follows this logical sequence: the conditions that exist before a test case is run will determine its success or otherwise.
The set of conditions that must be in place before testing can start are called preconditions.
A real-life example of preconditions
To clarify what I mean by preconditions, consider this example from a real-life situation. Imagine you want to send a handwritten letter to a friend.
The activity in this case is writing the letter with a pen, and the obvious precondition which makes it possible to do so is that you have enough ink in your pen to write the letter with.
Other preconditions which determine whether we’re able to write the letter could be having a clean sheet of paper to write on, and having a pen to begin with!
Preconditions that determine testing success
The preconditions for a test case include the state a system and its environment must be before a specific test can be run. In other words, preconditions specify the setup needed for a test case to be executed successfully.
There are many possible types of settings and conditions that can be preconditions to a given test case but, by and large, preconditions fall under one of the follow three classes:
- A previously executed step in the testing sequence.
- The outcome of a previous step in the testing sequence.
- The availability of existing data needed to run the test case.
Preconditions are generally listed under a separate heading in the written test case. If no preconditions are necessary then this heading would be left empty, but otherwise you should read it carefully to note any steps that need to be carried out before you can execute the actual test.
3 preconditions that are essential for successful test execution
#1 – A properly configured test environment
The test environment must be configured correctly in order for the results to be reliable. With a properly configured test system, many problems can be avoided and a smoother, more efficient testing process achieved.
It isn’t advisable to cut costs by opting for a lower quality test system, as this will ultimately affect the stability and the availability of your final product.
#2 – A process for managing identified defects
Testers must have a way, usually a bug tracking software, for handling any errors that crop up when running test cases. Ideally, this software would be accessible from wherever you are and whatever browser you’re using, in order to make it easier to collaborate with distributed testing teams and provide testers with a high degree of customisability and organisation.
Additionally, standard tools used in popular agile methodologies like Scrum, e.g. agile boards and burndown charts, should be integrated in the software and made available to testing teams at affordable and flexible terms. Integration with third-party testing tools would also be a plus.
ReQtest offers all these benefits and many more.
#3 – A test oracle
Testers must also have a way of distinguishing expected results from unexpected results. A test oracle offers a mechanism for determining whether the program has passed or failed a test.
A test oracle automatically compares the actual output of the system being tested with the likely outcome for the given test-case input.
Writing smarter preconditions
A tip I like to give to fellow testers who find themselves having to write the same preconditions over and over again, is to move repeated preconditions to a test run or test specification instead and thus avoid writing the same instructions several times.
In certain cases, the preconditions field isn’t relevant to a test case, so you may want to include it in the template but leave it blank or else remove the field entirely. With a test management tool like ReQtest, you can easily customise the look of your forms and create templates that save you time and effort when writing test cases.
It is very important that all preconditions are described accurately, otherwise the testers may not be able to conduct the test.
I also highly recommend you avoid using subjective terms like appropriate and punctual and replace them with objective ones; in other words, wherever possible delete adjectives and replace them with numbers which you can measure or events you can actually observe.