Question
You are required to design concrete test cases based on the test conditions defined in sub-task 2.1. Note that: Each test case should contain
You are required to design concrete test cases based on the test conditions defined in sub-task 2.1. Note
that:
• Each test case should contain concrete values for input data as well as expected result such that
they can be directly executed.
• One test condition may be associated with one or more concrete test cases.
• You should select and apply appropriate techniques (e.g., black-box and white-box) when
designing test cases for each particular function ("add", "delete", "update", or "report" in
record.py).
• All test cases should also be put into the traceability matrix created in Task 1 to map with test
conditions as well as requirements.
Hint: Four sample test cases are provided in a template pytest script 'test_assignment2_xxxxxx.py'
(further described in Appendix B) and briefly described in the sample document
'SQT_Assignment2_template.doc'. Relevant information and examples about test design, test cases, and
concrete testing techniques can be found in lectures (e.g., slides 68-69 in Week 5's lecture, slides 26-30 in
Week 6's lecture, and Week 8&9's lecture content). You have also practiced different techniques for
designing test cases in our labs (e.g., lab work in Week 6, 8&9).
Here is test assignment test_assignment2_xxxxxx.py
import pytest
import campaign
from campaign import record
#Following is a sample test case to test the "add" function
def test_add():
#The following defines the input data
filename = "list.csv"
inputData = ['123456', 'Liu', 'Huai', '150', '250', '350']
#The following executes the function 'add' with the input data "123456 Liu Huai 150 250 350"
result = record.addCustomer(filename, inputData)
#The following verifies if the execution result is consistent with expectation
assert result == "added"
#Following is a sample test case to test the "update" function
def test_update():
#The following defines the input data
filename = "list.csv"
inputData = ['123456', 'Liu', 'Huai', '250', '250', '350']
#The following executes the function 'add' with the input data "123456 Liu Huai 250 250 350"
result = record.updateCustomer(filename, inputData)
#The following verifies if the execution result is consistent with expectation
assert result == "updated"
#Following is a sample test case to test the "report" function
def test_report():
#The following defines the input data
filename = "list.csv"
inputData = '123456'
#The following executes the function 'report' with the input data "123456"
result = record.reportCustomer(filename, inputData)
#The following verifies if the execution result is consistent with expectation
assert result[0] == 850 and result[1] == 'Loss'
#Following is a sample test case to test the "delete" function
def test_delete():
#The following defines the input data
filename = "list.csv"
inputData = '123456'
#The following executes the function 'delete' with the input data "123456"
result = record.deleteCustomer(filename, inputData)
#The following verifies if the execution result is consistent with expectation
assert result == "deleted"
Here is my test analysis in task 2.1
Add function
Test that the Add function can add a new customer to the system with the specified information.
Test that the Add function can add a new customer to the system with the specified expenses for the selected items.
Test that the Add function cannot add a new customer to the system if the customer ID is not unique.
Test that the Add function cannot add a new customer to the system if the expenses for the selected items are not valid.
Delete function
Test that the Delete function can remove a customer from the system.
Test that the Delete function cannot remove a customer from the system if the customer ID does not exist.
Update function
Test that the Update function can update the expenses of the selected items for an existing customer.
Test that the Update function cannot update the expenses of the selected items for an existing customer if the customer ID does not exist.
Test that the Update function cannot update the expenses of the selected items for an existing customer if the expenses for the selected items are not valid.
Report function
Test that the Report function can generate a report of the profit of the promotion campaign for each customer.
Test that the Report function can classify the expenditure as "Lost" if it falls within the range of $800 to $1000, both inclusive.
Test that the Report function can classify the expenditure as "Low Profit" if it is equal to or greater than $500, but less than $800.
Test that the Report function can classify the expenditure as "High Profit" if it is less than $500.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
import pandas as pd from pulp import LpProblem LpVariable lpSum LpMaximize value Load the ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started