A8-StateMachineLab(4)

docx

School

Centennial College *

*We aren’t endorsed by this school

Course

311

Subject

Industrial Engineering

Date

Dec 6, 2023

Type

docx

Pages

11

Uploaded by DoctorMosquitoPerson619

Report
Test Design using state transition diagrams Lab exercise Black Box Tests – Part II Designing test cases using State Transition Diagrams Student names Ashutosh Kansal and Rahul Garg Contents Q1 (2.5 pts) Draw a state transition diagram for a reservation or booking record .................................................. 3 Q2.a ) List the type of objects that have changing state (1 pts) ............................................................................... 7 Q2. b) Draw state diagrams for each of the object types you identified above. (2.5 pts) ........................................ 8 Q2.c) Identify criteria and define a test case to verify correct handling for four different state transitions. For example, two test cases are listed here. Add four more (1 pts each). (4 pts) ........................................................... 9 Page 1 of 11
Test Design using state transition diagrams Lab exercise Instructions Work in pairs – groups of two – and discuss (create a private chat) with each other as you complete the exercise. Marking This assignment is marked out of 10. It has 2 questions. Question one requires just one diagram is worth 2.5. Question two requires a set of diagrams and four test cases. It is marks out of 7.5. Due Submit in eCentennial your joint solution before next Monday’s class. Question 1 (2.5 pts) You own a small resort of summer cottages and ask a local software developer to create a reservation system you can use to manage bookings. Before accepting the software you test it thoroughly. You have 20 cottages that you refer to as #1, #2 … #20 and operate the resort for 12 weeks over the months of June, July and August. Weekly rental for each cottage is $1000 per week. The rental period is from noon on a Sunday to noon on the following Saturday. You clean and prepare for the next customer each Saturday afternoon and Sunday morning. Assume all customers stay one week. For each of the 20 cottages and each of the 12 weeks, the use cases may occur. Big hint: the states of a reservation are shown in bold. Use cases: To start, the reservation system marks all cottages as available for all weeks. Customers may contact you by phone or email to ask about availability, prices and the like. 1. The system lets you add information about potential customers to your mailing list. A customer contacts you by phone or email to reserve a cottage or a certain week. Page 2 of 11
Test Design using state transition diagrams Lab exercise o If the requested cottage and/or week are not available, you suggest alternatives. o When you and the customer agree on a cottage and week, and the system lets you indicate that the cottage is reserved . Upon reserving, the customer must send you a deposit of $250 if the arrival date is more three weeks ahead. o If the deposit arrives within seven days, the cottage is marked as booked . o If the deposit does not arrive within seven days, the system cancels the reservation and the cottage becomes available for rental to another customer. Full payment is due three weeks before the arrival date. That means a customer who reserved with a deposit of $250 must pay the balance of $750 at least 21 days before arriving. A customer who books late (less than 21 days before arriving) must pay the full amount of $1000 within seven days of reserving. o When the balance of rental payment arrives, the system lets you mark the cottage as rented . o If the balance of rental payment does not arrive 21 days before the arrival date: The system cancels the booking and the cottage becomes available . You keep the deposit (if the customer paid it). A customer may cancel a reservation or booking. o The system lets you indicate the cottage is available again. o If the customer cancels more than 3 months (90 days) before the arrival date, you return all money paid - deposit and balance of payment (if paid). o If the customer cancels between 3 months and 3 weeks of the arrival date (89-21 days) you keep the deposit and return the balance of payment (if paid). o If the customer cancels within 20 days of the arrival date, you keep all money paid. On the arrival date, the cottage becomes occupied . o If the customer does not turn up, you honour the booking anyway, in case the customer arrives late. Q1 (2.5 pts) Draw a state transition diagram for a reservation or booking record. Consider that the diagram is the same for all 20 cottages and all 12 weeks, but shows the state of a booking for one cottage and one week. Hint: Include only use case details that relate to a change of state. Diagram Page 3 of 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Test Design using state transition diagrams Lab exercise Page 4 of 11
Test Design using state transition diagrams Lab exercise Question 2 (7.5 pts) CC Video store rents movies. You are testing the IT system that maintains the inventory of movies, customers, rentals and reservations. CC Video rents movies by the day, for a fee of $5. All rentals are for one day and the customer pays before taking the movie out of the shop. Returns are due by 6 pm on the next day. Customers return movies by handing the rented copy to staff or dropping it into in a return box. The late fee is $6.00 for every day or part day overdue. Except for high demand movies, the store usually waves the fee for returns just a few hours late. All customers are members. Joining is free, but involves showing ID. The IT system assigns a member number and then uses member number together with last name and phone number to verify identity. All members in good standing (with no unpaid fines) can rent movies. Members can also reserve movies to be picked after 6 pm on the same day. The store must keep enough copies on reserve to satisfy all reservations. Use Cases / Requirements A. A member rents a movie with no reservation. Staff do the following: Validate that the customer is a member Check for outstanding fines. The member must pay all fines before renting. Check that a copy is in stock and available for rental. Take payment and give the member a copy of the movie. Add a loan record to the system. B. A member returns a movie Staff do the following: Check whether the return is late. o If the return is late and the customer is present, waive the fine or make the member pay. o If the return is late and the customer is not present, use the system to add the fine to the member’s record. Remove the loan record from the system. Return the copy of the movie to available stock. C. A member reserves a movie. Staff do the following: Validate that the customer is a member. Check that an unreserved copy is in stock. Record that a copy of the movie is reserved. If two or more members reserve the same movie, the store must put more than one copy on reserve. Page 5 of 11
Test Design using state transition diagrams Lab exercise D. A member rents (collects) a reserved movie. Staff do the following: Validate that the customer is a member who made the reservation. Check for outstanding fines. The member must pay all fines before renting. Check that a copy is in stock. o If a copy is in stock and reserved by this member, clear the reservation record. o If there is no copy in stock but one is reserved by this member, apologize to the member and note a glitch in the system. Take payment and give the member a copy of the movie. Add a loan record to the system. E. A Member cancels a reservation. Staff do the following: Validate that the customer is a member who made the reservation. Locate the reservation record and clear it F. Automatic system action: At the end of each business day, the system checks for reservations for that day that were not converted to rentals and automatically clears them. Instructions Complete the following about changes in state that occur while this application is running. Hints: Make up a database schema (in reality you would probably ask the developers): What database tables are required for the application? When are rows added or deleted and what columns in those tables change as the use case scenarios unfold? Q2.a ) List the type of objects that have changing state (1 pts) Member : Active, Fined, Inactive Movie Copy : In Stock, Rented, Reserved, Out of Stock Rental Record : Active, Completed, Late Reservation Record : Active, Completed, Expired Q2. b) Draw state diagrams for each of the object types you identified above. (2.5 pts) Hints: You need one diagram for each type of object. Some diagrams may be very simple, but draw them anyway for this exercise. Page 6 of 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Test Design using state transition diagrams Lab exercise Do not draw the diagram the flow of use cases or scenarios. Individual steps in different use cases may change the state of one object. State transition diagrams cut across use case scenarios. Label each diagram by naming the type of object. For example, one diagram will show the states of a copy of a movie . Member State Diagram Movie Copy state diagram Page 7 of 11
Test Design using state transition diagrams Lab exercise Rental Record State diagram Reservation Record State diagram Page 8 of 11
Test Design using state transition diagrams Lab exercise Page 9 of 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Test Design using state transition diagrams Lab exercise Q2.c) Identify criteria and define a test case to verify correct handling for four different state transitions. For example, two test cases are listed here. Add four more (1 pts each). (4 pts) 1. Test case: member in good standing can rent a movie (no reservation required). Criteria: A member with no fines can rent can rent any movie for which a copy is available, without reservation. Preconditions: Member 13 has no fines or reservations. Five copies of “Jaws” are available. Action: Member 13 rents “Jaws”. Expected result: One less copy of the movie is available than before. A loan record for the copy of “Jaws” exists and is associated with member 13. 2. Test case: At the end of each day, the system clears reservations. Criteria: Reservations for the day are cancelled by the system if the member does not collect the movie by end of the business day. Precondition: A copy of “Jaws” is on reserve for Member 108. Action: The video store closes for the day Expected result: After the system cleanup, the reservation record for Member 108 to collect “Jaws” is deleted and the copy of “Jaws” is available. 3. Test case: Member with fines trying to rent a movie. Criteria: A member with outstanding fines should not be allowed to rent a movie. Preconditions: Member with id 42 has $20 in fines. Five copies of "The Matrix" are available. Action: Member with id 42 tries to rent "The Matrix." Expected result: The system does not allow Member with id 42 to rent "The Matrix," and the number of available copies remains unchanged Page 10 of 11
Test Design using state transition diagrams Lab exercise Test case: Attempt to rent a movie that is not available. Criteria : If there are no available copies, a member cannot rent the movie. Preconditions : Member with id 77 has no fines or reservations. All copies of "Inception" are already rented out. Action : Member with id 77 tries to rent "Inception." Expected result : The system does not allow Member with id 77 to rent "Inception," and the number of available copies remains unchanged. 4. Test case: Member attempting to rent a movie with an existing reservation. Criteria: If a member has an existing reservation, they should be able to rent the reserved movie. Preconditions: Member with id 5 has a reservation for "The Avengers." Two copies are available. Action: Member 5 tries to rent "The Avengers." Expected result : The system allows Member 5 to rent "The Avengers," and the reservation is marked as Completed.Test case: 5. Test case: System handling a movie return after the due date. Criteria : If a member returns a movie after the due date, the system should handle it appropriately, including updating fines. Preconditions: Member with id 15 has a loan record for "The Godfather" overdue by three days. Action: Member 15 returns "The Godfather." Expected result: The system updates the loan record, marks the movie as returned, calculates and applies fines for the overdue period, and the copy of "The Godfather" is available for others to rent End of exercise Page 11 of 11