On 2010.9.28 8:21 AM, Ovid wrote: > There are no standards that I know of because different situations can call > for > different responses. However, be very careful about just mocking everything. > If > you do and their API changes, you'll find yourself with passing tests for code which > does not work. > > Contact the people supplying the API (or read their docs carefully) and find > out if > you can interrogate for a version and what guarantees they provide for said version. > Don't allow mocks if the version changes unless you can't connect. With that, you > might offer people the option of connecting live, but also making it clear that you > only support version X.
You should also contact them and ask if they have a test server or test account you can use. For example, good payment APIs have sets of bogus credit card numbers you can feed it to generate certain responses. One number is guaranteed to always work. Another is guaranteed to always return an address verification failure. Etc... -- But there's no sense crying over every mistake. You just keep on trying till you run out of cake. -- Jonathan Coulton, "Still Alive"