Add support for parallel tests to stub server #845
Replies: 4 comments 1 reply
-
@maoberlehner Thanks for reaching out. And appreciate the well articulated request. We will get back to you on this shortly. |
Beta Was this translation helpful? Give feedback.
-
@maoberlehner We went through your use case and your proposed solution. It is indeed something that we have also encountered the need for in the past. However in terms of the solution we would like to add to your suggestion and also ahve other community members to chime in (since we believe this will be useful to many people), so that we can discuss and finalise the approach. So I am converting this to a Github discussion to facilitate the same. Thanks. cc @jaydeepk @joelrosario |
Beta Was this translation helpful? Give feedback.
-
Hello @maoberlehner, I am thinking that we make the There by we may not have the need for the adding another property in the expectation ( Also just of curiosity wanted to check if you have had a chance to try our dynamic expectations. On a related note we also have transient expectations. Do have a look and let us know your thoughts. Thanks, |
Beta Was this translation helpful? Give feedback.
-
@maoberlehner We have an official docker image now. Please do have a look and let us know your thoughts on this. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
In addition to classic contract testing, I also use the Specmatic stub server for my E2E web application tests. To make the tests run as fast as possible, I must run them in parallel. But this means that the stub server must be able to return different responses depending on the test that triggers the request.
Describe the solution you'd like
My test runner Playwright, gives me a
TEST_PARALLEL_INDEX
environment variable. I pass this index to/_specmatic/expectations
as ax-parallel-index
header. The web application under test sends this header to the Specmatic stub endpoint and therefore, it returns the correct stubs for my test. But there is one downside to this: I need to specify thex-parallel-index
header in the API specification yaml. Which I want to avoid.My current workaround:
Proposed solution:
Additionally, I propose that sending an
X-Specmatic-Group
header would ensure that the stub server responds with the stub specified for the provided group.Describe alternatives you've considered
I've also considered running multiple instances of my web app and Specmatic in parallel in Docker containers, and then parallelizing test runs on a file basis (run N test files in Docker container A, N in Docker container B...). But this would mean a lot of overhead.
Beta Was this translation helpful? Give feedback.
All reactions