Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-generate tests for client APIs #9

Open
dblock opened this issue Aug 17, 2015 · 6 comments
Open

Auto-generate tests for client APIs #9

dblock opened this issue Aug 17, 2015 · 6 comments

Comments

@dblock
Copy link
Collaborator

dblock commented Aug 17, 2015

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

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

accessd added a commit to accessd/slack-ruby-client that referenced this issue Jan 26, 2016
accessd added a commit to accessd/slack-ruby-client that referenced this issue Jan 26, 2016
dblock added a commit that referenced this issue Jan 26, 2016
@dblock
Copy link
Collaborator Author

dblock commented Jan 26, 2016

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.

@accessd
Copy link
Member

accessd commented Jan 27, 2016

I'll try to implement it.

@accessd
Copy link
Member

accessd commented Jan 28, 2016

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

@dblock
Copy link
Collaborator Author

dblock commented Jan 28, 2016

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

@accessd
Copy link
Member

accessd commented Jan 31, 2016

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.

@dblock
Copy link
Collaborator Author

dblock commented Jan 31, 2016

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants