23.04.2015 Views

AutoTest: A Tool for Automatic Test Case Generation in Spreadsheets

AutoTest: A Tool for Automatic Test Case Generation in Spreadsheets

AutoTest: A Tool for Automatic Test Case Generation in Spreadsheets

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

particular, we show how test cases are generated <strong>for</strong> the <strong>for</strong>mula<br />

<strong>in</strong> B9. To test the <strong>for</strong>mula <strong>in</strong> B9 we need to test all rise to 8 DU pairs.<br />

The four def<strong>in</strong>itions comb<strong>in</strong>ed with the two uses <strong>in</strong> B9 give<br />

def<strong>in</strong>itions of D7 and B1 and their uses <strong>in</strong> the <strong>for</strong>mula <strong>in</strong> B9. As mentioned earlier, both def<strong>in</strong>itions of D7 already hit<br />

the use <strong>in</strong> the condition D7 = −1. There<strong>for</strong>e, <strong>for</strong> generat<strong>in</strong>g<br />

test cases <strong>for</strong> the four DU pairs result<strong>in</strong>g from all the<br />

IF(D7 = −1,“Error”,IF(D7 > B1,“Over Budget”,“BudgetOK”))<br />

def<strong>in</strong>itions of D7 and this use, we can solve the sets of constra<strong>in</strong>ts<br />

shown above. S<strong>in</strong>ce the sets {γ T 4 : − 1,γF 3 :0} and<br />

The <strong>for</strong>mulas that affect the def<strong>in</strong>itions of D7 are:<br />

D7 = IF(B8 = 1,−1,D4 + D5 + D6)<br />

{γ F 4 :D4+D5+D6,γT 3 :1} cannot be satisfied,5 we are left with<br />

B8 = IF(OR(B4 < 0,B5 < 0,B6 < 0),1,0)<br />

{γ T 4 : − 1,γT 3 :1} and {γF 4 :D4+D5+D6,γF 3 :0}. The first set of<br />

constra<strong>in</strong>t can be satisfied by sett<strong>in</strong>g value <strong>in</strong> B4 to −1, 6<br />

The constra<strong>in</strong>t tree <strong>for</strong> B9 shows the uses of D7 and B1 <strong>in</strong> and the second set of constra<strong>in</strong>ts is already satisfied by the<br />

B9. Only the constra<strong>in</strong>t γ F 1 ≡ D7 ≠ −1 is needed <strong>in</strong> the values <strong>in</strong> the spreadsheet.<br />

follow<strong>in</strong>g.<br />

To test the use of D7 <strong>in</strong> the condition D7 > B1, we comb<strong>in</strong>e<br />

the def<strong>in</strong>itions of D7 with those of this use to get the<br />

D7 = -1<br />

follow<strong>in</strong>g sets of constra<strong>in</strong>ts.<br />

{γ T 4 : − 1,γT 3 :1,γF 1 :D7 > B1},<br />

g: T<br />

“Error” g F<br />

{γ T 4 : − : D7 > B1<br />

1,γF 3 :0,γF 1 :D7 > B1},<br />

1<br />

1<br />

{γ F 4 :D4+D5+D6,γT 3 :1,γF 1 :D7 > B1},<br />

{γ F 4 :D4+D5+D6,γF 3 :0,γF 1 :D7 > B1}<br />

Two sets of constra<strong>in</strong>ts cannot be solved <strong>in</strong> this case, <strong>for</strong> the<br />

g F g T :“Over Budget” g F g F<br />

:“Budget OK”<br />

same reason discussed above. Moreover, satisfy<strong>in</strong>g γ T 4 : − 1<br />

1 2<br />

1 2<br />

and γ T 3 :1 leads to the output −1 <strong>in</strong> D7, which will not satisfy<br />

The use of D7 <strong>in</strong> the condition D7 = −1 is always executed, γ F 1 :D7 > B1. There<strong>for</strong>e, the only set of constra<strong>in</strong>ts that can<br />

so we do not need to generate any constra<strong>in</strong>ts <strong>for</strong> it. However,<br />

to reach the use of D7 and B1 <strong>in</strong> the condition D7 > B1 already satisfied by the current values <strong>in</strong> the spreadsheet.<br />

be solved is {γ F 4 :D4+D5+D6,γF 3 :0,γF 1 :D7 > B1}, and this is<br />

we need to satisfy the constra<strong>in</strong>t γ F 1 . (S<strong>in</strong>ce B1 is an <strong>in</strong>put Note that, <strong>for</strong>mally, the actual test case is the set of<br />

cell, satisfy<strong>in</strong>g the constra<strong>in</strong>t γ F 1 fully tests all DU associations<br />

of B1 <strong>in</strong> B9.)<br />

pair. Only the generated values are shown <strong>in</strong> the <strong>Auto<strong>Test</strong></strong><br />

address-value pairs that satisfy the constra<strong>in</strong>ts <strong>for</strong> a DU<br />

The constra<strong>in</strong>t tree <strong>for</strong> the <strong>for</strong>mula <strong>in</strong> B8 is shown below. <strong>in</strong>terface—the values <strong>for</strong> the other <strong>in</strong>put cells that affect the<br />

The two leaves represent two def<strong>in</strong>itions <strong>for</strong> which we have <strong>for</strong>mula output that are already <strong>in</strong> the spreadsheet are implicitly<br />

part of the test case and not shown <strong>in</strong> the <strong>in</strong>terface.<br />

the constra<strong>in</strong>ts:<br />

γ T 3 ≡ B4 < 0 ∨ B5 < 0 ∨ B6 < 0<br />

OR(B4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!