Step implementations are written in your test target's code. In Objective-C, you register steps within the CucumberishInit function before calling -[Cucumberish beginExecution].
Step definitions use regular expressions to match the text in your .feature files. Regex capturing groups are passed into the implementation block via the args array in the order they were captured.
// Inside CucumberishInit
// Simple text match
Given(@"I have a very cool app", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
// Implementation logic here
NSLog(@"\"Given I have a very cool app\" step is implemented");
});
// Regex match with capturing groups
When(@"^I automate it with \"(.*)\"$", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
// args[0] contains the captured group
NSLog(@"I am gonna automate my test cases with %@", args[0]);
});
Then(@"I will be more confident about the quality of the project and its releases", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
NSLog(@"Implemented step for the sake of the example");
});