slack-ruby-client icon indicating copy to clipboard operation
slack-ruby-client copied to clipboard

Auto-generate tests for client APIs

Open dblock opened this issue 10 years ago • 6 comments

We generate endpoints, should also generate tests that have bare minimum expectations around these.

See https://github.com/dblock/slack-ruby-client/pull/8.

dblock avatar Aug 17 '15 13:08 dblock

Now that https://github.com/dblock/slack-ruby-client/pull/53 introduces minimal expectations around Web api endpoints we could go further. With specs we want to ensure that we didn't break anything accidentally, so I imagine generating specs that actually call the API and expect a VCR cassette replicating a certain basic behavior. We would generate such specs and run them once with an API token, then next time when we re-generate the specs as the API is updated we run with the old K7 and see what broke. The question is, of course, whether this is useful vs. the effort to implement it.

dblock avatar Jan 26 '16 23:01 dblock

I'll try to implement it.

accessd avatar Jan 27 '16 13:01 accessd

Should we add responses of methods to https://github.com/dblock/slack-api-ref for matching correctness of responses from API?

accessd avatar Jan 28 '16 20:01 accessd

Not sure. I wouldn't test the Slack API implementation :)

dblock avatar Jan 28 '16 20:01 dblock

So, it's difficult to generate such cassettes, because they must to be very individual for each method. One opportunity that I see, it's mocking api calls and therefore we can test that http request is successful.

accessd avatar Jan 31 '16 08:01 accessd

@accessd Makes sense. I wouldn't spend too much time on this. Tests for generated code are important only for the sake of ensuring that we "see" API changes. When someone runs the rake task to update the API, and something used to work and now doesn't would resurface. We don't want to test the actual Slack API, etc.

dblock avatar Jan 31 '16 13:01 dblock