SwiftMockGeneratorForXcode Versions Save

An Xcode extension (plugin) to generate Swift test doubles automatically.

v1-beta.28

1 year ago

Important

Any versions previous to v1-beta.28 will expire on 10th Sept 2022. Installing this version will fix this issue.

Changes

  • Resigns with new Developer ID to extend signing expiry date.
  • Makes universal build for both x86_64 and arm64 architectures.
  • Minimum OS version is now 11.0 (Big Sur)

v1-beta.27

3 years ago
  • #43 Rebuilds in Xcode 12.1 to support the new security features in Big Sur.

Thanks to @MattAydin and @dannypier for pointing this out and helping me find a fix 👍

  • #41 Fixes typo in error message

Thanks to @rolandkakonyi for fixing this 👍

v1-beta.25

4 years ago
  • Now bundled with a command line tool to generate mocks from Terminal.
  • The app and Xcode extension are now fully sandboxed.
  • The project dependencies are now compiled and included so it can be built be anyone.
  • Improves formatting of the generated code.

Using the command line tool

For convenience, create a symbolic link to the CLI.

$ ln -s "/Applications/Swift Mock Generator for Xcode.app/Contents/MacOS/genmock" /usr/local/bin/genmock

Use $ genmock --help for a list of options.

See how this project generates its mocks here.

Sandboxing

This extension is fully sandboxed which means you need to give permission to read your project files before using it.

Give permission when automatically detecting the project path

  • Open the companion app.
  • Press "Give permission to read directory".
  • Select the directory and press "Grant permission".
  • In Xcode, generate your test double.

Give permission when manually choosing the project path

  • Open the companion app.
  • Press the select directory button.
  • Select the directory and press "Open".
  • In Xcode, generate your test double.

Please note if using manual project paths before v0.25 you will have to select your project path again.

v1-beta.24

4 years ago

v1-beta.23

4 years ago
  • Built for Catalina and Mojave only.
  • Performance fixes for resolving mocked types.

Please see the latest release for a build.

v1-beta.22

4 years ago

Please see the latest release.

v1-beta.21

4 years ago

Please see the latest release.

v1-beta.20

4 years ago
  • Parses the open keyword when used as an identifier.

v1-beta.19

5 years ago
  • Supports most subscript features *
  • Adds fixes for Swift 5
  • The app bundle is now notarized by Apple

* Missing subscript features include closure arguments and generic parameters.

Breaking Changes

  • Dummies now generate a fatalError() if a default value cannot be found for the return type.
  • Swift 5 no longer allows for IUOs in arrays ([Int!]). They are now generated as optionals ([Int?]).

Example:

protocol P {
  var property: Int! { set get }
}

Swift 4

...
var invokedProperty: Int?
var invokedPropertyList = [Int!]()
...

Swift 5

...
var invokedProperty: Int?
var invokedPropertyList = [Int?]()
...

v1-beta.18

5 years ago
  • Adds more logging around SourceKit errors
  • Adds a new test double - "partial spy"

What is a partial spy?

Partial spies are spies which can also forward calls to the original implementation.

E.g.

class MyClass {
  func myMethod() {
    print("original implementation")
  }
}

class MyClassPartialSpy: MyClass {
... // generated partial spy
}

let mySpy = MyClassPartialSpy()

mySpy.myMethod() // does not print "original implementation"

mySpy.forwardToOriginalMyMethod = true

mySpy.myMethod() // prints "original implementation"