mt-solns

mt-solns - Software Testing Quality Assurance...

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

Software Testing, Quality Assurance & Maintenance (ECE453/CS447/CS647/SE465): Midterm Solutions February 10, 2009 This open-book midterm has 5 questions and 90 points. Answer the questions in your answer book. You may consult any printed material (books, notes, etc). Question 1 (20 points): First-uses (10) In the context of a single method, Criterion A. For each def-pair set S = ( n i ,n j ,v ) , TR contains all du- paths d in S . Criterion B. For each def-pair set S = ( n i j ) , such that n j is the ﬁrst use in its basic block, TR contains all du-paths d in S . Identify and explain the subsumption relationships between these criteria, giving examples as necessary. In brief, A and B are identical: visiting the ﬁrst use in a basic block ensures that you visit all uses in the block. (This insight is enough to get full marks.) More formally, observe that, by deﬁnition, A includes all test requirements induced by B . To show equivalence of A and B , we must also show that B subsumes A . Let a test set T satisfy B . To show subsumption, T must also satisfy A . Consider an arbitrary test requirement in A ; such a test requirement is an arbitrary du-path p from def d to use u . We must show that T tours p . 1) If u is the ﬁrst use in its basic block, then B will explicitly include this p and hence T tours test requirement p . 2) Otherwise, u is not the ﬁrst use in its basic block b . Statements in basic blocks are totally ordered, so there exists an unambiguous ﬁrst use u 1 in b . (Since we are positing the existence of a du-path p from d to u , then there can be no def on the unique path between u 1 and u .) Furthermore, we know that B includes the preﬁx 1

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

View Full Document
p 1 of p which goes from d to u 1 , so that T includes a test path t that tours p 1 . Test paths start at initial nodes and ﬁnal nodes; they never stop in the middle of a basic block. Hence path t (and test set T ) must tour p as a consequence of touring p 1 , as required. (10) If n i and n j are in diﬀerent methods, linked by a method call, deﬁne: Criterion A’. For each def-pair set S = ( n i ,n j ,v ) , TR contains all du- paths d in S . Criterion B’. For each def-pair set S = ( n i j ) , such that n j is a ﬁrst use in its method, TR contains all du-paths d in S . Identify and explain the subsumption relationships between A’ and B’, giving examples as necessary. Clearly, A’ still subsumes B’ . Here is an example of a case where B’ does not subsume A’ . void c a l l e r () { def (x ) ; c a l l e e (x ) ; } void c a l l e e (x) { use (x ) ; i f (?) { use (x ) ; // ( * ) } e l s e { } return ; } Note that A’ contains the du-path involving (*) and B’ has no such requirement; it could be satisﬁed with a test set that only executes the empty else branch of the if statement.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 10

mt-solns - Software Testing Quality Assurance...

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

View Full Document
Ask a homework question - tutors are online