quinta-feira, 13 de agosto de 2009

Curso no Ágiles 2009: Test Driven Development (TDD) and Refactoring

Trainer: Naresh Jain
Duration: 2 days

Test Driven Development (TDD), one of the most profound eXtreme Programming practice, which has been adopted by nearly all the Agile methods. While there is such huge acceptance and appreciation for this practice, a lot of new teams struggle understanding and implementing this practice at work.

This 2-day workshop teaches you the thought process and the steps involved during a typical Test Driven session. You'll understand how developers take a user story and drive the development (design and implementation) using acceptance tests and unit tests. We'll discuss various techniques of TDD and their implications on the resultant code and its design. And you will discover just how much confident, faster you can go by writing test first!

Good object-oriented design principles are emphasized throughout. You will learn how to keep your designs clean and simple by applying those design principles through various refactoring techniques. You will learn how to identify poorly designed code by using our elaborate code smell vocabulary. Once we've identified the code smell, you understand how to apply refactorings techniques to simplify the code. You will learn to incrementally transform complex and difficult classes into readable, well-structured, and well-designed code, while keeping them running at all times. You will also learn how to take advantage of the automated refactoring support available in the IDEs.

As you participate in our hands-on environment, you will learn how to approach design from the outside-in; one test case at a time, driving the system to better and simpler design while it continues to pass all its tests. You will learn how unit tests and acceptance tests can be used to incrementally grow well-factored systems that are easy to understand and maintain.

Objectives

By the end of this workshop, you will be able to:

  • Understand Automated Unit and Acceptance Testing Techniques
  • Perform test -first development for user stories on your project
  • Recognize poor code constructs and build a common vocabulary of code smells
  • Understand OO design principles and Improve design of existing code in small safe steps
  • Use the xUnit framework (Junit/Nunit) for unit testing
  • Know how and when to refactor
  • Write executable requirements using Acceptance Tests
  • Know how to deal with Legacy Code (code without tests)

Course Outline

Automated Unit Testing and xUnit Framework
We'll cover the philosophy of developer unit testing, provide a detailed overview of xUnit framework, including how to write and organize tests, which assert methods to use, how to deal with exceptions within tests and test naming conventions. All these techniques are introduced using the unit testing tools available in an Integrated Development Environment (IDE) like eclipse. A small presentation will be followed by a demo and lots of discussion.

Test-Driven Development
Test-Driven Development (TDD) is a practice for efficiently evolving useful code. While its name implies that it's mostly about testing, test-driven development is primarily about design: it keeps programmers focused on exactly what they need to build and helps them avoid over-engineering. We'll demonstrate the TDD Rhythm. Participants will understand how TDD simplifies evolving lean, useful, fully tested software. We'll give a small live demo of TDD and then Participants will get their hands dirty by using TDD to extend the demonstration code.

Code Smells
Code smells identify common design problems in object-oriented code. This interactive lecture provides a good overview of code smells defined by Martin Fowler & Kent Beck in their book "Refactoring: Improving the Design of Existing Code." In addition, you'll learn about some new smells that have been categorized by Joshua Kerievsky and his colleagues. Technical lecture with lots of code snippets. Followed by an exercise to identify code smells on a sample code base.

Refactoring
Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. We'll demonstrate how using automated Refactoring tools available in IDEs we can evolve the design of existing code using a series of small behavior preserving transformations. We'll cover most common refactoring techniques listed in Martin Fowler's classic catalog of refactorings. Technical lecture with lots of code snippets. Followed by a lab exercise.

Acceptance Test Driven Development
Acceptance TDD involves writing one or more systems-level acceptance tests (or "customer unit tests") from a customer's perspective, before coding the solution. This practices encourages collaboration on the team by bringing together product management, developers, and testers at the start of each feature to clarify and align on its goals. This workshop highlights the importance of speaking a common, useful, and relative unambiguous language and how to create requirements as executable tests. This workshop explains what happens between writing user stories and convert them into working software. Details about Acceptance Criteria and Acceptance tests using FitNesse and FitLibrary are described in this workshop. We'll also cover Patterns and Anti-Patterns associated with ATDD. To understand the essence of TDD and how it applies to customer level end to end tests, we'll take some scenarios and explain how to write acceptance criteria and tests for the same. Will conclude with an exercise where the participants will write acceptance tests for a given problem.

Test Driving Enterprise Code
Test-driving enterprise code isn't easy. In this workshop we'll dive right into the deep end of enterprise applications. You will learn how to apply the techniques of test-driven development to enterprise components, including handling web requests, accessing databases and asynchronous communication. We'll leverage on lightweight containers like Spring to demonstrate these techniques. For the whole workshop to be of any use one must focus on learning how to practice TDD in real world not on simple money example. During this workshop we'll demo these topics in details and follow it up with a lab.

2 day workshop Retrospective
We'll wrap up the 2 day Testing and Refactoring workshop with a retrospective to understand what worked, what could be improved next time and what kind of topics might be interesting if we conduct similar training again.


Software Required

Java:

  • Eclipse 3.4+ IDE or any other new age IDE
  • Latest Sun JDK (Java 1.5+)
  • Mockito - Mocking Framework

.Net:

  • .Net 2.0 or later
  • Visual Studio 2005 or later
  • ReSharper Plugin
  • Rhino Mock

Note: Attendees can chose between Java and .Net and follow the training in their preferred language.


Language

This training will be conducted in English.


Dates

October 6 – 7, 2009

Fonte: http://www.agiles2009.org/en/tdd.php


Nenhum comentário:

Postar um comentário

Deixe seu comentário! Não uso verificação de palavras.