Test Driving Your S-Wing

Slides:



Advertisements
Similar presentations
Unit Testing Australian Development Centre Brisbane, Australia.
Advertisements

Designing Reusable Frameworks for Test Automation
Test-First Programming. The tests should drive you to write the code, the reason you write code is to get a test to succeed, and you should only write.
Chapter 13 Review Questions
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
Unit testing C# classes “If it isn’t tested it doesn’t work” Unit testing C# classes1.
Red-Green-Refactor! EclipseCon 2008 Kevin P. Taylor, Nicolaus Malnick Test-Driven Development (TDD) for Eclipse RCP.
By Bob Bunson  Simulation of software development project  Fictitious system from Concept to Code  Oriented around the.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Test Driven Development An approach to writing better code Jimmy Zimmerman Intel Corporation.
MVC pattern and implementation in java
@benday #vslive Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
MVC and MVP. References enter.html enter.html
Todd Snyder Development Team Lead Infragistics Experience Design Group.
Building Web Sites with ASP.NET MVC Framework Noam King CTO Sela College
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Top 10 Ways to Go from Good to Great Scrum Master Benjamin Day.
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
Principles and Techniques of Evolutionary Architecture Rebecca Parsons Chief Technology Officer ThoughtWorks.
New Ideas for IA Readings review - How to manage the process Content Management Process Management - New ideas in design Information Objects Content Genres.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
GUIs in Java Swing, Events CS2110, SW Development Methods Readings: MSD, Chapter 12 Lab Exercise.
Software Construction Lecture 18 Software Testing.
1 Planning for Reuse (based on some ideas currently being discussed in LHCb ) m Obstacles to reuse m Process for reuse m Project organisation for reuse.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
Refactoring for Testability (or how I learned to stop worrying and love failing tests) Presented by Aaron Evans.
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
1 Legacy Code From Feathers, Ch 2 Steve Chenoweth, RHIT Right – Your basic Legacy, from Subaru, starting at $ 20,295, 24 city, 32 highway.
Copyright © 2005 Charlie Poole. All rights reserved Test First User Interfaces XP2005 Sheffield University June 18, 2005.
Evaluating Architectures. Quality Control Rarely fun, but always necessary 1.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
CHAPTER 14 Classes, Objects, and Games XNA Game Studio 4.0.
Test-Driving ASP.NET Development Tampa Code Camp – July 15 th, 2006 Cory Foy
Lecture Model View Controller s/w architecture AND general tips on structuring classes.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
DYNAMIC FAQ AND DOCUMENTATION PAGES IN SHAREPOINT A modern, reusable, and easy-to-use model.
AX DEVELOPMENT FOR NON- DEVELOPERS Why did my 15 minute change take 3 weeks.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
© Copyright SELA software & Education Labs Ltd Baruch Hirsch St.Bnei Brak Israel
TDD Unit tests from a slightly different point of view Katie Dwyer.
Joseph Radic Expert tips provider
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
Event Loops and GUI Intro2CS – weeks
Java Beans Sagun Dhakhwa.
Unit Testing & Test-Driven Development for Mere Mortals
Unit testing C# classes
Objective % Explain concepts used to create websites.
Unit Testing & Test-Driven Development for Mere Mortals
Object Oriented Practices
The Object-Oriented Thought Process Chapter 05
Chapter 5 Designing the Architecture Shari L. Pfleeger Joanne M. Atlee
Present by Andie Saizan, MCP
Test-driven development (TDD)
Making Procedural Methods
CSSSPEC6 SOFTWARE DEVELOPMENT WITH QUALITY ASSURANCE
Chapter 7 –Implementation Issues
Unit Testing & Test-Driven Development for Mere Mortals
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Hold up, wait a minute, let me put some async in it
Strategy Design Pattern
CS 240 – Advanced Programming Concepts
Applying Use Cases (Chapters 25,26)
Applying Use Cases (Chapters 25,26)
Objective Explain concepts used to create websites.
European conference.
Extending Interface Based Design
Automated test.
S. Single Responsibility Principle O. L. I. D.
Intelligent Tutoring Systems
Presentation transcript:

Test Driving Your S-Wing By Patrick Kua emailpat <at> thekua.com || pkua <at> thoughtworks.com

The Agenda

Unit Integration Tests x 10 Unit Tests x 100s Unit Integration Tests x 10 Acceptance Tests x1 0010110101010110 1010001011010101 1010100010110101 0101101010001012 1010101011010100 1011010101011100 1010001011000010 Code Developer Loop

Writing Acceptance Tests You need objects that describe parts of the application – based on screens, dialogs, fields and various other parts It’s important to name things they way that the business would so that you can share tests with them and verify that they are working as expected Try to focus on the things the application should do, push the how into the ‘Screen Objecfts’ that you will create You should end up with a DSL group of objects that can be reused across acceptance tests, and hopefully don’t need to add too much too If needed, don’t expose more things that you need to from the page objects Leverage Standard Tools If your project is used to FIT, use that for communicating for the business JUnit means that you’ll probably be able to focus more on the screen objects and refactor things where appropriate Writing Acceptance Tests

As an author I would like to be prompted for confirmation on exit so that I do not lose any unsaved changes Confirm Exit

VS Source Test

public void testOnExitIAmAskedForConfirmation() { MainApplication application = TestHelper.getMainApplication(); ConfirmationDialog dialog = application.clickExit(); assertNotNull(dialog); assertEquals(“Are you sure you want to Exit?”, dialog.getMessage()); dialog.clickCancel(); assertTrue(application.isShowing()); }

How To Implement No Frameworks (yay!) Model View Presenter Test Things Only Worth Testing Unit Test as Much as Possible Code Changes Based on Tests Demonstration… For implementing a TDD-ed applciation, we’re going to avoid any frameworks because there are not many out there that are worth using and also many of them don’t really promote TDDing The MVP presenter pattern is used to help separate the tesitng aspect of this: The view is a very thin veneer that the presenter is interacting with The view should be a single line of delegation Layout is not really worth testing – it’s much easier to play with the layout aspect if you don’t care too much where everyhting is placed

How it all works (Yawn… I mean Architecture) Layout Managers Presenters Glue Views Repository

Implementing Confirmation of Exit Actually Exit

Abbot & Costello Alternatives include: Marathon Man Jemmy (Netbeans) http://marathonman.sourceforge.net Jemmy (Netbeans) http://jacareto.sourceforge.net Jacreto JFC Unit http://jfcunit.sourceforge.net Pounder http://pounder.sourceforge.net http://abbot.sourceforge.net/

Robust Acceptance Tests

Top Tips Top Tips: Give every important component a name that will be unique so that you can more easily find them. Even given panels a component if it helps make another component more useful (i.e. description field on one screen might mean something else) Separate everything that you can into its own testable POJO and only interact with the view if you really have to. Use the presenter to shield the model from the view if you want to maek it more testable (an interface will help you to mock these interactions easier) High discipline will be required too maintain a fully TDD-ed application The view should be extremely thin (one line of delegation) Split the responsibility – the presenter interacts with more complex objects that have business purpose (it’s just a layer that represents the veiw) Getting around threading issues At some point, you’re going to have to use the SwingUtilities to do a wait() or something oepration. We introduced an application event queue interface that allowed us to inject something for tests so that we could predictably run tests Small, reusable objects are much better than large ones (but this holds true for any other systems) When you can use this technique The techniques described here was used on a Greensfield project, but the same principles could be applied if you are working on an existing system, but will be harder (just like working with many TDDed applications) If you have control of the application that you are testing (of course you should, if you are developing it) In refactoring an existing system, it might be better to start giving things names, so that you can write smaller integration tests. When does this testing strategy fail: Everyone has to have very high discipline for TDDing all of the components

Questions? The resources for this presentation can be found at: http://www.thekua.com/conferences/xp2006 Questions?