Sheet1
For this example you cannot, obviously, test all possible inputs: they are too many Test Plan for your assignment 2 is done as shown here.
However, you do need to test:
§ simple and complex good equations, making sure you try the operators in all orders This sample is an application test.
§ equations with missing numbers Unit tests are done before this test – each class is tested. Table layout is similar.
§ equations with missing operators Look in “testing 4 later units” for more examples, particulary the different types of testing that gets done.
§ equations with symbols not in the list
§ an empty equation If any change is made to code, the entire test got to be run.
§ an equation with a single number So you should consider automating the testing
§ an equation with a single operator What is “Regression Testing”?
§ the bounds of your stacks being breached (if you use a simple array)
§ etc
No. Description/Condition Tested Test Data/Values Expected Output Passed (Y/N) Comments (can include advice to developers about how to replicate the problem, actual output that is not expected, … etc)
1 No Input (no input) Error message
2 Simple addition 12+5 17
3 Commutative property of addition 5+12 17
4 Spaces 12 + 5 17
5 Space at the start 12+5 17
6 Space at the end 12+5 17
7 More than one space 12 + 5 17
8 Subtraction 12–5 7
9 Non-commutative property of subtraction 5-12 -7
10 Multiplication 12*5 60
11 Commutative property of multiplication 5*12 60
12 Division 12/5 2.4
13 Non-commutative property of division 5/12 0.41667
14 Division by 0 10/0 Error message
15 0 divided by a number 0/10 0
16 A single number 120 120
17 A single + + Error message
18 A single – – Error message
19 A single * * Error message
20 A single / / Error message
21 A number followed by + 120+ Error message
22 A number followed by – 120- Error message
23 A number followed by * 120* Error message
24 A number followed by / 120/ Error message
25 A + followed by a single number +120 120
26 A – followed by a single number -120 -120
27 A * followed by a single number *120 Error message
28 A / followed by a single number /120 Error message
29 Three numbers with operators: + followed by + 12+5+8 25
30 Three numbers with operators: + followed by – 12+5-8 9
31 Three numbers with operators: + followed by * 12+5*8 52
32 Three numbers with operators: + followed by / 12+5/8 12.625
33 Three numbers with operators: – followed by + 12-5+8 15
34 Three numbers with operators: – followed by – 12-5-8 -1
35 Three numbers with operators: – followed by * 12-5*8 -28
36 Three numbers with operators: – followed by / 12-5/8 11.375
37 Three numbers with operators: * followed by + 12*5+8 68
38 Three numbers with operators: * followed by – 12*5-8 -42
39 Three numbers with operators: * followed by * 12*5*8 480
40 Three numbers with operators: * followed by / 12*5/8 7.5
41 Three numbers with operators: / followed by + 12/5+8 10.4
42 Three numbers with operators: / followed by – 12/5-8 -5.6
43 Three numbers with operators: / followed by * 12/5*8 19.2
44 Three numbers with operators: / followed by / 12/5/8 0.3
45 two operators together: + followed by + 8++120 128
46 two operators together: + followed by – 8+-120 -112
47 two operators together: + followed by * 8+*120 Error message
48 two operators together: + followed by / 8+/120 Error message
49 two operators together: – followed by + 8-+120 -112
50 two operators together: – followed by – 8–120 128
51 two operators together: – followed by * 8-*120 Error message
52 two operators together: – followed by / 8-/120 Error message
53 two operators together: * followed by + 8*+120 960
54 two operators together: * followed by – 8*-120 -960
55 two operators together: * followed by * 8**120 Error message
56 two operators together: * followed by / 8*/120 Error message
57 two operators together: / followed by + 8/+120 0.06667
58 two operators together: / followed by – 8/-120 -0.06667
59 two operators together: / followed by * 8/*120 Error message
60 two operators together: / followed by / 8//120 Error message
61 A long equation 10 + 8 / 2 – 6 * 5 -16
62 Other operators rejected 10 % 8 Error message
Sheet2
Sheet3