-
Notifications
You must be signed in to change notification settings - Fork 82
Install with Carthage for Swift
-
In your Cartfile add Cucumberish
github "Ahmed-Ali/Cucumberish"
-
Run 'carthage update' and add Cucumberish.framework to your test target
-
Go to your test target build phases, and add a new Copy Files phase and set it like the screenshot
-
Go to your test target build settings, and add the following preprocessor macro:
SRC_ROOT=@\"$(SRCROOT)\"
-
Make sure Defines Module Build Setting is set to Yes for your test target:
-
Go to your test target folder and create a subfolder. Let's call it Features.
-
Add this folder to your test target in Xcode and choose Create folder references. Inside this folder, you will create the .feature files which will contain your test features and scenarios.
-
Replace the content of the auto-created test case file with the following:
import Foundation import Cucumberish class CucumberishInitializer: NSObject { class func CucumberishSwiftInit() { //Create a bundle for the folder that contains your "Features" folder. In this example, the CucumberishInitializer.swift file is in the same directory as the "Features" folder. let bundle = Bundle(for: CucumberishInitializer.self) //All step definitions should be done before calling the following method Cucumberish.executeFeatures(inDirectory: "Features", from: bundle, includeTags: nil, excludeTags: nil) } }
-
Create a new Objective-C .m file
-
Replace the contents of this file with the following:
//Replace CucumberishExampleUITests with the name of your swift test target #import "CucumberishExampleUITests-Swift.h" __attribute__((constructor)) void CucumberishInit() { [Cucumberish instance].testTargetSrcRoot = SRC_ROOT; [CucumberishInitializer CucumberishSwiftInit]; }
-
Only in case the name of folder that contains your test target files is different than the test target name, set the value of the Cucumberish property testTargetFolderName to the correct folder name before calling the execute method.
And you are ready to get started!