Closed jbwheatley closed 3 years ago
it should be possible to rewrite PactForgerSuite
so that it has one global stubber and http client for all the tests in that suite.
on further inspection this is a bad first issue
@jbwheatley it seems like just allowing more flexibility around the standing up and shutting down of the pact stub server would help with this. Currently you have to do ScalaPactDescription.runConsumerTest
, which means right now you have to do all of your tests inside of one test block in ScalaTest if you don't want to stand up a stub server for every single test. If this was refactored instead to be ScalaPactDescription.startServer
, which could start up the pact stub server, write out pact files, as it currently does, and wait for the server to be ready... but instead of executing a test it would just return the IPactStubber
. Then tests can be run at will, and when they are done server.shutdown()
can be called. This would fit in really nicely with ScalaTests beforeAll
/afterAll
functionality.
@solarmosaic-kflorence yup, this is very similar to what I started implementing on a branch a while ago, but got distracted by other things so never got around to finishing it. Its still on my radar though
I may be able to help out with this in the next few weeks as I will be off work :)
We should add an easy option to forge a pact without running any consumerTests against the stubber because every test creates a http client and server, regardless of whether any integration testing is being done