Skip to content

Commit

Permalink
Merge branch 'master' into 67_steps_in_report
Browse files Browse the repository at this point in the history
  • Loading branch information
TitouanVanBelle committed Jun 23, 2017
2 parents 7dcab66 + e44adf9 commit 2200d36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cucumberish/Cucumberish.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#import "CCIStepsManager.h"
#import "CCIBlockDefinitions.h"

extern NSString * const CCICurrentXCTestCase;

#define CCICurrentSpec [[NSThread mainThread] threadDictionary][CCICurrentXCTestCase]

/**
Cucumberish is the main class you will need to parse your feature files and execute them.
Expand Down
6 changes: 6 additions & 0 deletions Cucumberish/Cucumberish.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
@interface CCIExeption : NSException @end
@implementation CCIExeption @end

NSString * const CCICurrentXCTestCase = @"CCICurrentXCTestCase";

OBJC_EXTERN void executeScenario(XCTestCase * self, SEL _cmd, CCIScenarioDefinition * scenario, CCIFeature * feature);
OBJC_EXTERN void executeSteps(XCTestCase * testCase, NSArray * steps, id parentScenario, NSString * filePathPrefix);
OBJC_EXTERN NSString * stepDefinitionLineForStep(CCIStep * step);
Expand Down Expand Up @@ -578,13 +580,17 @@ void executeScenario(XCTestCase * self, SEL _cmd, CCIScenarioDefinition * scenar
@try {
[[Cucumberish instance] executeBeforeHocksWithScenario:scenario];
if(feature.background != nil && scenario.steps.count > 0){
[[NSThread currentThread] threadDictionary][CCICurrentXCTestCase] = self;
executeSteps(self, feature.background.steps, feature.background, filePathPrefix);
}

[[Cucumberish instance] executeAroundHocksWithScenario:scenario executionBlock:^{
executeSteps(self, scenario.steps, scenario, filePathPrefix);
}];
[[Cucumberish instance] executeAfterHocksWithScenario:scenario];

[[[NSThread currentThread] threadDictionary] removeObjectForKey:CCICurrentXCTestCase];

}
@catch (CCIExeption *exception) {
// This catches assert failures in scenario before/around/after hooks
Expand Down

0 comments on commit 2200d36

Please sign in to comment.