Extreme Programming in Agile Development
XP emphasizes the importance of keeping the software problem the focus of the development effort. It upholds the key qualities of Agile software development.
Join the DZone community and get the full member experience.Join For Free
The primary driver of any software project should be the problem the software is aimed at solving. If the design of the program is too large and expensive, it may become the driver of the project either because it is too unwieldy to change or too much has been invested in it. Similarly, a requirements-gathering process may become the main driver of the project. Extreme programming insists on the fundamental importance of keeping the software problem to be solved as the focus of the development effort. Extreme programming is also designed with that fundamental observation in mind.
Extreme programming maintains that tests should be created as the beginning of code and that the code is written to pass those tests. Also, the client who has a problem to be solved with software defines criteria to create acceptance tests. The extreme programming aim of maintaining tight feedback and iteration cycles among test, code, and design offers a viewpoint upon which to dispense with requirements entirely. The framers of the software product simply have to create a set of tests that the software must satisfy sets of tests to code to and a set of tests to define acceptance criteria (this can even go so far as to include integration, system, and performance tests).
The classical view of software testing maintains that tests are designed to verify that the software satisfies (or fails to satisfy) given requirements. In fact, some automated test management suites are built on this premise (i.e., Mercury Test Director). This easy to understand, but implementing the concept of a one-to-one relationship between requirements and tests is, unfortunately, invalid. Software tests are designed around models of the actual software. Similarly, requirements define a model that the software is supposed to adhere to.
When a test is said to fail, does this mean that the software does not meet the requirement or does it mean that the test is not an accurate model of the software? Have we found a software bug or have we found a testing bug? We can push this further is the requirement an accurate reflection of the problem to be solved? Often requirements are changed when it is discovered that they do not add up to what the client wanted i.e. requirements bugs have been found. On the other hand, the software may properly be satisfying the client’s needs despite failing tests aimed at establishing whether it satisfies the requirement. These are not matters of bad test design they are a reflection of the fact that the one to one relationship claimed between tests and requirements is illusory.
Relationship A between the software and the problem being addressed is the key relationship that is to be tested. Extreme programming advocates keeping this relationship as focused as possible by doing unit testing with as tightly incremental a test-code-design feedback cycle as is feasible. The models of the software and of the client’s problem to be solved are in this way kept as rigidly close to the actual phenomena being modeled as is possible.
Relationship B between the requirements and the tests is addressed in acceptance testing. However, it is possible to drop the requirements component and the model of the problem to be solved that the requirements are based on. Instead, extreme testing advocates a single model of the relationship between the software and the problem to be solved, a model that is built through unit tests and validated through acceptance tests.
Published at DZone with permission of Rohit Sharma. See the original article here.
Opinions expressed by DZone contributors are their own.