XP

02/09/08

Basic Engineering Methods

1

What is XP?
►A

deliberate and disciplined approach to software development. ► An approach that includes the client and the user. ► An approach that embraces change.

02/09/08

2

Hallmarks of XP
► Tight

feedback loops. ► Iterative planning, design and coding. ► Small releases. ► Flexibility. ► Simplicity.

02/09/08

3

02/09/08

4

Focus
► Planning ► Design ► Code ► Testing

Each of these elements has a set of simple rules associated with it.
02/09/08 5

Testing
► All

code must have unit tests. ► All code must pass all unit tests before it can be released. ► Use a unit test framework. ► When a bug is found, tests are created. ► Acceptance tests are run often and the score is published.
02/09/08 6

Unit tests
Unit tests are one of the corner stones of Extreme Programming. But unit tests XP style is a little different.

02/09/08

7

Unit tests
First you should create or download a unit test framework to be able to create automated unit tests suites: Unit testing frameworks are tools same as your editor and compiler. Don't keep this powerful development tool in reserve until the last month of the project, use it through out.

02/09/08

8

Unit test frameworks
First you should create or download a unit test framework to be able to create automated unit tests suites. Unit testing frameworks are tools same as your editor and compiler. Don't keep this powerful development tool in reserve until the last month of the project, use it through out.

02/09/08

9

Unit test frameworks
Most languages already have a unit testing framework available for download from XProgramming.com. Use this free version as a starting point. See how it works, then create your own. The team must claim ownership of the unit testing framework and be able to change any part of it.
02/09/08 10

Unit tests
Second you should test all classes in the system. Do not slight trivial getter and setter methods.
 Test everything.  Test all the time.

02/09/08

11

Unit tests
Create your tests first before the code. You are, in effect, coding to the test so the tests must be right.

02/09/08

12

Bugs
When a bug is found tests are created to guard against it coming back. A bug in production requires an acceptance test be written to guard against it. Creating an acceptance test first before debugging helps customers concisely define the problem and communicate that problem to the programmers.

02/09/08

13

Bugs
In the same mode as regression testing, acceptance tests allow you to note a bug, build a test and then have something else (your tests) track it. Then programmers have a failed test to focus their efforts and know when the problem is fixed.
02/09/08 14

Bugs
In the same mode as regression testing, unit tests allow you to note a bug, build a test and then have something else (your tests) track it. Then programmers have a failed test to focus their efforts and know when the problem is fixed.
02/09/08 15

Acceptance tests
Acceptance tests are created from user stories. During an iteration, the user stories selected during the iteration planning meeting will be translated into acceptance tests. The customer specifies scenarios to test when a user story has been correctly implemented. A story can have one or many acceptance tests, what ever it takes to ensure the functionality works.
02/09/08 16

Acceptance tests
Acceptance tests are black box system tests. Each acceptance test represents some expected result from the system. Customers are responsible for verifying the correctness of the acceptance tests and reviewing test scores to decide which failed tests are of highest priority. Acceptance tests are also used as regression tests prior to a production release.

02/09/08

17