I'm attempting to test an api, but this api depends on running other services. Essentially the problem is that I want to test the api, but don't want to actually run those services, they are already tested elsewhere.
Here is a basic breakdown of what we are testing in general terms:
- I have an api that makes a
fooI want to testbar - Part of making
foomakes the filebar - I have a lot of very different
foo's and a lot of similarbar's - I don't want to make a new
fooevery time I want to check thebar
I've thought of but haven't come to a conclusion on:
- Just test
barwhen I make afoo(but all thebarare in a similar service and probably shouldn't be tested separately) - Actually make a
foowhenever I make abar(time intensive, double testing, bad for Separation of Concerns) - Create a fake database of
barthat the api tests call(requires db changes, not sure of effectiveness of this type of test) - Use some sort of Serenity/Cucumber magic
Other Issues:
- When the tests are run, it's threaded, so I can't guarantee that
foooccurs beforebar.