Michael Guterl
12/25/2008 1:07:00 AM
On Wed, Dec 24, 2008 at 7:20 PM, Michael Boutros <me@michaelboutros.com> wrote:
> Hello all,
>
> I'm here not for code help, but more for some opinions. At the moment
> I'm writing a library to interact with Snipt. However, I have no idea
> how to test it. I don't want to include my username and password in the
> tests, and I know if I create a test account and leave the credentials
> in some jerk will login to the account and change the password. This
> doesn't just apply to Snipt, but rather to any library that connects to
> a web service. Thoughts?
>
Any time that I am testing an external service like this, I tend to
cache the response as a fixture and use mocks or stubs in place of the
actual call to the service.
If you're using test/unit I'd use Flexmock or Mocha, RSpec has a
mocking/stubbing component built in.
HTH,
Michael Guterl