blue bar background yellow bar background
Colorado Software Summit 2008 banner
Colorado Software Summit logo

The Best Way to Master a Technology Is to Teach It to Others

Chris Richardson

Chris Richardson Consulting, Inc.

Improving Tests with Object Mothers and Internal DSLs (EE)

Test code needs to be as clean and as simple as production code. However, when writing tests there is the ever present temptation to not be as disciplined as you should be. As a result, test code quality gradually decays over time and becomes difficult to maintain and brittle. For example, a common problem is bloated and duplicated test fixture logic. Another problem is tests that are written at too low-level, which makes them difficult to understand and change. If you are not careful, you run the risk of your test code falling into disrepair and being ignored, which defeats the purpose of having tests.

In this talk you will learn how to make tests easier to develop and maintain by using a coding style that abstracts away the details and eliminates code duplication. We describe how to simplify test fixtures by designing domain objects with fluent interfaces, and centralizing test object creation in object mothers. You will also learn how to simplify verification logic with custom assertions. We describe how to improve web tests by writing them in terms of test utility methods, instead of calling Selenium RC directly. These utility methods form an internal domain-specific language that hides low-level details, such as mouse and button clicks.

Developing and Deploying Java EE applications on the Amazon Elastic Compute Cloud

Traditionally, computer hardware was a scarce, expensive resource. Running performance tests often meant scavenging for machines around the office. Today, however, things are different. With Amazon’s EC2, a cluster of servers is now just a web service call away.

In this presentation you will learn about design and implementation of Cloud Tools, which are a Groovy-based framework for deploying and testing Java EE applications on EC2. This framework provides a simple (internal) DSL for configuring a cluster (database + web container + apache), deploying a web application, and running performance tests using JMeter. You will learn about capabilities of EC2 and how to use it for development and deployment. We describe how we use Amazon S3 to work around EC2's lack of a persistent file system and avoid time-consuming uploads of WAR files. You will also learn how Groovy helped and hindered with the development of the Cloud Tools.

Photo of Chris Richardson

Chris Richardson is a developer, architect and mentor with over 20 years of experience and is the author of the book POJOs in Action. He runs a consulting and training company that helps customers build better software faster using agile development techniques and frameworks such as Spring and Hibernate. His technical interests include cloud computing, domain-driven design, aspect-oriented programming and developer testing.

Chris has been a technical leader at a variety of companies including Insignia Solutions and BEA Systems and recently became a Java Champion. Chris holds a computer science degree from the University of Cambridge in England. He has spoken at various conferences including JavaOne (2006-2008), The Spring Experience, Colorado Software Summit, SpringOne, and Javapolis as well as Java user groups. Chris lives in Oakland, CA where he runs the local Java User Group.

Blog: http://chris-richardson.blog-city.com/

Email: chris@chrisrichardson.net