Presentation is loading. Please wait.

Presentation is loading. Please wait.

20-Jun-15 XP Again. Test-Driven Development Advantages of writing tests first: Clarifies what the methods are supposed to do Methods are testable Methods.

Similar presentations


Presentation on theme: "20-Jun-15 XP Again. Test-Driven Development Advantages of writing tests first: Clarifies what the methods are supposed to do Methods are testable Methods."— Presentation transcript:

1 20-Jun-15 XP Again

2 Test-Driven Development Advantages of writing tests first: Clarifies what the methods are supposed to do Methods are testable Methods tend to be simpler and single-purpose Methods tend to be more independent of the environment Tests get written XP slogans: “Test Everything That Could Possibly Break” “If it hasn’t been tested, it doesn’t work.” One of the XP principles is: Respect Trust your team members not to submit nonworking code

3 TDD development cycle Here’s how TDD should be done: while (program isn’t complete) { write a nonworking “stub” method write a test for that method run the test and make sure it fails do { improve the method test the method while (the test fails) } It’s OK to start with a large number of stubs, but make each method work before you go on to the next

4 TDD maintenance After your program is fully written and tested, bugs can still appear Usually this is something you forgot to test Here’s what to do: First, write a test case that exposes the error (by failing) Then (and only then) correct the code

5 Suggestions for working with partners Make sure you are clear on what classes and methods are to be written Follow the exact specs given on the assignment If you want additional methods, agree on what they are Divide up the effort (by class or by method) Do TDD Give your partner working code Remember: “If it hasn’t been tested, it doesn’t work.” Agree who is to do the last-minute integration testing (and submission)

6 Other XP terms DTSTTCPW “Do The Simplest Thing That Could Possibly Work” If it needs to be more efficient, that’s best done with simple, understandable code The compiler is better at optimization than you are DRY “Don’t Repeat Yourself” OAOO “OnceAndOnlyOnce” Test Infected “When you can't even go pee unless you have a GreenBar” Source: http://c2.com/cgi/wiki?XpGlossaryhttp://c2.com/cgi/wiki?XpGlossary YAGNI “You Ain’t Gonna Need It”

7 The End


Download ppt "20-Jun-15 XP Again. Test-Driven Development Advantages of writing tests first: Clarifies what the methods are supposed to do Methods are testable Methods."

Similar presentations


Ads by Google