ITV/scala-pact

Support async tests

Opened this issue · 2 comments

The runConsumerTest method is currently synchronous, because all of our code is asynchronous this means we have to use Await.result here instead of (in our case) ScalaTest's AsyncWordSpec. It would be better if this method were asynchronous by nature, and both a synchronous and asynchronous API were supported. (e.g. runConsumerTestAsync).

Likewise for setupProviderState it would be nice to support asynchronous setting up of state.

Actually, now that I understand how this works a little better, it seems like it would be best to just allow separating the standing up of the stub server from the shutting down of the stub server (for consumer tests). There should be different methods for starting and stopping it. That way it can be controlled either before and after each test or before and after all tests. This would allow for a more natural ScalaTest syntax (at least when using WordSpec).

Related to #190