TEST DRIVEN DEVELOPMENT Hardships of Beginning How to
TEST DRIVEN DEVELOPMENT Hardships of Beginning. How to Begin? TDD Milestones.
Hardest Part � � Is NOT writing a test. Knowing WHAT to test. Remembering to refactor (Code & Tests). Structuring the application with SEAMS.
Exceptions, Logic Rules Application Start If Else Application Complete
Where Do We Begin? Test Needs � � � Fast Agile Accurate Easy to find Displayed Appropriately Others?
Anatomy Of A Test � Standardize Naming Convention: (Process_Variables_Return) � Arrange - Setup Act - Method Call(s) Assert - Validation � �
What Is A Seam? � � The point of separation between layers (Structural). The point of separation between units.
What Is A Unit? � � � One or more classes that represent a singular concept or common processes. However, a unit should not cross structural layers. (UI, Domain Layer, Data Access Layer) A unit may interact/communicate with other units.
Seams � � The best way to create seams is by the use of contracts known as interfaces. Interfaces can be mocked. Abstract classes also can be mocked.
Legacy Applications § § § Finding unit seams can be near impossible. Logic affecting one or the other can be scattered throughout the application and may not be where it’s supposed to be. Do NOT leave here and try to update a legacy application thinking that you’re going to get it under automated tests.
Milestones 1. 2. 3. 4. 5. 6. 7. Write unit tests on single class with one or less dependencies. Write unit tests for two or more different units that has a unit seam. Write unit tests that has a structural seam (UI/Domain or Domain/Data Storage). Write unit tests for an entire application that is small. Write unit tests for an entire application that is large. Put a small legacy application under automated tests. Put a large legacy application under automated tests.
Training Ideas � Pair up with someone at work or wherever. One of you write an automated test. Your partner must make it pass. Then your partner writes the next automated test and then you have to make it pass. Keep going back and forth until you have a working application.
Any Questions? � � Email: sleistikow@live. com Twitter: @Shaun. Leistikow
Calculator Project Formula like 5+6 -3=8
- Slides: 13