I need help creating test cases for the below functions, with the following description outlining the type of test cases
Posted: Sun May 15, 2022 11:43 am
I need help creating test cases for the below functions, with
the following description outlining the type of test cases I need.
I seem to missing two test-cases in my below code as I'm running my
code against inputted test cases in the program.
Here is description:
Here are the functions I'm testing:
Below are the current test-cases I have:
Could I also get assistance filling out this table using
whats bolded below to describe the test-cases inputed above ^^:
Programming Exercise Krusty plans to use the program you have written in Q1 - Payment Options to cancel orders by entering negative numbers as the ordered quantity. He requests to make sure that the program calculates the correct tax levied to ensure that the numbers are correct during the yearly tax filing exercise i The improvements made to the program in Q2 - Arrays: Lists and Tuples should be carried across to this question. Tax rate cannot be negative and if a negative value is entered the function must return e. If the argument for total or rate is not numeric, raise a TypeError exception with an appropriate error message. Create test cases to verify that the get_gst() function is behaving correctly by completing Table 1 in test_plan.md. Then, implement all your test cases in the provided test driver program, test_krusty.py. The unit tests for get_gst() should raise an AssertionError if a test is not passed and should not raise an AssertionError if all tests pass. You may add additional columns to the table but the following columns and its information must be present in your submission:
Krusty is also worried that the Tax Man will accuse him of under-reporting his actual sales. Test your program thoroughly to check that the total amount calculated for each transaction is correct and report your findings to Krusty.
def get_subtotal(price: float, quantity: int) -> float: return (price * quantity) def get_gst(total: float, rate: int) -> float: if rate == 0: return else: return float(format((math.ceil(total * rate) /100), '.2f'))
import krusty as ky == 0 assert ky.get_gst(100.0, 5) == 5 assert ky.get_gst(100.0, -5) assert ky.get_gst(100.0, 0) assert ky.get_gst(0.0, 100) == 0 assert ky.get_gst(100.0, 4) == 4 assert ky.get_gst(-100.0, 5) == -5 assert ky.get_gst(-100.0, -5) == 0 try: val = ky.get_gst("mock string", "mock string") = val ky.get_gst(100.0, "mock string") val = ky.get_gst("mock string", 5) assert False except TypeError: pass except Exception: assert False
the argument for total or rate is not numeric, raise a TypeError exception with an ppropriate error message. Create test cases to verify that the get_gst() function is behaving orrectly by completing Table 1 in test_plan.md . Then, implement all your test cases in the rovided test driver program, test_krusty.py. The unit tests for get_gst() should raise an ssertionError if a test is not passed and should not raise an AssertionError if all tests pass. ou may add additional columns to the table but the following columns and its information must be resent in your submission: 15 16 **Test Cases** 17 Table 1. Summary of test cases for 'get_gst() function. 18 | Test ID Description | Inputs | Expected Output | Status | 19 --- ------ 2001 shout - Positive Case. hey HEY! | Fail 21 22 | I 23 24 # 25 26 Table 2. Summary of test cases for total transactions. 27 | Test ID Description | Inputs | Expected Output Status | 28 29 | 30 • Test ID: The identification number for each test case. This should be unique for each case. • Test Case Description: A statement that includes the type of test and scope of test. • Inputs: Exact data used as the input for this test case. • Expected Output: The exact output of the unit or system after test execution. This can be specific values, error messages or messages to the terminal. • Status: Outcome of testing - pass or fail.
the following description outlining the type of test cases I need.
I seem to missing two test-cases in my below code as I'm running my
code against inputted test cases in the program.
Here is description:
Here are the functions I'm testing:
Below are the current test-cases I have:
Could I also get assistance filling out this table using
whats bolded below to describe the test-cases inputed above ^^:
Programming Exercise Krusty plans to use the program you have written in Q1 - Payment Options to cancel orders by entering negative numbers as the ordered quantity. He requests to make sure that the program calculates the correct tax levied to ensure that the numbers are correct during the yearly tax filing exercise i The improvements made to the program in Q2 - Arrays: Lists and Tuples should be carried across to this question. Tax rate cannot be negative and if a negative value is entered the function must return e. If the argument for total or rate is not numeric, raise a TypeError exception with an appropriate error message. Create test cases to verify that the get_gst() function is behaving correctly by completing Table 1 in test_plan.md. Then, implement all your test cases in the provided test driver program, test_krusty.py. The unit tests for get_gst() should raise an AssertionError if a test is not passed and should not raise an AssertionError if all tests pass. You may add additional columns to the table but the following columns and its information must be present in your submission:
Krusty is also worried that the Tax Man will accuse him of under-reporting his actual sales. Test your program thoroughly to check that the total amount calculated for each transaction is correct and report your findings to Krusty.
def get_subtotal(price: float, quantity: int) -> float: return (price * quantity) def get_gst(total: float, rate: int) -> float: if rate == 0: return else: return float(format((math.ceil(total * rate) /100), '.2f'))
import krusty as ky == 0 assert ky.get_gst(100.0, 5) == 5 assert ky.get_gst(100.0, -5) assert ky.get_gst(100.0, 0) assert ky.get_gst(0.0, 100) == 0 assert ky.get_gst(100.0, 4) == 4 assert ky.get_gst(-100.0, 5) == -5 assert ky.get_gst(-100.0, -5) == 0 try: val = ky.get_gst("mock string", "mock string") = val ky.get_gst(100.0, "mock string") val = ky.get_gst("mock string", 5) assert False except TypeError: pass except Exception: assert False
the argument for total or rate is not numeric, raise a TypeError exception with an ppropriate error message. Create test cases to verify that the get_gst() function is behaving orrectly by completing Table 1 in test_plan.md . Then, implement all your test cases in the rovided test driver program, test_krusty.py. The unit tests for get_gst() should raise an ssertionError if a test is not passed and should not raise an AssertionError if all tests pass. ou may add additional columns to the table but the following columns and its information must be resent in your submission: 15 16 **Test Cases** 17 Table 1. Summary of test cases for 'get_gst() function. 18 | Test ID Description | Inputs | Expected Output | Status | 19 --- ------ 2001 shout - Positive Case. hey HEY! | Fail 21 22 | I 23 24 # 25 26 Table 2. Summary of test cases for total transactions. 27 | Test ID Description | Inputs | Expected Output Status | 28 29 | 30 • Test ID: The identification number for each test case. This should be unique for each case. • Test Case Description: A statement that includes the type of test and scope of test. • Inputs: Exact data used as the input for this test case. • Expected Output: The exact output of the unit or system after test execution. This can be specific values, error messages or messages to the terminal. • Status: Outcome of testing - pass or fail.