C07 Exercise07
C07 Exercise07
APPLICATIONS
EXERCISE 07 - TEST CASES FOR NORTHWIND QUERIES
PURPOSE
The purpose of this assignment is to develop test cases to demonstrate that the requested SQL queries work
correctly.
ACTIVITIES
Perform each of the following activities. If you have questions, issues, or doubts, please ask for help and do not just
guess.
1. The three reports requested by Glen North are:
a. Write and execute the SQL to list all customer information for company, last name, first name, city, and
state.
b. Write and execute the SQL to list all orders by “Customer A”, including the customer company, last
name, first name, order id, order date, product id(s), and totals for the order.
c. Write and execute the SQL to list all shipments using “Shipping Company A”, including the shipping
company name, last name, first name, order id.
2. Before writing these queries, it is a good idea to develop the test cases that demonstrate that the queries are
correctly implemented. This is known as test-driven development (TDD) or test-first programming (TFP). TDD is a
good way to build software, because it drives a precise understanding of what the requirements mean.
In this case, the Northwind Traders database, as provided with Microsoft Access, does not include any orders,
although it does include customers and shippers. Populating the database with records will verify that the
reports are correctly implemented.
For example, the database should have orders shipped by “Shipping Company A” and by other shippers to
demonstrate that query c only includes the “Shipping Company A” shipments. It should include multiple
shipments to demonstrate that all of the “Shipping Company A” records are included in the report.
Create records that demonstrate the execution of the SQL queries to be written in the Northwind Traders
database. The original version of the database with the login screen and the data entry forms is the most
convenient for populating the database consistently and completely with the test data.
Every team will generate a different set of test cases. The question is whether your team's test cases adequately
cover the correct functioning, and possible mistakes, that might occur in writing your SQL code. In general, it is
not feasible to do comprehensive testing. There is an economic tradeoff in terms of the impact of defects and
the amount of resources we spend on testing. Please try to make useful choices -- a full discussion of test
coverage is outside the bounds of this course.
3. Document the test data that you will use to demonstrate each of the three SQL queries required and what you
are testing for by including those records:
a. For query a, there are already customers ‘A’ to ‘Z’ in the database with names, city, and state. This is
satisfactory for testing the query.
b. There are no orders in the database. Add orders for ‘Customer A’ (3), ‘Customer B’, and ‘Customer Z’
(2). Order one item, two items, and three items for ‘Customer A’; three items for ‘Customer B’, and one
item for ‘Customer Z’.
c. Use ‘Shipping Company A’ for the one- and three-item orders for ‘Customer A’ and the three-item order
for ‘Customer B’. Use ‘Shipping Company C’ for the other two orders.
4. Document the expected results of running the queries against this test data.
Note that the table below is illustrative of the answers students might get for b and c, but since
we did not specify the exact contents of each order, exact answers will vary.
a)
b)
Company Name ID Order Date Product Order Total
c)
Company Name ID
Shipping Company A , 2
Shipping Company A , 4
Shipping Company A , 5
5. Store the test data in a test version of the Northwind Traders database for use in testing your SQL queries. Name
it ‘C07_P01_Northwind.accdb’.
6. Save and archive your work, replacing “YourID” with your student identifier, and upload it to the LMS.