Questions tagged [ocmockito]

OCMockito is an Objective-C implementation of Mockito, supporting creation, verification and stubbing of mock objects.

Key differences from other mocking frameworks:

  • Mock objects are always "nice," recording their calls instead of throwing exceptions about unspecified invocations. This makes tests less fragile.
  • No expect-run-verify, making tests more readable. Mock objects record their calls, then you verify the methods you want.
  • Verification failures are reported as unit test failures, identifying specific lines instead of throwing exceptions. This makes it easier to identify failures. (It also keeps the pre-iOS 5 Simulator from crashing.)
70 questions
0
votes
1 answer

Unit testing with OCMockito mocking UIImage

So I am attempting to start developing in a more test driven manner learning to use tests and such and as such i have already come across a vexing issue. I would like to test that a function i pass an NSArray to then set's an exposed UIScrollview…
Genhain
  • 1,937
  • 1
  • 19
  • 38
0
votes
1 answer

Testing blocks with Xcode 6 and OCMockito

I am starting in Unit testing with objective-c and I need to know how to test blocks with OCMockito and Xcode 6. I am testing an Interactor, this interactor should return an array as a block argument and I has to ask the Provider file for the…
croigsalvador
  • 1,993
  • 2
  • 24
  • 47
0
votes
1 answer

Test readonly property with OCMockito

I've got a class that has a readonly property. typedef NS_ENUM(NSInteger, MyObjectStates) { MyObjectStatesUnknown, MyObjectStatesOn, MyObjectStatesOff }; @interface MyObject : NSObject @property (nonatomic, readonly) MyObjectStates…
Bernd Rabe
  • 790
  • 6
  • 23
0
votes
1 answer

OCMockito Unit testing - how to verify that a method with primitive has been called?

How can I verify that my mock object created with OCMockito has received a method invocation with a primitive argument? The method that I'm trying to test is setProgress:(float)progress CompositeProgressView* mockProgress =…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
0
votes
1 answer

Compilation error with OCMockito verify and NSError**

I can not compile this code: [verify(mockedContext) deleteObject:item1]; [verify(mockedContext) deleteObject:item2]; [verify(mockedContext) save:anything()];<--compilation error for conversion id to NSError** However I'm able to pass compilation in…
Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114
0
votes
0 answers

Exception trying to test with TestNG a java aplication

I'm working with maven-java-spring and testNG, Everything seems to be fine until testing flow views..I'm trying to resolve this exception, i'm looking for, and i'found sth of diferents version but i don't believe this answer, let me show the…
ZaoTaoBao
  • 2,567
  • 2
  • 20
  • 28
0
votes
1 answer

How to use OCMockito to check the value inserted into UserDefault

I am staring to use OCMockito for Unit Testing. Right now I am using it to mock a UserDefaults(through dependency injection). I can control what is returned back by: [given([mockUserDefaults objectForKey:@"some key"]) willReturn:@"a value I…
aha
  • 4,314
  • 4
  • 23
  • 27
0
votes
1 answer

Dealing with UITableView's indexPathsForSelectedRows

I'm not sure how I can implement that my mock UITableView object answers correctly for indexPathsForSelectedRows. In my App the user can (in editing state) select cells in a table view, which represents the files/folders of a given directory. Once…
Bernd Rabe
  • 790
  • 6
  • 23
0
votes
1 answer

Testing the parameters send to a Mock Protocol with OCMockito

Good day, I'm using OCHamcrest and OCMockito to start my path using TDD methodology, they really cool tools but there's one thing that it seems that I don't understand about mocking a protocol and try to evaluate a parameter. Considering the example…
xlarsx
  • 981
  • 1
  • 9
  • 8
0
votes
1 answer

Unit testing NSURLConnection sendAsynchronousRequest with OCMockito

I'm struggling to write a unit test for an API wrapper with an interface like - (void)publish:(id)aRequest completionHandler:(void (^)(id, NSError *)) completionBlock which calls this method under the…
Cody A. Ray
  • 5,869
  • 1
  • 37
  • 31
1 2 3 4
5