Conclusion
The implementation of all four requirement keys is now complete. After adding products to the shopping cart in the product browser form, we can click on the Shopping Cart link at the top of the page, which links to Cart.aspx. There, the items are read from the session object and displayed as shown in Figure 11.12. |
Figure 11.12. Shopping Cart Form
In this chapter programming of unit tests has been exercised to a great extent. In doing so, we have achieved a significant improvement:
- Minor problems and bugs have been addressed immediately after initial implementation. If you have worked through this chapter and have not simply proceeded with the sample solutions, you will have encountered failed test cases a number of times (just as we did).
- We have detected resource leaks in the product parser that could have caused system instability due to a lack of system handles. After typical memory leaks were eliminated by the introduction of automatic memory management in the .NET runtime, unreleased resources may become the new challenge to programmers. As we have seen, without strict testing these leaks remain widely undetected but can cause major instabilities for the entire system.
- We have detected a bug in the XmlTextReader class, which is part of the .NET Framework. This is a particularly unexpected problem because XML support is often mentioned as an important feature of the .NET Framework. The fact that a product has a huge installed base may give you the wrong feeling about its quality. To give another example, in our past projects we have come across bugs in basic clipping functions in the OpenGL driver for graphic boards that have sold millions of units. Nobody is perfect!
After fixing a few bugs and implementing a workaround for the problem found in the .NET Framework, our code has passed all unit tests, and the go/no-go criteria for this iteration have been fulfilled. Early testing is a major factor in product robustness. Furthermore, we have shown that even for Web-based applications, fully automated unit tests are feasible.
In the next iteration, the construction phase of this project will be completed with the implementation of a secure checkout procedure for Online Photo Shop.