ocmock Questions
4
Solved
I am going through an application and adding Unit Tests. The application is written using storyboards and supports iOS 6.1 and above.
I have been able to test all the usual return methods with no ...
Penurious asked 16/12, 2013 at 11:1
1
Anyone know how to verify an OCMock expect in Swift? Swift Doesn't use Exceptions so XCTest no longer includes XCTAssertNoThrow. Is There any other way to verify a method was called with OCMock? I ...
2
Solved
I have a method of the followng signature;
- (NSInteger) getFirstVisitTimeStamp;
When I use OCMock to mock and return a value, the test fails with the below error.
[[[[YSNYI13NMockingTest mocked...
Sanburn asked 3/6, 2014 at 21:42
4
Solved
I'm trying to add OCMock to my iOS 4 project. To test it out, I have a class Person with one method, -hello. When I run this test:
- (void) testMock {
id mock = [OCMockObject mockForClass:[Person...
1
Solved
When I set the return value of an NSInvocation to be an NSString, the invoker is receiving an NSCFString.
In my case I'm mocking to pull a bundle path from file included by unit tests:
[[[_bundle...
Dulcinea asked 5/3, 2014 at 20:52
2
Here is the tested code:
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailComposeController = [[MFMailComposeViewController alloc] init];
[mailComposeController ...
Collencollenchyma asked 23/2, 2014 at 13:1
1
We're trying to create a unit test (with OCMock although, open to other frameworks) that mocks a class that on class load has a side effect.
We have a tracking class that wraps calls to other trac...
Zinn asked 5/2, 2014 at 19:52
5
Solved
I'm trying to mock a method that has the equivalent of the following signature:
- (NSDictionary *) uploadValues:(BOOL)doSomething error:(NSError **)error
I want it to return a small dictionary s...
Avisavitaminosis asked 17/8, 2009 at 16:13
4
Solved
I have created a mock UINavigationController using OCMock. However, I cannot assign it to the navigationController property of a UIViewController since that property is readonly.
id mockNavControl...
Heeltap asked 22/12, 2010 at 23:20
2
Solved
I'm trying to deal with OCMock. I created simple class MyClass.
@interface MyClass : NSObject
- (NSString *)simpleMethod;
@end
@implementation MyClass
- (NSString *)simpleMethod {
[self method]...
Indulgent asked 30/11, 2013 at 22:18
3
Solved
I'm using OCMock to mock some Core Data objects. Previously, I had the properties implemented with Objective-C 1.0 style explicit accessors:
// -- Old Core Data object header
@interface MyItem : N...
Squawk asked 9/12, 2009 at 20:15
3
Solved
Here's the method under test:
- (void)loginWithUser:(NSString *)userName andPass:(NSString *)pass {
NSDictionary *userPassD = @{@"user":userName,
@"pass":pass};
[_loginCntrl loginWithUserPass:...
Avaunt asked 14/7, 2013 at 23:20
1
Solved
i am making a GET request to retrieve JSON data with AFNetworking as this code below :
NSURL *url = [NSURL URLWithString:K_THINKERBELL_SERVER_URL];
AFHTTPClient *httpClient = [[AFHTTPClient allo...
Opinion asked 30/9, 2013 at 13:19
2
Solved
I was just practising OCMock, The problem I am facing here is
I have one method named foo which returns CGRect, this method is called from another method callFoo.
-(CGRect)foo {
return CGRectM...
1
Solved
I have a method I would like to test with OCMock but not sure how to do that. I need to mock
ExtClass which isn't defined as part of my code (external library):
+(NSString *)foo:(NSString *)param...
Effeminize asked 29/8, 2013 at 6:21
2
Solved
One of the parameter of my method is **error and my project is in ARC mode. When writing stub for this method to call a mock method i set parameter to below possible values. Either it causes compil...
Donelladonelle asked 17/8, 2013 at 5:31
1
Solved
I am learning OCMock for iOS testing. What's the difference between "class mock" and "partial mock", and when should you use one vs the other?
http://ocmock.org/features/
2
I am trying to check if a class method is getting invoked using OCMock. I have gathered from OCMock website and other answers on SO that the new OCMock release (2.1) adds support for stubbing class...
Amathist asked 9/5, 2013 at 11:59
3
Solved
I'm using OCMock and I'm trying to do to something like this in one of my tests:
[[mockScrollView expect] setContentSize:[OCMArg any]];
The problem is that [OCMArg any] returns an id type, and I...
Eleanoraeleanore asked 4/6, 2013 at 11:0
6
Solved
How can I unit test my NSURLConnection delegate?
I made a ConnectionDelegate class which conforms to different protocols to serve data from the web to different ViewControllers. Before I get too fa...
Guide asked 28/3, 2012 at 13:28
2
Solved
I'm trying to set up a simple OCMock unit test in an iOS project, just to familiarize myself with the framework.
I have a mocked DataLoader class, and even though I'm calling the method myself, my...
Wafd asked 25/6, 2013 at 12:40
0
I've implemented the code in this posting:how to unit test a NSURLConnection Delegate?
and have managed to get a test case going with my code where I simulate sending a server package of data via ...
2
Passing an OCMock object to a method where the function calls isKindOfClass. However for unit test, the value returned is not of the mocked class but OCMockObject
Knorring asked 1/3, 2013 at 2:10
2
Solved
When I want to verify that in one method a mock object is receiving some messages in a particular order I do something like this:
// sut is an instance of the class I am testing and myMock is a mo...
Emission asked 24/4, 2013 at 15:50
4
Solved
I'm wondering how to go about testing this. I have a method that takes a parameter, and based on some properties of that parameter it creates another object and operates on it. The code looks somet...
Nonunionism asked 6/7, 2009 at 20:56
© 2022 - 2024 — McMap. All rights reserved.