Closed pmkowal closed 9 years ago
Duration: 1 minute and 5 seconds Result: Perfect build! All 48 tests passed. :+1: Test Coverage: 51%.
@pmkowal can you provide a screenshot of test coverage form XcodeServerEndpoints
class?
here you go @cojoj:
Nah, the test coverage in code... You know, this fancy indicators showing which lines has been tested 😉
@cojoj are you concerned with buildasaur result of integration?
Nope, just want to see coverage and give you ans answer to
but I don't have a clue how to 100% cover the XcodeServerEndpoints class
Cool, I didn't look at it, thx @cojoj
Ok, I know now how to test authorization
part, but do you have idea how to test body
part?
Great I was just writing about his authorization part but if you know how to solve this good for you! 🍹
Now, the body
part... It'll be used [mostly] for POST
actions. In that case you have to provide a body
parameter to createRequest()
. To fully check this you'll have to provide a valid JSON and in that case try
wil pass and everything will succeed. To cover rest you'll have to provide a failbale JSON which will crash NSJSONSerialization.dataWithJSONObject()
Hope you get me 😉
The point is tried to provide failbale JSON, but I couldn't figure it out :smile:, because we can use only [String: String]
as body
param.
@cojoj ...and with authorization
I would create another instance of XcodeServerEndpoints
with different config. Do you have other ideas?
Exactly... That's what I've been struggling with too 😕
One way is to provide a malformed String
but right now I can't think of any... Leaving code like this without a coverage is a bummer but I guess right now we have no other choice. Maybe @czechboy0 have a neat solution to this? 😜
You can move XcodeServerEndpoint
to a property and mark it as var
so later in test cases you can simply replace config
.
I'd be great if we have read access to Foundation
... You'd simply check what Apple understands under failable JSON. Right now IDK... ¯(ツ)/¯
You can move XcodeServerEndpoint to a property and mark it as var so later in test cases you can simply replace config
I was rather thinking of creating another XcodeServerEndpoints
in this particular method, because replacing serverConfig
could break other tests imo. The seond thing is we cannot exchange serverConfig
since it is declared as a let
.
I'd be great if we have read access to Foundation... You'd simply check what Apple understands under failable JSON. Right now IDK... ¯(ツ)/¯
:grin:
Oh okay... If it's let
you have to create instance of XcodeServerEnspoints
for each test case.
Duration: 52 seconds Result: Perfect build! All 49 tests passed. :+1: Test Coverage: 52%.
ok @cojoj authorization
part updated.
Great stuff, thanks @pmkowal!
:+1:
Hey, I added three tests for
createRequest
method, but I don't have a clue how to 100% cover theXcodeServerEndpoints
class. Please take a look.Btw. I have one proposition regarding
XcodeServer
class. I would move the code below (fromsendRequestWithMethod
method) tocreateRequest
method, becausecreateRequest
method can figure outHTTP.Method
directly from its parameter. What do you think?