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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device and Platforms tests #65
Conversation
Platforms testsSame thing here with testing different execution paths... |
Result of integration 1 |
self.modelName = json.stringForKey("modelName") | ||
self.deviceECID = json.optionalStringForKey("deviceECID") | ||
self.modelUTI = json.stringForKey("modelUTI") | ||
if let proxyDevice: NSDictionary = json.optionalForKey("activeProxiedDevice") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just use if let proxyDevice = json.optionalDictionaryForKey("activeProxiedDevice") {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. Earlier I was trying to achieve this other wa around and this is a small artifact...
Let me know when you push the changes so that we can merge this 馃槈 |
Ok, changed something, added other things and here's the result... 馃槈 You haven't answered how to handle failing paths in test cases. Got any idea? |
Result of integration 2 |
Yeah the failing paths are interesting. There is not that much code different for each endpoint. Most of the logic is shared. So I'd rather write tests for |
Cool, thanks as always, @cojoj! |
Exactly, one complete test case for |
Yup, feel free to use any of the available ones, but it needs to be clear we're testing |
I guess I'd be hard to achieve as |
Should be fine with |
Probably... I'll try to write something |
Hah, I think that testing |
Why? Just call it on an The only thing |
Right, it doesn't have wide range of responsibilities but you have to fake HTTP responses to check the failable path eg. To test this code (from guard let data = data else {
//no body, but a valid response
completion(response: httpResponse, body: nil, error: nil)
return
} You have to return Correct me I you think that I'm spinning a yarn... |
Ok this makes sense. I guess we should test with separate |
Cool! Anyway, I hate the idea that all in all we'll have to create manually some fake data 馃槗 |
馃樋 |
@czechboy0 I hope you're back from holidays, full of energy and ready to work 馃槅
New batch with Device tests.
First of all, I've added missing fields/properties to Device model - please check them and let me know what do you think and if things marked as
Enum?
in comments should be moved to DeviceSpecyfication file.One thing that concerns me about cassetes is that we're only testing gold path and skipping any possible error paths. Do you think we should create test cases and test failing paths as well? If so, how would you write those tests? Record another casette, write mocks or stubs? As we leave it as it is now we won't get full coverage of the code...