Writing Test Scripts
Write a function that receives total mark of a subject and calculates the grade for that. For a 3 credit subject, if one gets total mark in between 240 to 400 (inclusive), s/he will get A. For mark in between 210 to 239, s/he will get B and in between 180 to 209, will get C. For a mark less than 180, s/he will fail (receive F grade). For a 4 credit subject the range of marks for A, B, and C are 320-400, 280-319, 240- 279, respectively. Any mark less than 240 will earn F grade. Note that any fractional mark will be rounded up to next integer value.
You are to do unit test by writing a test driver using any programming language. You have to use J-Unit for testing.
Test outcome will be successful by checking the following:
- i) Correct grade is calculated for any valid input.
- ii) Proper message is shown for any invalid input.
You have to write the test script for generating the following categories of test data:
- i) Mark to test each grade.
- ii) Boundary values (fractional) for each grade.
- iii) Invalid numbers that exceed lower and upper bound.
- iv) Non-number input.
You will get bonus mark if you can add more test cases in addition to the abovementioned ones.







