• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

Desk Checking (1 Viewer)

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
I have this algorithm and was asked how many unique paths are there through the algorithm. I got two but i just want to make sure.

Its the image attached to the post.
Also, i need to design a set of test data to perform path and decision coverage testing. Is that just checking if the statements work? What does it mean by "perform "path""? And desk checks would just be the results of the test data that i put through the algorithm? Would i just say "successful" and "non successful' ?
Thanks for ur help :)
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Basically just create a set of test dummy data, and draw up a few columns, for each columns, they would represent the variables in the algorithm, which change in value.
 

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
Winston said:
Basically just create a set of test dummy data, and draw up a few columns, for each columns, they would represent the variables in the algorithm, which change in value.
Cool, did that found an error. How many paths through the algorithm did u find?
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
There are more than two paths. Consider the possbilities with the IF statements.
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Lets look at the IF statement section only:

Code:
IF CurrentTemp => Temp THEN
  Turn off heat element
ELSE
  IF CurrerntTemp < Temp - 5 THEN
    Turn off heat element
  ENDIF
ENDIF
1) the first Turn off executes (CurrentTemp => Temp)
2) the ELSE block executes, but does not go into the second IF (CurrentTemp < Temp, AND CurrentTemp => Temp - 5)
3) the second Turn off executes (CurrentTemp < Temp, AND CurrentTemp < Temp - 5)

ie, there are 3 possible paths in the IF block.
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Yes three paths through the decision block within the loop of this particular algorithm.

However this is because we know what the algorithm is (including its errors). In general each IF should generate two possible paths, so in your example their are two IFs meaning 2^2 or 4 paths. If there we three IFs then there would be 2^3 or 8 paths. I guess it depends on the purpose of the test data, if it is to ensure all statements are executed then 3 sets of test data does the trick, however to test the logic you really need 4 sets of test data. (ie in your example three sets would not uncover the problem of the heat element not being turned on).

However then there is the loop itself to consider. Obviously the loop could execute 1 or more times, perhaps infinitely. Generally for post-test loops it's a good idea to design test data that includes just a single iteration, and another set that includes two iterations. For pre-test the situation is clearer, design a test data set that causes zero iterations (ie doesn't enter the loop) and another that causes just one iteration. Note that you can incorporate these tests within your decision block test data, for example a test data set could test one iteration and both conditions true.

HTH
Sam
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top