# erikdoe/ocmock

Mock objects for Objective-C

Repository: https://github.com/erikdoe/ocmock
Canonical: https://ross.abutalabs.com/products/ocmock
Homepage: http://ocmock.org
Language: Objective-C
License: Apache-2.0
License Family: permissive
Topics: ocmock, objective-c, mock-objects
Last push: 2024-06-30T15:44:47+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5492, "days_push": 794, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2171, forks 608 (observed 2026-08-28T04:06:21.820412+00:00)

## What it is
OCMock is an Objective-C implementation of mock objects for unit testing, supporting stubs, dynamic mocks, partial mocks, and strict expectations. It integrates with Xcode test targets via CocoaPods or Carthage for both iOS and macOS development.

## Use cases
- stub method return values in Objective-C unit tests
- verify interactions between objects in tests
- mock NSUserDefaults and other system classes
- create partial mocks to override methods on real objects
- mock protocols and class methods
- write strict mocks that fail on unexpected calls

## When to choose
- writing unit tests for Objective-C code on iOS or macOS
- you need stubs, verification, or partial mocks in XCTest
- you want a mature, well-documented mocking library for Apple platforms

## When to avoid
- testing Swift-only code where Swift-native mocking may fit better
- non-Apple platforms or non-Objective-C runtimes

## Facets
- artifact type: library
- maturity: stable
- function: mocking, testing
- domain: testing, developer-tools
- platform: cross-platform
- tags: objective-c, mock-objects, unit-testing, stubs, xcode, macos, ios

## Member repositories
- erikdoe/ocmock (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:21.820412+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:49:14.960373+00:00, confidence not recorded.
  - readme: https://github.com/erikdoe/ocmock (fetched 2026-08-28T04:06:21.820412+00:00, sha 29dc6ae8114a)
  - homepage: http://ocmock.org (fetched 2026-08-29T10:29:23.351135+00:00, sha 8f4c29945fc6)
  - site_page: https://ocmock.org/reference (fetched 2026-08-29T10:29:23.360296+00:00, sha 1d9254942e4d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
