xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros - Presentation Transcript

    1. xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros The "Design Patterns" Of Automated Testing Automated testing is a cornerstone of agile development. An effective testing strategy will deliver new functionality more aggressively, accelerate user feedback, and improve quality. However, for many developers, creating effective automated tests is a unique and unfamiliar challenge. xUnit Test Patterns is the definitive guide to writing automated tests using xUnit, the most popular unit testing framework in use today. Agile coach and test automation expert Gerard Meszaros describes 68 proven patterns for making tests easier to write, understand, and maintain. He then shows you how to make them more robust and repeatable--and far more cost-effective. Loaded with information, this book feels like three books in one. The first part is a detailed tutorial on test automation that covers everything from test strategy to in-depth test coding. The second part, a catalog of 18 frequently encountered test smells, provides trouble-shooting guidelines to help you determine the root cause of problems and the most applicable patterns. The third part contains detailed descriptions of each pattern, including refactoring instructions illustrated by extensive code samples in multiple programming languages. Topics covered include Writing better tests--and writing them faster The four phases of automated tests: fixture setup, exercising the system under test, result verification, and fixture teardown Improving test coverage by isolating software from its environment using Test Stubs and Mock Objects Designing software for greater testability Using test smells (including code smells, behavior smells, and project smells) to spot problems and know when and how to eliminate them Refactoring tests for greater simplicity, robustness, and execution speedThis book will benefit
    2. developers, managers, and testers working with any agile or conventional development process, whether doing test-driven development or writing the tests last. While the patterns and smells are especially applicable to all members of the xUnit family, they also apply to next-generation behavior- driven development frameworks such as RSpec and JBehave and to other kinds of test automation tools, including recorded test tools and data- driven test tools such as Fit and FitNesse. Visual Summary of the Pattern Language Foreword Preface Acknowledgments Introduction Refactoring a Test PART I: The Narratives Chapter 1 A Brief Tour Chapter 2 Test Smells Chapter 3 Goals of Test Automation Chapter 4 Philosophy of Test Automation Chapter 5 Principles of Test Automation Chapter 6 Test Automation Strategy Chapter 7 xUnit Basics Chapter 8 Transient Fixture Management Chapter 9 Persistent Fixture Management Chapter 10 Result Verification Chapter 11 Using Test Doubles
    3. Chapter 12 Organizing Our Tests Chapter 13 Testing with Databases Chapter 14 A Roadmap to Effective Test Automation PART II: The Test Smells Chapter 15 Code Smells Chapter 16 Behavior Smells Chapter 17 Project Smells PART III: The Patterns Chapter 18 Test Strategy Patterns Chapter 19 xUnit Basics Patterns Chapter 20 Fixture Setup Patterns Chapter 21 Result Verification Patterns Chapter 22 Fixture Teardown Patterns Chapter 23 Test Double Patterns Chapter 24 Test Organization Patterns Chapter 25 Database Patterns Chapter 26 Design-for-Testability Patterns Chapter 27 Value Patterns PART IV: Appendixes Appendix A Test Refactorings Appendix B xUnit Terminology Appendix C xUnit Family Members Appendix D Tools Appendix E Goals and Principles
    4. Appendix F Smells, Aliases, and Causes Appendix G Patterns, Aliases, and Variations Glossary References Index Personal Review: xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros x/Unit patterns is a great book that fills a void I unconsciously would run into in projects using TDD. While several great books have been written about how to design and refactor our application code not much critical practical attention has been given to how to write test code. Most of it has been "do what I do" or heated discussions on why one strategy is better than another. I would often see "smells" end up in my test code, which I would attempt to refactor out. Yet, since I am still learning TDD I would often re-refactor my TDD code because I would often change my mind about why I made a change. I would also question whether or not I really was improving my project code by refactoring my TDD code. xUnit Test Patterns definitely is a great addition to this space and fills a much needed gap. It helps put much needed background, concrete analysis and details around these areas. It will easily become a staple in the modern developer's reference collection. This is not an intro to TDD book. If you do not use TDD and are wondering just what it is I would suggest you look elsewhere. If I had been given this book when I was entering the TDD space I would have been overwhelmed. If you have used TDD on a project or two, with varying success, this would be a great book. It's a very easy read with a basic understanding of TDD. It opened my eyes on exactly why TAD (test after development) was much worse than simply "don't do it that way". It allows me to help explain TDD much better than saying, "just because you're supposed to". It also lays out a very detailed analysis on why you may or may not want to use fresh test fixtures versus shared as well as using persistent data. Both can be very hot controversial issues, yet Gerard explains the very fundamental reason behind the various strategies and where they may each be used with confidence. Of course, he explains why it may be very bad to use in certain situations, which are usually producing smells in our test code.
    5. If you are an academic in this space (not just the casual user) and love the other Fowler books I would definitely recommend you add this to your collection. As I mentioned above, it establishes concrete naming conventions (based on original papers and commentaries) and provides a very detailed analysis of much of the current discussions in this space. In the first half Gerard gives a very thorough tour through the TDD space including the benefits of using TDD, various strategies and their pros/cons, details of how most xUnit frameworks work and so on. Most of this is probably fairly familiar ground for those who are intermediate in TDD but it's a very quick read through. It filled in a few holes for me, but most importantly, like other refactoring/patterns books it helps put a concrete framework and names around the various methods. It helps facilitate great conversations where developers using TDD can speak on a common ground, an area that, at least in my circles, has been lacking. The 2nd half details the actual patterns. Much in Fowler-academic pattern style, each pattern is listed with its name, what it attempts to accomplish, pros/cons and samples of use. He includes a vast amount of patterns, many of which I have ran into yet not been able to put my finger on why I decided to use it in one project and not another. He also makes a great case why the same pattern may be very useful in one context but an anti- pattern in another. Looking at the various pros/cons I really began to fill out my arsenal, if you will, with strategies I used to dismiss, however, in certain difficult contexts they would have actually fit the need perfectly. If you have been using TDD in your projects, with whatever level of success, I would definitely recommend you add this book to your collection. As I said above, it's a quick yet detailed read and adds much needed tools to your TDD tool belt. For More 5 Star Customer Reviews and Lowest Price: xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros 5 Star Customer Reviews and Lowest Price!

    + AutoSurfRestarterAutoSurfRestarter, 1 month ago

    custom

    58 views, 0 favs, 0 embeds more stats

    x/Unit patterns is a great book that fills a void I more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 58
      • 58 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories