I'm building an automated test suite to integration/feature test my organization's Stripe implementation within a GitLab CI pipeline. We're running Laravel 8 and using phpunit for testing.
Within this suite I'm testing both happy and non-happy paths (i.e. I want to test valid and invalid payment details).
At the moment the suite is just running locally and is using a Stripe account that dedicated for testing using Stripe's test mode. I've been using Stripe's testing tokens to create different types of payments and its all working good so far. However, I want the test suite to run quickly within a CI pipeline, and I found stripe-mock as an alternative. stripe-mock claims it makes,
test suites integrating with Stripe faster and less brittle.
However, stripe-mock notes that a current limitation is,
Testing for specific responses and errors is currently not supported. It will return a success response instead of the desired error response.
So based on this I've got two questions:
- What is the use case of stripe-mock if it will always return a successful response regardless of the validity of the payment?
- Is there another preferred way integration testing a Stripe implementation, or is what I'm currently doing the best approach?
With regards to my second question I believe my options are to:
- Keep using Stripe's test mode.
- Build a happy-path suite using stripe-mock, and a non-happy-path suite using Stripe's test mode.
- Build a happy-path suite using stripe-mock, and just manual test non-happy paths. ( I don't really see this as a valid option for me as I would like smoke tests for all Stripe related functionality)
- Something else?
Thanks in advance!