Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PactForger creates a stub server for every test #190

Closed
jbwheatley opened this issue Oct 31, 2020 · 5 comments
Closed

PactForger creates a stub server for every test #190

jbwheatley opened this issue Oct 31, 2020 · 5 comments

Comments

@jbwheatley
Copy link
Contributor

jbwheatley commented Oct 31, 2020

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

@jbwheatley
Copy link
Contributor Author

it should be possible to rewrite PactForgerSuite so that it has one global stubber and http client for all the tests in that suite.

@jbwheatley
Copy link
Contributor Author

on further inspection this is a bad first issue

@solarmosaic-kflorence
Copy link
Contributor

solarmosaic-kflorence commented Dec 17, 2020

@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.

@jbwheatley
Copy link
Contributor Author

@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

@solarmosaic-kflorence
Copy link
Contributor

I may be able to help out with this in the next few weeks as I will be off work :)

jbwheatley pushed a commit that referenced this issue Feb 15, 2021
Fixes #190 / #203: allow control over when stub server starts and stops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants