Presentation is loading. Please wait.

Presentation is loading. Please wait.

Extreme Programming: Automated Testing and Refactoring

Similar presentations


Presentation on theme: "Extreme Programming: Automated Testing and Refactoring"— Presentation transcript:

1 Extreme Programming: Automated Testing and Refactoring
CSCI 4300

2 WAR project development setup
addressBook.war contains the entire deploy directory Drop the war file into the JBOSS deploy directory!

3 Adding Automated Testing

4 Integrating testing into build.xml
<target name=“test” depends=“compile”> <junit printsummary=“true”> <test name=“BeanTest.allTests” /> <classpath path=“./test” /> </junit> </target> <target name=“deploy” depends=“test”>

5 Refactoring with XP Problem: in a large project, touching a piece of code carries a 50% chance of breaking it Subtle errors might go unnoticed for some time Coward Solution: If it ain’t broke, don’t fix it XP Solution: Refactor at will, but use automated testing.

6 AddressBook Example Version 1: uses a session bean, which forgets addresses between sessions Version 2: uses an EJB that holds open a persistent database connection Version 3: uses an EJB with container-managed persistence --All these versions should use the same interface and automated unit tests!

7 XP Incremental development
Start with a “user story” describing usage Build a simple working version, then increment Automated testing protects you from entering subtle bugs

8 Designing the AddressBean test
Store a name and , then fetch the Fetch a nonexistent entry Test number of entries

9 The last word “Testing is for bunglers. Properly constructed devices work properly.” --E.E. “Doc” Smith, Skylark Three (1930)


Download ppt "Extreme Programming: Automated Testing and Refactoring"

Similar presentations


Ads by Google