Developers use test plans that check a range of types of data under different circumstances.
A test plan is a list of requirements designed to ensure that the coded solution works as expected. The test plan will include specific instructions about the data and conditions the program will be tested with.
We can use a test plan to check the following section of code to see if there are any errors.
first = input("Input the first number") second = input("Input the second number") print("The sum is",first+second)
A simplified test plan might look like the following table:
|Feature||Test cases||Expected result||Actual result|
|Addition of whole numbers||1st: 0, 4, 44, 4444 and 2nd: 0, 4, 44, 4444||0, 8, 88, 8888||00, 44, 4444, 44444444|
|Addition of decimals||1st: 1.0, 1.2, .01 and 2nd: 1.0, 1.2, .01||2.0, 2.4, 0.02||1.01.0, 1.21.2, .01.01|
|Handling of strings||1st: one, two and 2nd: one, two||Syntax error because it can't add strings together||oneone, twotwo|
To fix this semantic error, you would need to convert both values into an integer. One solution would be to perform an in-line integer conversion on each of the first two lines. For example:
first = int(input("Input the first number"))