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
foo
I want to testbar
- Part of making
foo
makes 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
foo
every time I want to check thebar
I've thought of but haven't come to a conclusion on:
- Just test
bar
when I make afoo
(but all thebar
are in a similar service and probably shouldn't be tested separately) - Actually make a
foo
whenever I make abar
(time intensive, double testing, bad for Separation of Concerns) - Create a fake database of
bar
that 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
foo
occurs beforebar
.