ocmock Questions
1
Solved
I'm trying to add OCMock to my existing Cocoa project, but am running to a strange problem that I don't see anyone else cover.
I finally isolated it to the following: if I simply add OCMock.framew...
Revelatory asked 7/2, 2013 at 20:31
5
Solved
I often find in my iPhone Objective-C unit tests that I want stub out a class method, e.g. NSUrlConnection's +sendSynchronousRequest:returningResponse:error: method.
Simplified example:
- (void)t...
Lissettelissi asked 27/11, 2009 at 18:12
1
Solved
Consider this code, which works (the loginWithEmail method gets expected as, well, expected):
_authenticationService = [[OCMockObject mockForClass:[AuthenticationService class]] retain];
[[_authen...
Kellar asked 27/9, 2012 at 9:34
2
Solved
I have a private property that is declared in the .m file of my class to be tested, let's call it ClassUnderTest. ClassUnderTest instantiates an instance of ClassToBeMocked. How do I use OCMock to ...
Vasiliki asked 9/8, 2012 at 23:37
3
Solved
Under ARC, I have an object, Child that has a weak property, parent. I'm trying to write some tests for Child, and I'm mocking its parent property using OCMock.
Under ARC, setting an NSProxy subcl...
Rahel asked 1/2, 2012 at 22:47
1
Solved
I am trying to use OCMock for testing my app. But I am confused where should we use expect and where to use stub? Can anyone help please?
Burseraceous asked 19/6, 2012 at 7:17
1
Solved
Is there a way to stub method, that takes block as it's parameter? For example mehod:
- (void)reverseGeocodeLocation:(CLLocation *)location completionHandler:(CLGeocodeCompletionHandler)completio...
3
Solved
I'm testing real web service calls with OCMock.
Right now I'm doing something like:
- (void)testWebservice
{
id mydelegatemock = [OCMockObject mockForProtocol:@protocol(MySUTDelegate)];
[[mydel...
Excitability asked 5/9, 2011 at 16:12
2
Solved
Does anyone know how to capture an argument sent to an OCMock object?
id mock = [OCMockObject mockForClass:someClass]
NSObject* captureThisArgument;
[[mock expect] foo:<captureThisArgument>]...
Gasolier asked 24/4, 2012 at 6:6
1
Solved
I'm trying to use OCMock for the first time in my test cases. It's a Mac project, built on and targeting Lion, in Xcode 4.3. The main app and the test bundle both have ARC turned on, and so every t...
Ember asked 6/3, 2012 at 16:25
2
Solved
Need to write unit testing for the following code, I want to do mock for class method canMakePayments, return yes or no, so far no good method found dues to canMakePayments is a class method ...
Linton asked 8/12, 2011 at 6:24
1
Solved
I have some code I want to test that is passing around the address of a struct:
MyObject myObject = ...;
MyRecord record = [someObject record]; //record is a @property
[myObject add:&record];
...
Laundrywoman asked 5/10, 2011 at 19:15
2
Solved
I am trying to use OCMock 1.77 for unit and application testing with iOS4 and Xcode 4/SDK4.3. I have followed the instructions to do using OCMock as a static library found here: http://www.mulle-ky...
Consign asked 30/3, 2011 at 6:12
1
Solved
Ho do I stub a method used in the init method?
The related methods in my class:
- (id)init
{
self = [super init];
if (self) {
if (self.adConfigurationType == AdConfigurationTypeDouble) {
[sel...
Connivance asked 14/9, 2011 at 9:13
4
I'm hitting a road block and I'm wondering if the brilliant collective minds here can help. In ObjC CocoaTouch I'm trying to mock an object that takes struct parameters and returns a struct. OCMock...
Vaginate asked 5/2, 2009 at 15:24
2
Solved
Edit: This was all caused by a typo in my Other Link Flags setting. See my answer below for more information.
I'm attempting to mock a UIWebView so that I can verify that methods on it are calle...
Yalu asked 11/11, 2010 at 14:56
3
Solved
I decided to add unit tests to my project and continue development in a test-driven kind of way. I’m currently working on implementing unit tests for my ManageSieve client object and I’m not sure w...
Singularity asked 4/9, 2010 at 11:4
1
Solved
I'm trying to mock a UITabBarController in my app's tests. I have a category method on that class defined elsewhere in another file that gets imported along with ocmock in my test class. what i'm t...
Mettle asked 13/7, 2009 at 22:56
1
I'm writing an iPhone application that needs to get some data from a web server. I'm using NSURLConnection to do the HTTP request, which works well, but I'm having trouble unit testing my code in t...
Dentoid asked 30/3, 2009 at 13:4
© 2022 - 2024 — McMap. All rights reserved.