Section 16.1. Introduction


16.1. Introduction

As we mentioned in Chapter 13, Seth wanted to revisit the business rules for late returns. But on Friday morning, Mitra, Emily, Sarah, and Seth had agreed with Don: "There are problems with both late and early returns. Let's focus on early returns next, as it's simpler." Sarah and Mitra had spent the morning writing lots of workflow tests for early returns, after some initial help.

We all got together that afternoon. Mitra and Sarah understood the issues better from having developed these examples. Mitra explained, "We realized that calculating refunds on early and late returns is not a matter of charging or refunding the difference." Consider her two scenarios.

  1. In Figure 16.1, a deposit of $10 and a rental charge of $15 were paid on the cups, which were rented for 3 hours. When they were returned an hour early, the deposit was refunded, along with $5 for the reduced 1 hour of rental.

  2. In Figure 16.2, however, the rental was for 1 day, with a deposit of $10 and a rental charge of $45. When the cups were returned an hour early, only the deposit was refunded. The rental charge for 23 hours is the same as the charge for a day because the daily cost of $45 is less than the $115 for 23 hours. As there is no difference in charge between 23 hours and 24 hours, no refund is due.

Figure 16.1. Refund When 1 Hour Early (Part of Test)


Figure 16.2. No Refund When 1 Hour Early (Part of Test)


Mitra and Sarah were unsure whether that was the best way to write the tests: "Perhaps there are ways to reduce the effort of writing all these tests, which are very similar."

"There's lots of cases," agreed Don. "We don't want to have develop lots more tests like this."

"So how can we avoid that?" asked Sarah. "I suppose that there is a lot of noise that is irrelevant to the main point in these tests."

"Yes," replied Don, "although we need some tests that show that the refunds and so on are made correctly within the workflow."

Emily summarized: "The specific client and the specific rental items are irrelevant. The deposit is irrelevant to the issue of refunds for early returns. We can ignore the staff member and maybe the count of items, too."

"So that leaves the paid-for period and the actual period," said Don.

"And the rental rates," added Emily. "How about something like this?"



    Fit for Developing Software. Framework for Integrated Tests
    Fit for Developing Software: Framework for Integrated Tests
    ISBN: 0321269349
    EAN: 2147483647
    Year: 2005
    Pages: 331

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net