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

Improvements for use in integration tests #111

Open
2 tasks done
jkuek opened this issue Jan 11, 2023 · 4 comments
Open
2 tasks done

Improvements for use in integration tests #111

jkuek opened this issue Jan 11, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@jkuek
Copy link

jkuek commented Jan 11, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure a similar issue has not already been created

Description

Hi, I'm evaluating Mockaco for use in integration tests. I'm hoping to use it to mock the third-party push notification and SMS services as other integrations so that I can confirm that our platform is correctly making the requests to these services.

Previously we were using getsandbox.com but that is now discontinued. I have a number of tests that I need to refactor.

However, I have run into a few limitations which seem to prevent Mockaco from meeting my needs:

  1. The timestamp provided in verification is in format hh:mm, which isn't really specific enough. I would prefer ISO8601 format or at minimum hh:mm:ss. My tests take seconds to run, not minutes, so it's useful to be able to confirm exactly when the request was made.
  2. It would be useful to be able to clear the cache programmatically, e.g. with a DELETE http://localhost:5000/_mockaco/verification request or similar
  3. Sometimes a test might result in multiple requests to the same route with different bodies. Is there any way currently of retrieving the list of calls made to Mockaco?

Proposed solution

  1. Change timestamp property in verification response to ISO8601 format.
  2. Add new special route to clear the cache (e.g. GET /_mockaco/clear or DELETE /_mockaco/verification)
  3. Add new special route to list all calls made to a route (e.g. GET /_mockaco/list?route={route} )

Alternatives

I have considered writing my own mock server to do exactly what I want, but it seems like this functionality would be useful for everyone? I'm open to suggestions for other platforms/software that I could use to achieve my goals.

Additional context

No response

@jkuek jkuek added the enhancement New feature or request label Jan 11, 2023
@jkuek jkuek changed the title Improvements for Improvements for use in integration tests Jan 11, 2023
@wlclass
Copy link

wlclass commented Jan 11, 2023

Can we configure the time format in MockacoOptions, which can be passed through a configuration file or environment variable and take effect globally.
The second and third items should be a relatively simple implementation

@jkuek
Copy link
Author

jkuek commented Jan 11, 2023

Yes, to retain compatibility with existing mockaco consumers it would be better to keep the current timestamp as default with the option to change format to ISO8601

@natenho
Copy link
Owner

natenho commented Jan 12, 2023

I agree with @wlclass! I've been a little busy in the last weeks to work here, but it would be a good addition to the project, if you guys are interested to implement it. Hopefully I can invest some time coding here soon, but any help before that is appreciated, as the enhacement requests are increasing.

@jkuek you might want to consider the discussion in #105 if you intend to use a container in your integration tests.

@wlclass
Copy link

wlclass commented Jan 12, 2023

Let me try.
The third item seems to be a challenge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants