1

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:

  1. What is the use case of stripe-mock if it will always return a successful response regardless of the validity of the payment?
  2. 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:

  1. Keep using Stripe's test mode.
  2. Build a happy-path suite using stripe-mock, and a non-happy-path suite using Stripe's test mode.
  3. 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)
  4. Something else?

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.