Docsity

Midterm Examination Solutions - Fall 2005 - Computing For Life Sciences | CS 59000, Exams of Computer Science

Toggle sidebar
bg1
Department of Computer Science
Purdue University, West Lafayette
Fall 2005: CS 590T Model Based Software Testing
Midterm Examination (Solutions)
Thursday October 6, 2005 4:30pm-6pm, REC 227
Maximum points: 25
Name: Aditya Mathur
All answers are in red. [Revised version of solutions based on corrections by students.
10/13/05.]
Q 1 Application Pis under test. The input domain of Pcan be partitioned into two subsets: V
consisting of input values that satisfy the constraints on the input variables and Nconsisting
of input values that do not satisfy the constraints on the input variables.
(a) What type of testing selects test inputs mostly from N?
◦Robustness testing ◦Stress testing
0.5 point
(b) Imagine, and list, at least one aspect of Pthat might need stress testing ?
0.5 point
Handling of incoming requests that might be held in a buffer by Pprior to processing.
In this case, stress testing will aim at detecting errors in handling buffer overflows
and possibly unacceptable performance degradation when “too many” transactions
arrive at Pin a short interval.
(c) Regression testing is most likely to be used in which phase of the software lifecycle for
P? (Select one)
◦Design ◦Coding ◦Unit testing ◦Maintenance
0.5 point
(d) Offer one reason why robustness testing might be recommended for Pdespite the fact
that Psatisfies all requirements as determined through functional test.
0.5 point
Incompleteness and ambiguity in requirements as well as errors made by the pro-
grammer in handling unexpected values, make robustness testing necessary.
pf3
pf4
pf5
pf8

Partial preview of the text

Download Midterm Examination Solutions - Fall 2005 - Computing For Life Sciences | CS 59000 and more Exams Computer Science in PDF only on Docsity!

Department of Computer Science Purdue University, West Lafayette

Fall 2005: CS 590T Model Based Software Testing Midterm Examination (Solutions)

Thursday October 6, 2005 4:30pm-6pm, REC 227 Maximum points: 25

Name: Aditya Mathur All answers are in red. [Revised version of solutions based on corrections by students. 10/13/05.]

Q 1 Application P is under test. The input domain of P can be partitioned into two subsets: V consisting of input values that satisfy the constraints on the input variables and N consisting of input values that do not satisfy the constraints on the input variables.

(a) What type of testing selects test inputs mostly from N?

◦ Robustness testing ◦ Stress testing 0.5 point

(b) Imagine, and list, at least one aspect of P that might need stress testing? 0.5 point Handling of incoming requests that might be held in a buffer by P prior to processing. In this case, stress testing will aim at detecting errors in handling buffer overflows and possibly unacceptable performance degradation when “too many” transactions arrive at P in a short interval. (c) Regression testing is most likely to be used in which phase of the software lifecycle for P? (Select one) ◦ Design ◦ Coding ◦ Unit testing ◦ Maintenance 0.5 point (d) Offer one reason why robustness testing might be recommended for P despite the fact that P satisfies all requirements as determined through functional test. 0.5 point Incompleteness and ambiguity in requirements as well as errors made by the pro- grammer in handling unexpected values, make robustness testing necessary.

(e) A tester is testing the GUI of P by selecting suitable menu items, buttons, and other widgets and observing visually if the GUI performs as expected. What type of testing is the tester performing? (Select one) 0.5 point ◦ Black box ◦ White box (f) Suppose that P contains no loops but has n > 0 if-then statements arranged in se- quence (not nested). Assume that the length of a path is measured in terms of the number of blocks, not necessarily distinct, along the path. Answer the following. 2 points Maximum number of distinct paths in P = 2n Number of basic blocks in P = 2n + (2) Length of the longest path in P = 2n + (2) Length of the shortest path in P = n + (2) (2) is necessary when the start and exit are treated as separate blocks.

Q 2 The ls command in Unix/Linux is to display the contents of a directory. The format of the ls command is:

ls options [pathnames]

where options is a list of options and [pathnames] is an optional list of directory names the contents of which are to be displayed. While there is a rather long list of options available, we restrict to two: -a and -C. The -a option “Shows you all files, even files that are hidden (these files begin with a dot.).” The -C option produces “Multi-column output with entries sorted down the columns. Generally this is the default option.” Your task is to apply uni-dimensional equivalence partitioning and boundary value analysis to generate test cases to test an implementation P of the ls command. Do not ignore the fact that files and directories also serve as input to P. While deriving the input data, you do not need to list the contents of a file or directory; simply indicate what should be the properties of the file/directory. Label your equivalence classes as E 1 , E 2 , and so on. List the equivalence classes, and a sample test input for each class, in a suitably chosen tabular format. Mark the tests so that it is clear which tests you derived using equivalence partitioning and which ones using boundary value analysis. 5 points Eq. Class Description Test Based on options E1∗^ ls commands with no options ls E2 with -C option ls -C E3 with -a option ls -a E4 with illegal options ls -+ Based on pathnames E5 Commands with valid path names E6 with invalid pathnames E7∗^ with empty pathname E8∗^ with very long valid path names Based on directory contents E9 Directories with only hidden files E10 Directories with no hidden files E11 Directories with a mix of hidden and other files E12∗^ Huge directory E13∗^ Empty directory ∗ (^) From BVA.

Q 3(a) Consider the following predicate p : a = b ∧ ¬c ∨ d > e, where a, b, d, e are integers and c is Boolean. Derive a BRO constraint set S for p. Clearly show the tree used to derive S. 2 points

a=ba=b cc d>ed>e

VV

St={(=)}St={(=)}

Sf={(<, >)}Sf={(<, >)}

St={(t)}St={(t)}

Sf={(f )}Sf={(f )}

St={(>)}St={(>)}

Sf={(=, <)}Sf={(=, <)}

St={(f )}St={(f )}

Sf={(t)}Sf={(t)}

VV

St={(=, f )}St={(=, f )}

Sf={(<, f ), (>, f ), (=, t)}Sf={(<, f ), (>, f ), (=, t)}

St={(=, f, =), (=, t, >)}St={(=, f, =), (=, t, >)}

Sf={(>, f, =), (<, f, <), (=, t, <)}Sf={(>, f, =), (<, f, <), (=, t, <)}

(b) Use S to derive a sample set T of test inputs. 1 point Test Constraint a b c d e p p 1 p 2 t 1 (>, f, =) 3 2 f 3 3 t 2 (<, f, <) 2 4 f 3 4 t 3 (=, t, <) 1 1 t 2 5 t 4 (=, f, =) 5 5 f 0 0 t f f t 5 (=, t, >) 4 4 t 4 2

(b) Given that |X| = nx, |Y | = ny , |Q| = nq , and |O| = no, answer the following.

(Maximum) Depth of T T = nq + 1

Maximum length of the string required to distinguish any two states in M = nq − 1

Maximum number of times a state could occur in T T =nq × (nx − 1) + 2

Minimum number of times a state could occur in T T = 1

The minimum value of no (ny ) if each state in M is distinguished by a string of length 1=nq

Maximum length of a string required to detect a transfer error in M’=(nq ) + (nq − 1)

Maximum length of a string required to detect an operation error in M’=nq 3.5 points (c) Suppose FSM M is such that X = {a, b}, Y = { 0 , 1 }, Q = {q 0 , q 1 , q 2 , q 3 }, q 0 is the start state, and the transition and output functions are as in Figure 1. Construct the k-equivalence partition tables to determine if M is minimal. If it is, then find its characterization set W. 4 points

q0 q

q3 q

a/

a/

b/1 b/ a/

b/

a/

b/

Figure 1 FSM for Q 4(c). Note that edges q 1 − q 2 and q 2 − q 0 have multiple labels.

P 1 = {Σ 1 , Σ 2 , Σ 3 }, where Σ 1 = {q 0 , q 1 }, Σ 2 = {q 2 , }, Σ 3 = {q 3 } P 2 = {Σ 1 , Σ 2 , Σ 3 , Σ 4 }, where Σ 1 = {q 0 }, Σ 2 = {q 1 , }, Σ 3 = {q 2 , }, Σ 4 = {q 3 } W = {a, b, aa} (Other answers are also possible.)

Q 5 What are the roles of the three characters shown on the cover page of “Foundations of Soft- ware Testing” used in CS 590T? Express your answer using terminology from software engi- neering. One small pan pizza with 3 toppings of your choice. None of the given answers was correct though two were close. Continue thinking!

End of Questions.