King Saud University College of Computer and Information Sciences Department of Information Technology CAP312 – Software Engineering II Second Semester 1432/1433 H Assignment #3 Software Testing Q1. Using your java, C# or other programming language skill, derive a checklist of common errors (NOT syntax errors) that could not be detected by a compiler but that could be detected in a program inspection? Dynamic variables are cleared properly when they’re no longer needed Recursive functions have logic to prevent infinite recursion Iterative loops have logic to prevent infinite loops Variables are not in danger of being too limited with large numbers Logic statements are defined correctly Q2. An item in inventory can have a quantity of - 9999 to + 9999, identify the test cases from this specification using partition testing. The equivalence partitions are: 1. If x < -9999 2. If -9999 ≤x ≤+9999 3. If x > +9999 Test cases: {-10,000, -9999, 0, +9999, +10,000} Q3. According to the following discount table, derive the test cases using partition testing The Discount Table Age Discount 0-4 years 100% 5-15 years 50% 16-64 years 0% Older than 64 years 25% The equivalence partitions are: 1. 2. 3. 4. If 0<=age<=4 If 5<=age<=15 If 16<=age<=64 If 64<age Test cases: {0, 2, 4, 5, 10, 15, 16, 40, 64, 65} Q4. You have been asked to test a method called ‘catWhiteSpace’ in a ‘Paragraph’ object that, within the paragraph, replaces sequences of blank characters with a single blank character. Identify testing partitions for this example and derive a set of tests for the ‘catWhiteSpace’ method. Testing partitions are: Strings with only single blank characters Strings with sequences of blank characters in the middle of the string Strings with sequences of blank characters at the beginning/end of string Examples of tests: The quick brown fox jumped over the lazy dog (only single blanks) The quick brown fox jumped over the lazy dog (different numbers of blanks in the sequence) The quick brown fox jumped over the lazy dog (1st blank is a sequence) The quick brown fox jumped over the lazy dog (Last blank is a sequence) The quick brown fox jumped over the lazy dog (2 blanks at beginning) The quick brown fox jumped over the lazy dog (several blanks at beginning) The quick brown fox jumped over the lazy dog (2 blanks at end) The quick brown fox jumped over the lazy dog Etc. (several blanks at end)