Tuesday, 19 April 2016

DD Path Testing: Test Results

Within this post, I have included all of the test cases of the 16 I laid out in a previous post along with screenshots of the command prompt which details the actions of the program. For some of the tests, the paths are obviously infeasible due to the nature of the program which I will comment on for each individual test case. I have also included some extra test cases with some more explanations towards the end of the post.

1. Start-(A-B-A)-(D-E-D)-(G-H-J-K-L-G)-End




















Here shows a test case where all of the inputs are valid and the answer it produces is correct, therefore at least we know that the program does work provided it is given the correct input.

2. Start-(A-B-A)-(D-E-F-D)-(G-H-J-K-L-G)-End




Where we input anything other than a number, such as a string 'r' the computer prompts us to enter a valid input. However, there is no way for this path to fully traverse through the program as the computer will not allow us to continue unless we enter the correct amount of 'locations' and they are all valid inputs. As such, this is an infeasible path although in this example, I have let the program to continue to show that if I had inputted an invalid input by mistake, I would still be able to complete my execution.

3. Start-(A-B-C-A)-(D-E-D)-(G-H-J-K-L-G)-End




















For this test case, I entered an invalid input for the number of  'steps', such as a string. Again, it does not allow me to move to the end of the program unless I provide a valid input, i.e. a number. Obviously, if I were to provide a correct input, it would allow me to finish. However, in this test case, the path is infeasible. I have allowed the program to finish as before to show that the program itself is still in working order.

4. Start-(A-B-C-A)-(D-E-F-D)-(G-H-J-K-L-G)-End




















A combination of the two previous test cases where we entered invalid inputs for both the number of 'steps' and the 'locations' also causes the computer to prompt us and waits for a correct value. As the program will never terminate until this is done, this is an example of another infeasible path.

5. Start-(A-B-A)-(D-E-D)-(G-H-J-L-G)-End




This test case simply caters for the if loop within the code where if it comes across two locations which have a greater gap, it sets this value as the new greatest gap. Here, the if statement is not processed as there is no greater gap than 2 in this example. This test is to ensure that the if statement is not always taken within the program, i.e. that there are no bugs concerning this particular statement.

6. Start-(A-B-A)-(D-E-F-D)-(G-H-J-L-G)-End




















Here our test case concerns us entering an invalid input for a 'location' and that the gap between steps does not change, i.e. each gap is 3 units apart in this example. Due to the computer prompting us for a valid value, if we were to continue entering incorrect values, we would not complete the program, rendering this path infeasible. However, I did finish the program in this example to show that the gap does not change even when including invalid inputs to test for bugs.

7. Start-(A-B-C-A)-(D-E-D)-(G-H-J-L-G)-End




This test case covers the path where we - the user - enter an invalid value for the number of 'steps' and where the gap difference has not changed. Like the previous test case, the computer will continue to wait for a correct value so this path is technically infeasible. However, as before, I gave a correct value simply to show that these invalid inputs do not affect the if statement later in the code and does not affect the largest difference.

8. Start-(A-B-C-A)-(D-E-F-D)-(G-H-J-L-G)-End




A combination of the two previous test cases as before, entering invalid inputs for both the number of 'steps' and the 'locations' while the gap difference remains unchanged. As already discussed, this path is also technically infeasible due to the computer refusing to allow us to continue unless we provide a suitable input which we have done here to illustrate the gap not changing.

9. Start-(A-B-A)-(D-E-D)-(G-H-I-G)-End




A similar test case to one earlier, this test covers the path concerning us entering an invalid value for the 'location'. It prompts the user for  a valid input and will continue to do so indefinitely until it receives such an input. An infeasible path, this screenshot clearly showing how we cannot continue until we give the program an acceptable input.

10.Start-(A-B-A)-(D-E-F-D)-(G-H-I-G)-End




Similar test case again where we have entered an incorrect value for a 'location'. It only differs slightly from the previous test case as this test case covers both the second and third while loops in the program ,while the previous only covers the last while loop. While not a significant difference here, it may come in to play in a later test and it is an example of a possible bug within the code. As such, this is also an infeasible path where the computer shall continue to wait for a valid input.

11. Start-(A-B-F-A)-(D-E-D)-(G-H-I-G)-End




This test case accounts for both the number of 'steps' and the 'location' within the third while loop being invalid inputs, such as strings. This obviously results in an infeasible path due to not being able to continue unless the computer receives a value it decides to be acceptable.

12. Start-(A-B-C-A)-(D-E-F-D)-(G-H-I-G)-End




Here our test case concerns again invalid inputs for both the number of 'steps' and for the 'locations' within both the second and third while loop in the code. Again, this does not have much of an affect here, but it is important to ensure all paths are tested, infeasible or not. This path is also infeasible as the computer will continue to prompt as before until it deems an input valid.

13. Start-(A-B-A)-(D-E-D)-G-End




This test case demonstrates what occurs when the user inputs a value less than two, i.e. 1 in this case. As this is technically an invalid output, the program should finish immediately. However, it does ask for a location, the value of which has no bearing on the gap. This is most likely due to the structure of the code which may have a logical fault. As the schematics given to us state that we are not interested in the height of the first step above the ground, this test case will always give the answer of 0. A valid path nonetheless and completely feasible.

14. Start-(A-B-A)-(D-E-F-D)-G-End




A test case which is similar to the above - a step of 1 - and where the values given by us for the 'locations' are invalid. As we expect, the computer prompts us for a valid input, even though it will have no bearing on the answer. As such, this path is infeasible as long as we continue to enter invalid values.

15. Start-(A-B-F-A)-(D-E-D)-G-End




Here our test case covers the situation where we enter an invalid input for the number of 'steps' where the program should finish immediately. As before, the computer prompts us for a valid input. Interesting to note that when we type '0' as a number of 'steps', it does not prompt us at all. Of course, if there are no steps, the program should finish immediately, however here it seems there may be a flaw in the code as the computer is waiting for an input that it has not prompted us for. Obviously, this is another infeasible path.

16.Start-(A-B-C-A)-(D-E-F-D)-G-End




The final test case of the 16 I had originally laid out covers the occasion where we enter invalid values both the number of 'steps' and the 'locations' and the program is supposed to finish immediately. Naturally, the computer prompts us for correct values as before and due to this, the program never finishes as it continues to wait for us.

Of these 16 original test cases, very few are actual feasible paths. There are several that prompt us for valid inputs and the computer will wait indefinitely for us to do this. We also discovered a few possible flaws in the structure of our program, which is the reason we are testing in the first place.

I created a few more test cases based on some of the results I received within the 16 above, based on some of the paths but creating odd errors which must account for a logical error within the program. Below are 4 examples of this and I shall include more in my next post.






The two above I grouped together as they both have errors relating to the same concept. '0' is not recognised as a 'step' or a 'location'. In real life, this makes perfect sense as no ladder would have 0 steps or have the first step on the ground. However, although the program does not prompt us for another value, it is obvious it is waiting for an input that is expected. A reasonable explanation for this is likely because of the conditions for the while loops. If one were to reference the code, it is easy to see why the above occurs.

The next two are simply my being curious of what occurs when I enter the value '1' as a step, attempting to see if other values cause the program to break and give an answer other than 0. The value 1 and -7 seem not to cause any other harm to the program, although -7 should not be accepted as it was due to it being a negative number which is obviously in violation of the rules given to us and a bug within the code.