Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
Good Test

Good Test

Ratings: (0)|Views: 90 |Likes:
Published by alikhan_nazeer80

More info:

Published by: alikhan_nazeer80 on Jan 29, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

02/23/2014

pdf

text

original

 
Good Test Cases Copyright © Cem Kaner 2003. All rights reserved. Page 1
What Is a Good Test Case?
Cem Kaner, J.D., Ph.D.
Florida Institute of Technology
 Department of Computer Sciences
kaner@kaner.com
STAR East, May 2003
 This research was partially supported by NSF Grant EIA-0113539 ITR/SY+PE: "Improving theEducation of Software Testers." Any opinions, findings and conclusions or recommendationsexpressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation (NSF).
Abstract
Designing good test cases is a complex art. The complexity comes from threesources:
 
Test cases help us discover information. Different types of tests are moreeffective for different classes of information.
 
Test cases can be “good” in a variety of ways. No test case will be good inall of them.
 
People tend to create test cases according to certain testing styles, such asdomain testing or risk-based testing. Good domain tests are different fromgood risk-based tests.
What’s a Test Case?
Let’s start with the basics. What’s a test case?IEEE Standard 610 (1990) defines
test case
as follows:“(1) A set of test inputs, execution conditions, and expected results developed for a particular objective, such as to exercise a particular program path or to verify compliancewith a specific requirement.“(2) (IEEE Std 829-1983) Documentation specifying inputs, predicted results, and a setof execution conditions for a test item.”According to Ron Patton (2001, p. 65),“Test cases are the specific inputs that you’ll try and the procedures that you’ll followwhen you test the software.”Boris Beizer (1995, p. 3) defines a test as“A sequence of one or more subtests executed as a sequence because the outcome and/or final state of one subtest is the input and/or initial state of the next. The word ‘test’ isused to include subtests, tests proper, and test suites.
 
Good Test Cases Copyright © Cem Kaner 2003. All rights reserved. Page 2Bob Binder (1999, p. 47) defines test case:“A test case specifies the pretest state of the IUT and its environment, the test inputs or conditions, and the expected result. The expected result specifies what the IUT should produce from the test inputs. This specification includes messages generated by the IUT,exceptions, returned values, and resultant state of the IUT and its environment. Test casesmay also specify initial and resulting conditions for other objects that constitute the IUTand its environment.”In practice, many things are referred to as test cases even though they are far from being fullydocumented.Brian Marick uses a related term to describe the lightly documented test case, the
test idea
:“A test idea is a brief statement of something that should be tested. For example, if you'retesting a square root function, one idea for a test would be ‘test a number less than zero’.The idea is to check if the code handles an error case.”In my view, a test case is a question that you ask of the program. The point of running the test isto gain information, for example whether the program will pass or fail the test.It may or may not be specified in great procedural detail, as long as it is clear what is the idea of the test and how to apply that idea to some specific aspect (feature, for example) of the product.If the documentation is an essential aspect of a test case, in your vocabulary, please substitute theterm “test idea” for “test case” in everything that follows.An important implication of defining a test case as a question is that
a test case must bereasonably capable of revealing information
.
 
Under this definition, the
 scope
of test cases changes as the program gets morestable. Early in testing, when anything in the program can be broken, trying thelargest “legal” value in a numeric input field is a sensible test. But weeks later, after the program has passed this test several times over several builds,
a standalone test of this one field is no longer a test case because there is only a miniscule probabilityof failure
. A more appropriate test case at this point might combine boundaries of tendifferent variables at the same time or place the boundary in the context of a long-sequence test or a scenario.
 
Also, under this definition, the metrics that report the number of test cases aremeaningless. What do you do with a set of 20 single-variable tests that wereinteresting a few weeks ago but now should be retired or merged into a combination?Suppose you create a combination test that includes the 20 tests. Should the metricreport this one test, 20 tests, or 21? What about the tests that you run only once?What about the tests that you design and implement but never run because the program design changes in ways that make these tests uninteresting?
 
Another implication of the definition is that a test is not necessarily designed to expose a defect.The goal is information. Very often, the information sought involves defects, but not always. (Iowe this insight to Marick, 1997.) To assess the value of a test, we should ask how well it provides the information we’re looking for.
Information Objectives
So what are we trying to learn or achieve when we run tests? Here are some examples:
 
Good Test Cases Copyright © Cem Kaner 2003. All rights reserved. Page 3
 
Find defects.
This is the classic objective of testing. A test is run in order to trigger failures that expose defects. Generally, we look for defects in all interesting parts of the product.
 
 
 Maximize bug count.
The distinction between this and “find defects” is that total number of bugs is more important than coverage. We might focus narrowly, on only a few high-risk features, if this is the way to find the most bugs in the time available.
 
 
 Block premature product releases.
This tester stops premature shipment by finding bugsso serious that no one would ship the product until they are fixed. For every release-decision meeting, the tester’s goal is to have new showstopper bugs.
 
 
 Help managers make ship / no-ship decisions.
Managers are typically concerned withrisk in the field. They want to know about coverage (maybe not the simplistic codecoverage statistics, but some indicators of how much of the product has been addressedand how much is left), and how important the known problems are. Problems that appear significant on paper but will not lead to customer dissatisfaction are probably not relevantto the ship decision.
 
 
 Minimize technical support costs.
Working in conjunction with a technical support or help desk group, the test team identifies the issues that lead to calls for support. These areoften peripherally related to the product under test--for example, getting the product towork with a specific printer or to import data successfully from a third party databasemight prevent more calls than a low-frequency, data-corrupting crash.
 
 Assess conformance to specification.
Any claim made in the specification is checked.Program characteristics not addressed in the specification are not (as part of 
this
 objective) checked.
 
Conform to regulations.
If a regulation specifies a certain type of coverage (such as, atleast one test for every claim made about the product), the test group creates theappropriate tests. If the regulation specifies a style for the specifications or other documentation, the test group probably checks the style. In general, the test group isfocusing on anything covered by regulation and (in the context of 
this
 
objective
) nothingthat is not covered by regulation.
 
 
 Minimize safety-related lawsuit risk.
Any error that could lead to an accident or injury isof primary interest. Errors that lead to loss of time or data or corrupt data, but that don’tcarry a risk of injury or damage to physical things are out of scope.
 
 
Find safe scenarios for use of the product (find ways to get it to work, in spite of thebugs).
Sometimes, all that you’re looking for is one way to do a task that will consistentlywork--one set of instructions that someone else can follow that will reliably deliver the benefit they are supposed to lead to. In this case, the tester is not looking for bugs. He istrying out, empirically refining and documenting, a way to do a task.
 
 
 Assess quality.
This is a tricky objective because quality is multi-dimensional. The natureof quality depends on the nature of the product. For example, a computer game that isrock solid but not entertaining is a lousy game. To
assess
quality --
to measure and report back 
on the level of quality -- you probably need a clear definition of the most importantquality criteria for this product, and then you need a theory that relates test results to thedefinition. For example,
reliability
is not just about the number of bugs in the product. Itis (or is often defined as being) about the number of reliability-related failures that can be

Activity (5)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
anilreddy79 liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->