-
Notifications
You must be signed in to change notification settings - Fork 82
Install with Carthage for Objective C
-
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)\"
-
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.
-
In your test target project navigator, replace the content of the auto-created test case file with the following:
#import <Cucumberish/Cucumberish.h> __attribute__((constructor)) void CucumberishInit() { //Define your step implememntations (the example project contains set of basic implementations using KIF) Given(@"it is home screen", ^void(NSArray *args, id userInfo) { //Step implementation code goes here }); And(@"all data cleared", ^void(NSArray *args, id userInfo) { //Step implementation code goes here }); //Optional step, see the comment on this property for more information [Cucumberish instance].fixMissingLastScenario = YES; //This step is important to help Cucumberish locate your feature files correctly when reporting test failures. [Cucumberish instance].testTargetSrcRoot = SRC_ROOT; //Tell Cucumberish the name of your features folder, and which bundle contains this directory. And Cucumberish will handle the rest... //The ClassThatLocatedInTheRootTestTargetFolder could be any class that exist side by side with your Features folder. //So if ClassThatLocatedInTheRootTestTargetFolder exist in the directory YourProject/YourTestTarget //Then in our example your .feature files are expected to be in the directory YourProject/YourTestTarget/Features NSBundle * bundle = [NSBundle bundleForClass:[ClassThatLocatedInTheRootTestTargetFolder class]]; //Finally, let the magic begin! [Cucumberish executeFeaturesInDirectory:@"Features" fromBundle:bundle includeTags:nil excludeTags:nil]; }
-
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.
That's it!