This is a program and my solution. How many times should I test, if I need full coverage of all possible program flows? Why?
Write a program that prompts the user for a grade (0-100) and, whether the student is a graduate student (Y/N).
you=input("graduate student:")
if you=="Y":
yourgrade=yourgrade*0.9
if yourgrade>89:
print("You got a A")
print("Excellent")
elif yourgrade>79:
print("You got a B")
print("Good job")
elif yourgrade>69:
print("You got a C" )
print("Good try")
elif yourgrade>59:
print("You got a D")
print("Just passed")
else:
print("You got a F")
print("Seek help")
Coverage: Coverage is the term used to determine which are the paths in the program that are checked in the test.
" To get the full coverage, we need to run at least 6 times for this program"
Reason:
There are 6 paths in your program. That is:
Hence, you need at least 6 tests, each for every path.
Example:
Get Answers For Free
Most questions answered within 1 hours.