I will be presenting at the Austin Code Camp 2009 next weekend. Its a FREE event next Saturday (May 30th) from 8am-5pm. Lunch is provided. If you are a developer and are able to make it, I highly recommend attending. I attended last year, and I learned a lot and walked away energized and excited. It was great, and I expect this year to be even better.
I will be presenting on creating a fluent interface (DSL) over your domain objects to enable you to easily build complex scenarios for testing. Here is the abstract I submitted:
“Big Picture” Testing: Fluently specifying complex scenarios for integration tests. (1 hour)
Level: 100 Track: Code Camp
Abstract: Have you cringed at writing or maintaining integration tests because setting up the objects or test data needed for the test was just too much work? Have you pulled your hair out over test setup methods that are longer than the latest Stephen King novel? Tired of tests breaking because somebody changed something in the database? Tired of “ignoring” tests because you can’t make them work? Learn testing patterns that will enable you to create a fluent interface to set up complex test scenarios in a way that is concise, clear and easy maintain. Dynamically specify and generate the objects needed for each test scenario using minimal code. Temporarily persist these object graphs to the database for coarser grained “db” tests. Learn principles and practices for developing integration tests against a database using a unit testing framework. Send your “monster” test setup methods back to the closet and simplify your tests.
Here is an example of a fluent interface that can be built using this process:
52 // Arrange.
53 institution =
54 an.Institution
55 .with( a.Product
56 .ofType( ProductTypes.Savings )
57 .with( a.Feature
58 .forSecondaryProcessing()
59 .with( a.Reward.usingMethod( rewardProcedureName ) )
60 )
61 )
62 .with( a.Cycle.withSecondaryProcessingDateOf( DateTime.Today ) )
63 .build();
I hope to see you there!
-Chris