Test-driven SOD?

17 views
Skip to first unread message

Mike Pence

unread,
Nov 8, 2010, 10:23:08 AM11/8/10
to Service Oriented Design With Ruby
So, I am really enjoying the book. Paul has an engaging narrative
voice, and the text is quite informative, especially in enumerating
the issues with how to separate concerns between services.

My only wish for the book that has remained unfulfilled is an overview
of test-first development with services, or even how best to stub out
clients that would engage these services. I am curious to see what
approaches others have used.

Best,
Mike Pence

Paul Dix

unread,
Nov 8, 2010, 11:03:43 AM11/8/10
to service-oriented...@googlegroups.com
Hey Mike,
Thanks, glad you're enjoying it. One method that I find is good is to
develop the client and the service in tandem. Basically, write the
service so that it can start up in "integration test" mode and load up
some test data. Then write each piece. For example, if you're writing
a user service:

1. Write the User show part of the service. Have the integration test
mode load up a test user, start the service.
2. Write the User show part of the client and have the test validate
that it can hit the service and find that user.
3. Write the User destroy part of the service. Have the integration
test mode load up a test user for deletion.
4. Write the User destroy part of the client and have the test
validate that it can hit the service and destroy that user.

and keep going until the whole thing is done. Then you'll have a
working client and service that actually use each other to verify
functionality. The other nice thing is that writing the client will
help you determine if the API you're designing actually makes sense.

That's a simple example where you control both the service and the
client. If you don't control the service and can only write the
client, use the standard mocking tools for the HTTP library you're
using.

Hope that helps,
Paul

> --
> You received this message because you are subscribed to the Google Groups "Service Oriented Design With Ruby" group.
> To post to this group, send email to service-oriented...@googlegroups.com.
> To unsubscribe from this group, send email to service-oriented-desig...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/service-oriented-design-with-ruby?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages