|
Back to Test Basics In last month's newsletter I explored the topic of software safety, and how the scale of software failures has escalated from humorous inconveniences to life-threatening gravity. In this newsletter I will discuss some specific ideas for software testing, so we hopefully can minimize the damage our software might cause. First, the bad news. For an arbitrary program we can never say:
Now, some good news. But it requires understanding what software testing really means, and I am always disturbed that many Quality Assurance people do not subscribe to these definitions. In his classic The Art of Software Testing, now in a completely updated 2nd edition, Glenford J. Myers offers the following rock-solid principles:
I hope these principles give you reason to pause a bit. What Myers is saying is: if you just show that a program's functions work, you have not yet tested the program. A successful test is one that breaks the program, not shows the software works as intended. Let's explore just a little, simple theory about software. Every program takes inputs, processes those inputs, and produces outputs. So we can think of a program as a transformer: transforming those inputs to outputs. What can we say about inputs and outputs? The figure below shows that inputs and outputs are either valid, or invalid, for the program. This means we have 4 mappings, or scenarios, we must consider.
Scenario A denotes the program receiving valid inputs, and producing valid outputs. This is the desirable case, but signifies a test that verifies the program operates as intended. Lets assume the program returns the square root of an integer. In Scenario A I pass "16" to the program, and it correctly returns "4". Scenario B denotes the program receiving invalid inputs, and producing valid outputs (e.g., an error or exception message). This again is a desirable case to verify the program operates as intended. I pass "-3" to the program and it correctly returns "Input integer must be non-negative". Testing gets interesting as we move to the right-hand column. In Scenario C we provide valid inputs, but the program produces invalid outputs. We call this a "bug" - e.g., we pass "16" to our program and it returns "4.398". In Scenario D we pass an invalid input, and receive an invalid output. This used to be called "GIGO" - Garbage In, Garbage Out. (Interesting that we do not hear this phrase very often anymore.) This scenario describes passing "-9" to our program and it returns "3", instead of an error message. Now, where is the good news in this? It is in our ability, if we so choose, to approach our software using these simple categories. For developers, we should appropriate the concepts in Bertrand Meyer's Design By Contract. Design By Contract, which is actually implemented in the syntax of his language Eiffel, incorporates the specification of pre-conditions and post-conditions for each method. Pre-conditions are expressions that must be true for the method to perform its function correctly - i.e., the valid input conditions. Post-conditions are boolean conditions describing the result of the method's execution - i.e., the valid output responses. For testers, this approach yields a method for identifying test cases for both black box and white box testing. When a tester can completely characterize the valid inputs to a method, the tester has also characterized the inverse set of all the invalid inputs. There is much more detail we could discuss, such as the Cartesian product set defined by multiple inputs to a program or method, or how to efficiently choose representative subsets of test data from test sets that are normally staggeringly huge. I encourage developers, testers and business system analysts to incorporate thinking in terms of valid and invalid inputs and outputs. And read as much as you can about test basics and techniques. Here are some books I can easily recommend to assist you:
Have a productive month, Gary K. Evans |
Subscribe to our newsletter! Send an email to You will find all prior About Evanetics Evanetics provides on-site consulting, training, and assessments for teams and management in Business Analysis, Object-Oriented Modeling with UML, Project Definition, Iterative process, RUP, Agile principles and practices. Phone: 803-781-7628
Evanetics is an Endorsed Education Provider (EEP) for the International Institute of Business Analysis Leverage Personas Personas are a technique that became very popular with use case specification, but they provide value in many areas of software specification. A persona is a description of a mythical, potential user of your software. I have used presonas on most of my projects so we can be sure our products are truly usable. Here is an example of some personas on a project I did several years ago. It was a software solution for managing and maintaining coin-operated vending machines. One category of user was the Route Driver who would refill these machines. Another category of user was the Warehouse Manager, who established driver routes, and assigned drivers to those routes. Dolly was a Route Driver who used our hand-held implementation. She was in her mid-40s, divorced with two teenage children. She was physically strong with a determined personality. She would load her hand-truck with pastries, confections, or sodas, and service each machine on her route. Each machine service order was described by a Plan-O-Gram - an inventory description and set of directives on what should go into each vending machine. Dolly wanted our system to let her see the whole Plan-O-Gram at a glance, and to allow her to record only the changes she made to the machine, rather than forcing her to verify each entry in her Plan-O-Gram. With Dolly in mind, we tailored our functionality to assist her in how she wanted to do her job. And Dolly was a complete fiction, a contrivance. She wasn't real, nor was Ralph the Warehouse Manager. But Dolly and Ralph were real members of our project. Keeping their needs in mind helped us define useful user experiences, that a traditional "The system shall do..." specification could never accomplish. |
|
Published by: Evanetics, Inc.13 Stonebriar Road Columbia, SC 29212 803-781-7628 Copyright (C) 2010 Evanetics, Inc. All rights reserved. www.evanetics.com |
|