Test Cases For Factorial Program: n! means n(n-1)(n-2)……3,2,1 First, Check the given integer is positive. If the given integer is negative,n! is not defined; if the given number is a fraction,n! If it is not defined, check the given number is 0,n! is 1hope I’ll get an idea…if something is wrong with this….correct me.
Post On: | Test Cases For Factorial Program |
Post Type: | Test Case Template |
Published On: | www.softwaretestingo.com |
Applicable For: | Freshers & Experience |
Get Updates: | SoftwareTestingo Group Link |
n! :n(n-1)(n-2)…..3,2,1.First TC: Check the given integer is positive. If the given number is negative, ExpectedResult: n! is not defined If the given integer is a fraction. n! is not defined TC: check the given number is 0 (0!=1) ER: 1 is displayed Hope I’ll get an idea…correct if it’s wrong
Factorials are represented by n!
Examples:
3! = 1 * 2 * 3 = 6 4! = 1 * 2 * 3 * 4 = 24 5! = 1 * 2 * 3 * 4 * 5 = 120
A factorial program is easy to test because you test the input value for an integer variable related to a single text box and then verify its output value. Here are the test cases:
Test Case For Factorial
Determine the maximum integer value that the computer can calculate in its factorial. This value becomes the upper boundary.
Positive Test Cases
- Submit integer value at lower boundary [ 0 ]
- Submit integer value at lower boundary +1 [ 1 ]
- Submit integer value at the upper boundary -1
- Submit integer value at the upper boundary
Negative Test Cases
- Submit integer value at upper boundary +1
- Submit integer value with leading 0
- Submit integer value with leading plus sign [+]
- Submit integer value with the leading minus sign [-]
- Submit integer value with leading space
- Submit a number with a decimal point
- Submit a number with the letter ‘e’ in it
- Submit alpha character(s)
- Submit special character(s) [ex: !@#$^]
- Submit with only space
- Submit with nothing entered
The Factorial of a given number should not be negative numbers, decimal point numbers, alpha characters, or special characters, and if it is a function, it takes only one parameter.
Thanks for the information