Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.

Slides:



Advertisements
Similar presentations
Defect testing Objectives
Advertisements

Marking Schema question1: 40 marks question2: 40 marks question3: 20 marks total: 100 marks.
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Unit Testing CSSE 376, Software Quality Assurance Rose-Hulman Institute of Technology March 27, 2007.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Testing an individual module
1 Software Testing and Quality Assurance Lecture 14 - Planning for Testing (Chapter 3, A Practical Guide to Testing Object- Oriented Software)
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas.
DAIMI(c) Henrik Bærbak Christensen1 White-box Testing Let us open the box...
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Equivalence Class Testing
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Test Design Techniques
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
TESTING.
CPIS 357 Software Quality & Testing
Class Specification Implementation Graph By: Njume Njinimbam Chi-Chang Sun.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Prof. Mohamed Batouche Software Testing.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Software Engineering Chapter 23 Software Testing Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
What is Software Testing? And Why is it So Hard J. Whittaker paper (IEEE Software – Jan/Feb 2000) Summarized by F. Tsui.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
Contents Introduction Requirements Engineering Project Management
Coverage Literature of software testing is primarily concerned with various notions of coverage Four basic kinds of coverage: Graph coverage Logic coverage.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
Testing Testing Techniques to Design Tests. Testing:Example Problem: Find a mode and its frequency given an ordered list (array) of with one or more integer.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
Chapter 22 Developer testing Peter J. Lane. Testing can be difficult for developers to follow  Testing’s goal runs counter to the goals of the other.
Black-box Testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
CS 217 Software Verification and Validation Week 7, Summer 2014 Instructor: Dong Si
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Equivalence Class Testing In chapter 5, we saw that all four variations of boundary value testing are vulnerable to –gaps of untested functionality, and.
Software Engineering Saeed Akhtar The University of Lahore.
Testing and inspecting to ensure high quality An extreme and easily understood kind of failure is an outright crash. However, any violation of requirements.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
SAFEWARE System Safety and Computers Chap18:Verification of Safety Author : Nancy G. Leveson University of Washington 1995 by Addison-Wesley Publishing.
Dynamic Testing.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Equivalence Class Testing Use the mathematical concept of partitioning into equivalence classes to generate test cases for Functional (Black-box) testing.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Mutation Testing Laraib Zahid & Mariam Arshad. What is Mutation Testing?  Fault-based Testing: directed towards “typical” faults that could occur in.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
Software Testing.
Software Engineering (CSI 321)
Software Testing and Maintenance 1
CompSci 230 Software Construction
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
White-Box Testing.
CHAPTER 4 Test Design Techniques
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
White-Box Testing.
Software testing.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Testing “If you can’t test it, you can’t design it”
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Coverage – “Systematic” Testing Chapter 20

Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how we select those inputs can be important. “Exhaustive” testing uses each possible input or input combination as a test case. However, the input ranges and permutations can be prohibitive. Using subdomains can prevent this: select groups of inputs that might be considered “equivalent”, such as one test “too big” one “too small” and one “just right” (then some others)

Functional (specification-based, blackbox) testing Testing at the system level, using the specification, can be considered “black box” testing. Here, inputs are selected based only on what the specification “defines” The test would have to “guess” what values might provoke a defect. However selecting inputs based on a knowledge of “what goes on inside” (called gray-box or clear- box testing), can allow us to select interesting test inputs that might aggravate defects.

Structural (program-based) testing In addition, if the code is “open” for examination by the tester, the tester can also select values based on the way the program is put together. Some of the more interesting test cases would come from examining control flow within the program ( if, then, else, switch ) or computations, such as those that may cause arithmetic exceptions, such as overflow or divide by zero errors.

Test oracles Another automated test variation is the idea of “test oracles”. Test oracles check the output of the program against the specification. This can happen in the absence of any automation to generate complete test cases. In the case of oracles, this permits the test writer to write the test, the let the oracle determine if the outputs are valid or not.

Marick's Recommendations Brian Marick recommends the following approach: 1.Generate functional tests from requirements and design to try every function. 2.Check the structural coverage after the functional tests are adequate. 3.Where the structural coverage is imperfect, generate functional tests (not structural) that induce the additional coverage. This works because form (structure) should follow function!

Variations on Coverage Testing There are different “types” of coverage testing that cover different aspects of the program. –Control-flow testing –Path coverage –Branch Coverage The difference are subtle, but important.

Control-flow graphs and their coverage Control flow graphs reflect the number of decision points in a program that can transfer or re-direct the program flow. In control-flow coverage, the possible flow of the program through the path are checked to make sure that each statement is executed by some test (node coverage).

Path coverage In the case of path coverage, the control- flow graph is checked against the test cases to ensure that every possible path is taken. Path coverage requires that each possible path and it’s variations are checked. The notion here is that different paths can (and usually does) result in different data transforms.

Branch coverage Branch coverage requires that all branches of a program to be taken, which results in statement coverage. Unlike statement coverage, however, all branches must be covered. Think about a switch statement that has some “cases” that do not terminate in “ break ” statements. Instead, the control “drops through” to the next case statement. Statement coverage does not require each “case” to be tested, but branch coverage does!

Structural-coverage measuring tools Tools to check structural coverage typically “instrument” the code. That is, the tool ‘adds’ code to the program to leave a trail of ‘cookie crumbs’ about where the program has executed. Tools to instrument the code are readily available, such as gcov, which works with the GNU C compiler. However, incrementing code causes problems in time critical systems by increasing execution time.

Dataflow coverage A concept similar to control-flow coverage is dataflow coverage (except that it focuses on the use of data, not control.) We need to follow paths in the program from the point at which a variable is defined or set to the point in which it is used. (“def-use” pairs.) Think of the “define/set” and “use” relations as nodes, then consider the similarities to control- flow graph testing.

Mutation coverage Mutation coverage is a way to “test the tests.” By introducing mutations in the code, we determine if the test detect them. “Weak mutation” coverage occurs if changes in data state are induced by a test and a mutation. “Strong mutation” coverage occurs if a test causes a mutation to manifest itself not only as a change in data state, but a change in an output value as well!

The “subsumes” relationship When looking at testing strategy, it is important to consider which types of testing might “force” other types. For example, branch coverage attains statement coverage as well. In the case where a test strategy subsumes another, the probability of fault detection increases.

Choosing a testing method in practice Practical restraints very often influence the choice of methods: –Resources available: How much time is available, and how many people? –Feasibility: Can it be done in a reasonable amount of time? (Such as full branch coverage testing) –Process: Is the testing process mature enough to support the method?