Is there a way to test a RESTful api without actually running the backend computations in Serenity

404 views Asked by At

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:

  1. I have an api that makes a foo I want to test bar
  2. Part of making foo makes the file bar
  3. I have a lot of very different foo's and a lot of similar bar's
  4. I don't want to make a new foo every time I want to check the bar

I've thought of but haven't come to a conclusion on:

  1. Just test bar when I make a foo(but all the bar are in a similar service and probably shouldn't be tested separately)
  2. Actually make a foo whenever I make a bar(time intensive, double testing, bad for Separation of Concerns)
  3. Create a fake database of bar that the api tests call(requires db changes, not sure of effectiveness of this type of test)
  4. Use some sort of Serenity/Cucumber magic

Other Issues:

  1. When the tests are run, it's threaded, so I can't guarantee that foo occurs before bar.
0

There are 0 answers