Testing architecture help needed on open source Stripe package

We’ve been working hard on releasing a 2.0 version of stripity_stripe, which is the most widely used Elixir package for Stripe payments.

The one thing that is preventing us from moving forward more quickly for the community is the lack of a good testing strategy. The 1.x version had used ExVCR for this purpose, but we would like to avoid this approach going forward.

I’m open to other approaches. We’ve heard good things about bypass for testing APIs and providing a mock server.

The ultimate end goal is to not only allow us to have confidence in our package’s interactions with Stripe, but also to give consuming projects a (possibly separate) package that they can use to perform testing in their own projects.

If you’re someone who could work on this – or even just spike out a solution that we can run with – please come comment on GitHub. Our RFC is open here https://github.com/code-corps/stripity_stripe_testing/issues/1

Thanks in advance!

4 Likes

I think it might be nice to have a package that makes it easy to build mock HTTP API’s for testing. None of the existing solutions I found in my 10-ish minutes of googling around quite implement this.

Personally, I like creating a mock server that implements the API I’m testing against. This helps me feel the best about my application interacting with the outside world as it should, without actually interacting with the outside world. I don’t like to immediately resort to creating a mock of an internal (or even external) module and checking if some function was called. I know the downside to creating a mock server is that the person creating the mock server has to really understand the API to implement.

Basically, I really like @josevalim’s article on mocks and I couldn’t find an easy way to create a mock server for an external HTTP API. I’d be glad to help if that’s the kind of thing you’re looking for. I could even use it on some of my own projects.

2 Likes

What about bypass?

4 Likes

That’s actually… what I’m looking for. Thanks @josevalim!

Why not exvcr?