Ch3-3-sourceLogic-Triang

# Ch3-3-sourceLogic-Triang - Introduction to Software Testing...

This preview shows pages 1–4. Sign up to view the full content.

Introduction to Software Testing Chapter 3.3 Logic Coverage for Source Code www.introsoftwaretesting.com 2 Logic Expressions from Source Predicates are derived from decision statements in programs In programs, most predicates have less than four clauses Wise programmers actively strive to keep predicates simple When a predicate only has one clause, COC, ACC, ICC, and CC all collapse to predicate coverage (PC) Applying logic criteria to program source is hard because of reachability and controllability : Reachability : Before applying the criteria on a predicate at a particular statement, we have to get to that statement Controllability : We have to find input values that indirectly assign values to the variables in the predicates Variables in the predicates that are not inputs to the program are called internal variables These issues are illustrated through an example in the following slides … Introduction to Software Testing (Ch 3), www.introsoftwaretesting.com

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3 Triang (pg 1 of 5) 1 // Jeff Offutt -- Java version Feb 2003 2 // The old standby: classify triangles 3 // Figures 3.2 and 3.3 in the book. 4 import java.io.*; 5 class trityp 6 { 7 private static String[] triTypes = { "", // Ignore 0. 8 "scalene", "isosceles", "equilateral", "not a valid triangle"}; 9 private static String instructions = "This is the ancient TriTyp program.\nEnter three integers that represent the lengths of the sides of a triangle.\nThe triangle will be categorized as either scalene, isosceles, equilateral\nor invalid.\n"; 10 11 public static void main (String[] argv) 12 { // Driver program for trityp 13 int A, B, C; 14 int T; Introduction to Software Testing (Ch 3), www.introsoftwaretesting.com 4 Triang (pg 2 of 5) 16 System.out.println (instructions); 17 System.out.println ("Enter side 1: "); 18 A = getN(); 19 System.out.println ("Enter side 2: "); 20 B = getN(); 21 System.out.println ("Enter side 3: "); 22 C = getN(); 23 T = Triang (A, B, C); 24 25 System.out.println ("Result is: " + triTypes [T]); 26 } 27 28 // ==================================== Introduction to Software Testing (Ch 3), www.introsoftwaretesting.com
5 Triang (pg 3 of 5) 29 // The main triangle classification method 30

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/17/2012 for the course SWE 637 taught by Professor Offutt,j during the Fall '08 term at George Mason.

### Page1 / 9

Ch3-3-sourceLogic-Triang - Introduction to Software Testing...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online