slack-ruby-client
slack-ruby-client copied to clipboard
Auto-generate tests for client APIs
We generate endpoints, should also generate tests that have bare minimum expectations around these.
See https://github.com/dblock/slack-ruby-client/pull/8.
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.
I'll try to implement it.
Should we add responses of methods to https://github.com/dblock/slack-api-ref for matching correctness of responses from API?
Not sure. I wouldn't test the Slack API implementation :)
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 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.