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

What is the preferred testing approach when using APIKit? #226

Closed
ratkins opened this issue Dec 29, 2016 · 3 comments
Closed

What is the preferred testing approach when using APIKit? #226

ratkins opened this issue Dec 29, 2016 · 3 comments

Comments

@ratkins
Copy link

ratkins commented Dec 29, 2016

I see the Request implementations are easily unit-testable which is nice. But what is the preferred approach to testing for clients of the Session API? It's declared as a class rather than a protocol so it's not simply a matter of substituting a fake a test time. I don't see a "MockSessionAdapter" in the test tree, but is that the appropriate hook point?

@jyounus
Copy link
Contributor

jyounus commented Jan 2, 2017

Good question.
I guess subclassing the Session class and overriding the functions isn't really ideal (or creating a completely new "MockSession" class). I would welcome a better approach to test our code with APIKit @ishkawa.

@ishkawa
Copy link
Owner

ishkawa commented Jan 14, 2017

Hi @ratkins,

Yes, SessionAdapter is an appropriate hook point for mocking. I always create mock adapter like this. It would be great if APIKit has a flexible implementation of MockSessionAdapter for general purpose.

Of course, subclassing Session also works.

@ishkawa
Copy link
Owner

ishkawa commented Mar 12, 2017

Closing this issue. Feel free to reopen this issue for the further discussion!

@ishkawa ishkawa closed this as completed Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants