Section 15.3. Dates


15.3. Dates

"We need an action that sets the date. Then we can control the time whenever we want," Sarah offered. After trying several action words, she suggested setting the date as shown in Figure 15.5.

Figure 15.5. An Action to Set the Date

time is now

2004/05/06 09:01


After Sarah added the time-change action to several tests, Emily suggested that she "put it at the end of the SetUp, as all tests will need date/time set." Sarah added that to Figure 15.1. She then changed the rental test in Figure 15.4 to become the test shown in Figure 15.6, having added in hours and days to the second table.

Figure 15.6. Test Rental with Dates


"Why not use an end date as well?" Don suggested. He changed the second table of the test, as shown in Figure 15.7.

Figure 15.7. Revised Second Table of Test Rental with Dates

rentals for client

Joanna

rental item

count

start date

end date

cup

100

2004/05/06 09:01

2004/05/20 09:01


Questions & Answers

Q1:

It's easy to write the test, but making it work is not so easy.

A1:

Yes, that's true, as we'll see in Chapter 34. But the payback from doing so is immense, as we can then write automated tests that pick up errors soon after they're made.

In the medium term, having test support and higher quality in the software can make a huge difference in the speed at which changes can be made. And being able to communicate about what's needed, using Fit tests to express that, is also so valuable; it helps to focus the effort where it's needed.



    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