xcfit 2.0.4 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -9
  3. data/Docs/InitialVersion.md +340 -0
  4. data/Package.swift +5 -0
  5. data/README.md +348 -145
  6. data/XCFit.gemspec +1 -1
  7. data/XCFit.podspec +17 -9
  8. data/XCFit/Classes/Cucumberish/Core/CCIBlockDefinitions.h +400 -0
  9. data/XCFit/Classes/Cucumberish/Core/Managers/CCIFeaturesManager.h +72 -0
  10. data/XCFit/Classes/Cucumberish/Core/Managers/CCIFeaturesManager.m +141 -0
  11. data/XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.h +51 -0
  12. data/XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.m +245 -0
  13. data/XCFit/Classes/Cucumberish/Core/Models/CCIArgument.h +62 -0
  14. data/XCFit/Classes/Cucumberish/Core/Models/CCIArgument.m +117 -0
  15. data/XCFit/Classes/Cucumberish/Core/Models/CCIAroundHock.h +37 -0
  16. data/XCFit/Classes/Cucumberish/Core/Models/CCIAroundHock.m +37 -0
  17. data/XCFit/Classes/Cucumberish/Core/Models/CCIBackground.h +46 -0
  18. data/XCFit/Classes/Cucumberish/Core/Models/CCIBackground.m +117 -0
  19. data/XCFit/Classes/Cucumberish/Core/Models/CCIExample.h +89 -0
  20. data/XCFit/Classes/Cucumberish/Core/Models/CCIExample.m +128 -0
  21. data/XCFit/Classes/Cucumberish/Core/Models/CCIFeature.h +49 -0
  22. data/XCFit/Classes/Cucumberish/Core/Models/CCIFeature.m +174 -0
  23. data/XCFit/Classes/Cucumberish/Core/Models/CCIHock.h +36 -0
  24. data/XCFit/Classes/Cucumberish/Core/Models/CCIHock.m +34 -0
  25. data/XCFit/Classes/Cucumberish/Core/Models/CCILocation.h +61 -0
  26. data/XCFit/Classes/Cucumberish/Core/Models/CCILocation.m +91 -0
  27. data/XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.h +97 -0
  28. data/XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.m +224 -0
  29. data/XCFit/Classes/Cucumberish/Core/Models/CCIStep.h +85 -0
  30. data/XCFit/Classes/Cucumberish/Core/Models/CCIStep.m +98 -0
  31. data/XCFit/Classes/Cucumberish/Core/Models/CCIStepDefinition.h +43 -0
  32. data/XCFit/Classes/Cucumberish/Core/Models/CCIStepDefinition.m +65 -0
  33. data/XCFit/Classes/Cucumberish/Cucumberish.h +133 -0
  34. data/XCFit/Classes/Cucumberish/Cucumberish.m +604 -0
  35. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstBuilder.h +15 -0
  36. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstBuilder.m +312 -0
  37. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstNode.h +20 -0
  38. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstNode.m +79 -0
  39. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHBackground.h +12 -0
  40. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHBackground.m +18 -0
  41. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHComment.h +11 -0
  42. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHComment.m +27 -0
  43. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDataTable.h +14 -0
  44. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDataTable.m +30 -0
  45. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDocString.h +14 -0
  46. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDocString.m +29 -0
  47. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHExamples.h +24 -0
  48. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHExamples.m +49 -0
  49. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHFeature.h +24 -0
  50. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHFeature.m +50 -0
  51. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialect.h +25 -0
  52. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialect.m +64 -0
  53. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProvider.h +9 -0
  54. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProvider.m +124 -0
  55. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProviderProtocol.h +10 -0
  56. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageConstants.h +9 -0
  57. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageConstants.m +10 -0
  58. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageSetting.h +17 -0
  59. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageSetting.m +18 -0
  60. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLine.h +12 -0
  61. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLine.m +179 -0
  62. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineProtocol.h +64 -0
  63. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineSpan.h +9 -0
  64. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineSpan.m +26 -0
  65. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasDescriptionProtocol.h +8 -0
  66. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasLocationProtocol.h +8 -0
  67. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasRowsProtocol.h +8 -0
  68. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasStepsProtocol.h +8 -0
  69. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasTagsProtocol.h +8 -0
  70. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHLocation.h +12 -0
  71. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHLocation.m +41 -0
  72. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHNode.h +4 -0
  73. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHNode.m +5 -0
  74. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser+Extensions.h +10 -0
  75. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser+Extensions.m +18 -0
  76. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser.h +132 -0
  77. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser.m +2735 -0
  78. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParserException.h +55 -0
  79. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParserException.m +192 -0
  80. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenario.h +14 -0
  81. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenario.m +18 -0
  82. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition.h +23 -0
  83. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition.m +41 -0
  84. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition_Private.h +6 -0
  85. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioOutline.h +15 -0
  86. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioOutline.m +26 -0
  87. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStep.h +16 -0
  88. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStep.m +35 -0
  89. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStepArgument.h +4 -0
  90. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStepArgument.m +5 -0
  91. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableCell.h +13 -0
  92. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableCell.m +28 -0
  93. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableRow.h +13 -0
  94. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableRow.m +29 -0
  95. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTag.h +13 -0
  96. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTag.m +28 -0
  97. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHToken.h +26 -0
  98. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHToken.m +50 -0
  99. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenMatcher.h +29 -0
  100. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenMatcher.m +283 -0
  101. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenScanner.h +12 -0
  102. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenScanner.m +59 -0
  103. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/NSString+Trim.h +7 -0
  104. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/NSString+Trim.m +28 -0
  105. data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/gherkin-languages.json +2969 -0
  106. data/XCFit/Classes/Cucumberish/Utils/NSArray+Hashes.h +24 -0
  107. data/XCFit/Classes/Cucumberish/Utils/NSArray+Hashes.m +44 -0
  108. data/XCFit/Classes/Cucumberish/Utils/NSObject+Dictionary.h +7 -0
  109. data/XCFit/Classes/Cucumberish/Utils/NSObject+Dictionary.m +83 -0
  110. data/XCFit/Classes/Cucumberish/Utils/NSString+Formatter.h +32 -0
  111. data/XCFit/Classes/Cucumberish/Utils/NSString+Formatter.m +70 -0
  112. data/Xcode7-Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +13 -0
  113. data/Xcode7-Templates/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +11 -0
  114. data/lib/XCFit/version.rb +1 -1
  115. metadata +108 -38
  116. data/XCFit/Assets/.gitkeep +0 -0
  117. data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateIcon.png +0 -0
  118. data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateIcon@2x.png +0 -0
  119. data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateInfo.plist +0 -22
  120. data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/___FILEBASENAME___.feature +0 -20
  121. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/AcceptanceTests-Bridging-Header.h +0 -1
  122. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/FixtureExample.swift +0 -31
  123. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/SlimTables.h +0 -28
  124. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateIcon.png +0 -0
  125. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateIcon@2x.png +0 -0
  126. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateInfo.plist +0 -150
  127. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -1
  128. data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -15
  129. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateIcon.png +0 -0
  130. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateIcon@2x.png +0 -0
  131. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateInfo.plist +0 -123
  132. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -7
  133. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.feature +0 -11
  134. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +0 -14
  135. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -17
  136. data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +0 -23
  137. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon.png +0 -0
  138. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon@2x.png +0 -0
  139. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +0 -123
  140. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -7
  141. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.feature +0 -11
  142. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +0 -14
  143. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -17
  144. data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +0 -25
  145. data/XCFit/Assets/XCFit/Mac Acceptance Tests.xctemplate/Empty.xib +0 -12
  146. data/XCFit/Assets/XCFit/Mac Acceptance Tests.xctemplate/TemplateInfo.plist +0 -54
  147. data/XCFit/Assets/XCFit/MacOS API Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
  148. data/XCFit/Assets/XCFit/MacOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
  149. data/XCFit/Assets/XCFit/iOS API Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
  150. data/XCFit/Assets/XCFit/iOS Acceptance Tests.xctemplate/TemplateInfo.plist +0 -52
  151. data/XCFit/Assets/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
data/XCFit.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{XCFit is a full stack BDD framework in Xcode for iOS and macOS apps with Swift using Cucumberish and Fitnesse. Native Xcode implementation, No Appium, No Calabash, No Ruby or any other non iOS language. Checkout XCFIT POD}
14
14
  spec.homepage = "https://github.com/Shashikant86/XCFit"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|XCFitDemo|XCFitnesse|spec|features|_Pods.xcodeproj)/}) }
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|XCFit2Demo|XCFitnesse|spec|features|_Pods.xcodeproj|Sources|Tests|XCFit.xcodeproj)/}) }
17
17
  spec.files.reject! { |fn| fn.include? "_Pods.xcodeproj" }
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
data/XCFit.podspec CHANGED
@@ -11,16 +11,24 @@ XCFit is a full stack BDD framework for iOS and macOS apps with Swift using Cucu
11
11
  # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
12
12
  s.license = { :type => 'MIT', :file => 'LICENSE' }
13
13
  s.author = { 'Shashikant86' => 'shashikant.jagtap@icloud.com' }
14
- s.source = { :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '0.1.0' }
14
+ s.source = { :git => 'https://github.com/Shashikant86/XCFit.git', :tag => "#{s.version}"}
15
15
 
16
16
  s.social_media_url = 'https://twitter.com/Shashikant86'
17
17
 
18
- s.ios.deployment_target = '8.0'
19
-
20
- s.source_files = 'XCFit/Classes/**/*'
21
-
22
-
23
- # s.public_header_files = 'Pod/Classes/**/*.h'
24
- # s.frameworks = 'UIKit', 'MapKit'
25
- s.dependency 'OCSlimProject'
18
+ s.ios.deployment_target = '9.0'
19
+ s.source_files = 'XCFit/Classes/Cucumberish/*.{h,m}', 'XCFit/Classes/Cucumberish/Core/Managers/*.{h,m}', 'XCFit/Classes/Cucumberish/Core/Models/*.{h,m}', 'XCFit/Classes/Cucumberish/Utils/*.{h,m}', 'XCFit/Classes/Cucumberish/Dependencies/Gherkin', 'XCFit/Classes/Cucumberish/Core/CCIBlockDefinitions.h'
20
+ s.public_header_files =
21
+ 'XCFit/Classes/Cucumberish/Cucumberish.h',
22
+ 'XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.h',
23
+ 'XCFit/Classes/Cucumberish/Core/CCIBlockDefinitions.h',
24
+ 'XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.h',
25
+ 'XCFit/Classes/Cucumberish/Core/Models/CCIExample.h',
26
+ 'XCFit/Classes/Cucumberish/Core/Models/CCIStep.h',
27
+ 'XCFit/Classes/Cucumberish/Core/Models/CCILocation.h',
28
+ 'XCFit/Classes/Cucumberish/Core/Models/CCIArgument.h'
29
+ s.resource_bundles = {
30
+ 'GherkinLanguages' => ['XCFit/Classes/Cucumberish/Dependencies/Gherkin/gherkin-languages.json'],
31
+ }
32
+ s.framework = "XCTest"
33
+ s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "SRC_ROOT=@\\\"$(SRCROOT)\\\"" }
26
34
  end
@@ -0,0 +1,400 @@
1
+ //
2
+ // CCIBlockDefinitions.h
3
+ // Pods
4
+ //
5
+ // Created by Ahmed Ali on 23/01/16.
6
+ //
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ @class CCIScenarioDefinition;
11
+
12
+ extern const NSString * kDataTableKey;
13
+ extern const NSString * kDocStringKey;
14
+ extern const NSString * kXCTestCaseKey;
15
+
16
+ #pragma mark - Block types
17
+ /**
18
+ You pass this block when ever you define an implementation for a step.
19
+
20
+ @param args strings array which corresponds to your regular express capturing groups.
21
+ @param userInfo is a dictionary that currently can have one of two keys kDataTableKey or kDocStringKey. If your step definition is expected to match a data table or a doc string, then you can expect this user info dictionary to contain kDataTableKey or kDocStringKey key respectively. Moreover, it will contain the key kXCTestCaseKey which will hold reference to the XCTestCase that currently executing this step. The value of kXCTestCaseKey will be nil if the step is being executed by a call of "step" or "SStep" C functions and you did not pass a reference to the XCTestCase.
22
+ */
23
+ typedef void(^CCIStepBody)(NSArray <NSString *>* args, NSDictionary * userInfo);
24
+
25
+ /**
26
+ This block is passed to all the hocks (except around hock).
27
+ @param scenario the scenario the current scenario
28
+ */
29
+ typedef void (^CCIScenarioHockBlock)(CCIScenarioDefinition * scenario);
30
+
31
+ /**
32
+ This block is passed to around hocks.
33
+ @param scenario the scenario the current scenario.
34
+ @param scenarioExectionBlock the block that will execute the scenario. If you did not call it, the scenario will never bee executed.
35
+ */
36
+ typedef void (^CCIScenarioExecutionHockBlock)(CCIScenarioDefinition * scenario, void (^scenarioExectionBlock)(void) );
37
+
38
+
39
+ #pragma mark - Step definitions and prepositions
40
+
41
+ @class CCIStep;
42
+ @class CCIStepDefinition;
43
+
44
+ /**
45
+ Defines a Given implementations.
46
+
47
+ @code
48
+ Given(@"the app is running" , ^void(NSArray *args, id userInfo) {
49
+ //Your step implementation goes here
50
+ //The definition string in this case will match only the following step
51
+ //Given the app is running
52
+ });
53
+ @endcode
54
+
55
+ @Note
56
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
57
+
58
+ @param definitionString the regular expression that will checked against each Given step line.
59
+ @param body the code block that will be executed if match is occured.
60
+ */
61
+ OBJC_EXTERN void Given(NSString * definitionString, CCIStepBody body);
62
+
63
+ /**
64
+ Defines a When step implementations.
65
+
66
+ @b Example:
67
+ @code
68
+ When(@"^I tap (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
69
+ //Step implementation goes here
70
+ //The definition string in this case can match all the following steps
71
+ //When I tap the "MyButton" button
72
+ //When I tap "MyButton" button
73
+ //When I tap "Header" view
74
+ //When I tap "FAQ" label
75
+ });
76
+ @endcode
77
+
78
+ @Note
79
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
80
+
81
+ @param definitionString the regular expression that will checked against each Given step line.
82
+ @param body the code block that will be executed if match is occured.
83
+ */
84
+ OBJC_EXTERN void When(NSString * definitionString, CCIStepBody body);
85
+
86
+ /**
87
+ Defines a Then step implementations.
88
+
89
+ @b Example:
90
+ @code
91
+ Then(@"^I should see \"([^\\\"]*)\" in (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
92
+ //Step implementation goes here
93
+ //The definition string in this case can match all the following steps
94
+ //Then I should see "Button Title" in "MyButton" button
95
+ //Then I should see "Button Title" in the "MyButton" Button
96
+ //Then I should see "The Screen Title" in "Header" view
97
+ //Then I should see "FAQ" in "FAQ" label
98
+ });
99
+ @endcode
100
+
101
+ @Note
102
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
103
+
104
+ @param definitionString the regular expression that will checked against each Given step line.
105
+ @param body the code block that will be executed if match is occured.
106
+ */
107
+ OBJC_EXTERN void Then(NSString * definitionString, CCIStepBody body);
108
+
109
+ /**
110
+ Defines an And step implementations.
111
+
112
+ @b Example:
113
+ @code
114
+ And(@"^I should see \"([^\\\"]*)\" in (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
115
+ //Step implementation goes here
116
+ //The definition string in this case can match all the following steps
117
+ //And I should see "Button Title" in "MyButton" button
118
+ //And I should see "Button Title" in the "MyButton" Button
119
+ //And I should see "The Screen Title" in "Header" view
120
+ //And I should see "FAQ" in "FAQ" label
121
+ });
122
+ @endcode
123
+
124
+ @Note
125
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
126
+
127
+ @param definitionString the regular expression that will checked against each Given step line.
128
+ @param body the code block that will be executed if match is occured.
129
+ */
130
+ OBJC_EXTERN void And(NSString * definitionString, CCIStepBody body);
131
+
132
+ /**
133
+ Defines a But step implementations.
134
+
135
+ @code
136
+ But(@"^I should see \"([^\\\"]*)\" in (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
137
+ //Step implementation goes here
138
+ //The definition string in this case can match all the following steps
139
+ //But I should see "Button Title" in "MyButton" button
140
+ //But I should see "Button Title" in the "MyButton" Button
141
+ //But I should see "The Screen Title" in "Header" view
142
+ //But I should see "FAQ" in "FAQ" label
143
+ });
144
+ @endcode
145
+
146
+ @Note
147
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
148
+
149
+ @param definitionString the regular expression that will checked against each Given step line.
150
+ @param body the code block that will be executed if match is occured.
151
+ */
152
+ OBJC_EXTERN void But(NSString * definitionString, CCIStepBody body);
153
+
154
+ /**
155
+ Defines a step implementations that will be registered with When, Then, And, and But.
156
+ The implementation of this function simply calls:
157
+ @code
158
+ When(definitionString, body);
159
+ Then(definitionString, body);
160
+ And(definitionString, body);
161
+ But(definitionString, body);
162
+ @endcode
163
+ Which concluds that the registered definitions will be checked with any of these four prepositions.
164
+
165
+ @b Example:
166
+ @code
167
+ MatchAll(@"^I should see \"([^\\\"]*)\" in (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
168
+ //Step implementation goes here
169
+ //The definition string in this case can match all the following steps
170
+ //When I should see "Button Title" in "MyButton" button
171
+ //Then I should see "Button Title" in "MyButton" button
172
+ //And I should see "Button Title" in "MyButton" button
173
+ //But I should see "Button Title" in "MyButton" button
174
+ });
175
+ @endcode
176
+
177
+ @Note
178
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
179
+
180
+ @param definitionString the regular expression that will checked against each Given step line.
181
+ @param body the code block that will be executed if match is occured.
182
+ */
183
+ OBJC_EXTERN void MatchAll(NSString * definitionString, CCIStepBody body);
184
+
185
+ /**
186
+ Defines a step implementations that will be registered with specified prepositions.
187
+
188
+ @b Example:
189
+ @code
190
+ Match(@[@"When", @"And", @"Then"], @"^I should see \"([^\\\"]*)\" in (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
191
+ //Step implementation goes here
192
+ //The definition string in this case can match all the following steps
193
+ //When I should see "Button Title" in "MyButton" button
194
+ //And I should see "Button Title" in "MyButton" button
195
+ //Then I should see "Button Title" in "MyButton" button
196
+ });
197
+ @endcode
198
+
199
+ @Note
200
+ Step definitions are checked in a "Last In First Out" order. If it happens that there are more than one definition matches a step, the last registered definition will be used.
201
+
202
+ @param prepositions array of strings to be used as the preposition of the step definiton
203
+ @param definitionString the regular expression that will checked against each Given step line.
204
+ @param body the code block that will be executed if match is occured.
205
+ */
206
+ OBJC_EXTERN void Match(NSArray *prepositions, NSString * definitionString, CCIStepBody body);
207
+
208
+ /**
209
+ Step implementation can be also a useable code.
210
+ If it the case that you want to call a previously defined step implementation, you can call this definition using this special step function.
211
+
212
+ @Note
213
+ Using this function, you do not need to worry about the preposition of the step; you just pass in the step line without defining the preposition.
214
+
215
+ @b Example:
216
+ @code
217
+ //The first step definiton
218
+ Match(@[@"When", @"And", @"Then"], @"^I should see \"([^\\\"]*)\" in (?:the )?\"([^\\\"]*)\" (?:button|view|label)$" , ^void(NSArray *args, id userInfo) {
219
+ //Step implementation goes here
220
+ });
221
+
222
+ //The another step definiton that will make use of the previousely defined step
223
+ When(@"^I write \"([^\\\"]*)\" (?:in|into) \"([^\\\"]*)\" field$" , ^void(NSArray *args, id userInfo) {
224
+ //Step implementation goes here
225
+ //Here you can call the previously defined step.
226
+ step(@"I should see \"%@\" in the \"%@\" label", args[0], args[1]);
227
+ });
228
+ @endcode
229
+
230
+ @param testCase the test case that will execute this step. Can be nil.
231
+ @param stepLine the step line string to be executed
232
+ */
233
+ OBJC_EXPORT void step(id testCase, NSString * stepLine, ...);
234
+
235
+ /**
236
+ Swift alias for step(stepLine) function.
237
+ @param testCase the test case that will execute this step. Can be nil.
238
+ @param stepLine the step line string to be executed
239
+ */
240
+ OBJC_EXTERN void SStep(id testCase, NSString * stepLine);
241
+
242
+
243
+ #pragma mark - Hocks
244
+ /**
245
+ C function that registers a code block to be called only once before executing any test case.
246
+ You can call this function as much as you want, but only the last registerd code block will be used.
247
+
248
+ @Note
249
+ This function should not be called after calling @a beginExecution.
250
+
251
+ @param beforeStartBlock code block that will be executed once before any test cases.
252
+ */
253
+ OBJC_EXTERN void beforeStart(void(^beforeStartBlock)(void));
254
+
255
+
256
+ /**
257
+ C function that registers a code block to be called only once after executing all test cases.
258
+ You can call this function as much as you want, but only the last registerd code block will be used.
259
+
260
+ @Note
261
+ This function should not be called after calling @a beginExecution.
262
+
263
+ @param afterFinishBlock code block that will be executed once after all test cases finish execution.
264
+ */
265
+ OBJC_EXTERN void afterFinish(void(^afterFinishBlock)(void));
266
+
267
+
268
+ /**
269
+ C function that registers a code block to be called before each scenario.
270
+ Code blocks registerd with this function will run before each scenario in the same order they were orignally registered; that's it, FIFO (First In First Out).
271
+
272
+ @Note
273
+ This function should not be called after calling @a beginExecution.
274
+
275
+ @param beforeEachBlock code block that will be executed before executing the scenario, this block receives an instance of the scenario that will be executed.
276
+ */
277
+ OBJC_EXTERN void before(CCIScenarioHockBlock beforeEachBlock);
278
+
279
+
280
+ /**
281
+ C function that registers a code block to be called after each scenario.
282
+ Code blocks registerd with this function will run after each scenario in reversed order compared to the order they were orignally registered; that's it, LIFO (Last In First Out)
283
+
284
+ @Note
285
+ All code blocks registerd with this function, will run regardless the scenario has been passed or not
286
+
287
+ @Note
288
+ This function should not be called after calling @a beginExecution.
289
+
290
+ @param afterEachBlock code block that will be executed after executing the scenario, this block receives an instance of the scenario that has been executed.
291
+ */
292
+ OBJC_EXTERN void after(CCIScenarioHockBlock afterEachBlock);
293
+
294
+
295
+ /**
296
+ C function that registers a code block to be called before each scenario that has one or more tag that matches one or more tags passed to this function.
297
+ Code blocks registerd with this function will run before each matching scenario in the same order they were orignally registered; that's it, FIFO (First In First Out)
298
+
299
+ @Note
300
+ Do not prefix any tag you pass with @ symbol
301
+
302
+ @Note
303
+ This function should not be called after calling @a beginExecution.
304
+
305
+ @param tags array of strings that will be used to match specific scenarios
306
+ @param beforeTaggedBlock code block that will be executed before executing the scenario, this block receives an instance of the scenario that will be executed.
307
+ */
308
+ OBJC_EXTERN void beforeTagged(NSArray * tags, CCIScenarioHockBlock beforeTaggedBlock);
309
+
310
+
311
+ /**
312
+ C function that registers a code block to be called after each scenario that has one or more tag that matches one or more tags passed to this function.
313
+ Code blocks registerd with this function will run after each matching scenario in reversed order compared to the order they were orignally registered; that's it, LIFO (Last In First Out)
314
+
315
+ @Note
316
+ This function should not be called after calling @a beginExecution.
317
+
318
+ @Note
319
+ All code blocks registerd with this function, will run regardless the matching scenario has been passed or not
320
+
321
+ @Note
322
+ Do not prefix any tag you pass with @ symbol
323
+
324
+ @param tags array of strings that will be used to match specific scenarios
325
+ @param afterTaggedBlock code block that will be executed after executing the scenario, this block receives an instance of the scenario that has been executed.
326
+ */
327
+ OBJC_EXTERN void afterTagged(NSArray * tags, CCIScenarioHockBlock afterTaggedBlock);
328
+
329
+
330
+ /**
331
+ C function that registers a code block to be used to call the scenario execution block.
332
+ Code blocks registerd with this function will receive two parameters: scenario instance and scenario execution block as a parameter.
333
+
334
+ If more than one code block matches the scenario, you are still required to call the scenario execution from each registered code block. However, your scenario will be executed once as it is supposed to be.
335
+
336
+ Matching against around blocks happens in FIFO (First In First Out) order; in case more than one block has matched the same scenario, then they are nested.
337
+
338
+ @Note
339
+ Failing to call the scenario execution block, will prevent the scenario from being executed.
340
+
341
+ @b Example of more than one match
342
+
343
+ There are three registerd blocks with tags that matches the same scenario, the followin nesting calls will happen:
344
+
345
+ @code
346
+ Third Around Match
347
+ Block = contains code block that executes the Second Around Match
348
+ Second Around Match
349
+ Block = contains code block that executes the First Around Match
350
+ First Around Match
351
+ Block = A call Scenario Exection Block@endcode
352
+
353
+
354
+ @Note
355
+ Do not prefix any tag you pass with @@ symbol
356
+
357
+ @Note
358
+ This function should not be called after calling @a beginExecution.
359
+
360
+
361
+ @param tags array of strings that will be used to match specific scenarios
362
+ @param aroundScenarioBlock code block that will be executed for each scneario, this block receives an instance of the scenario and the scenario execution block.
363
+ */
364
+ OBJC_EXTERN void around(NSArray * tags, CCIScenarioExecutionHockBlock aroundScenarioBlock);
365
+
366
+ #pragma mark - Assertion and Errors
367
+ /**
368
+ Boolean assertion function. Use it where you usually use NSAssert or assert.
369
+
370
+ Using this assertion function in your step implementations, guarantees proper error reporting
371
+
372
+ @param expression boolean expression
373
+ @param failureMessage formatted a string describe what went wrong in case expression is evaluated to false
374
+ */
375
+ OBJC_EXTERN void CCIAssert(BOOL expression, NSString * failureMessage, ...);
376
+
377
+ /**
378
+ Swift alias for CCIAssert
379
+ @param expression boolean expression
380
+ @param failureMessage a string describe what went wrong in case expression is evaluated to false
381
+ */
382
+ OBJC_EXTERN void CCISAssert(BOOL expression, NSString * failureMessage);
383
+
384
+
385
+ /**
386
+ Throws an exception with the specified reason.
387
+ Cucumberish will handle this exception and show it as an issue with executing the current step
388
+
389
+ @param reason the failure reason
390
+ */
391
+
392
+ OBJC_EXTERN void throwCucumberishException(NSString *reason, ...);
393
+
394
+
395
+ /**
396
+ Swift alias for throwCucumberishException;
397
+ @param reason the failure reason
398
+ */
399
+ OBJC_EXTERN void SThrowCucumberishException(NSString *reason);
400
+
@@ -0,0 +1,72 @@
1
+ //
2
+ // CCIFeaturesManager.h
3
+
4
+ //
5
+ // Created by Ahmed Ali on 02/01/16.
6
+ // Copyright © 2016 Ahmed Ali. All rights reserved.
7
+ //
8
+ //
9
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ // of this software and associated documentation files (the "Software"), to deal
11
+ // in the Software without restriction, including without limitation the rights
12
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ // copies of the Software, and to permit persons to whom the Software is
14
+ // furnished to do so, subject to the following conditions:
15
+ //
16
+ // The above copyright notice and this permission notice shall be included in
17
+ // all copies or substantial portions of the Software.
18
+ //
19
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ // THE SOFTWARE.
26
+
27
+ #import <Foundation/Foundation.h>
28
+ @class CCIFeature;
29
+
30
+ /**
31
+ CCIFeaturesManager is a singleton class and its main purpose is to parse feature files and map them to their associated Classes.
32
+ This class is utilized by Cucumberish main class. Useually you do not need to deal with it manually.
33
+ */
34
+ @interface CCIFeaturesManager : NSObject
35
+
36
+ /**
37
+ After calling parseFeatureFiles:withTags: this array will contain all the parsed features.
38
+ */
39
+ @property (nonatomic, readonly) NSArray<CCIFeature *> * features;
40
+
41
+ /**
42
+ Returns the singleton class of CCIFeaturesManager
43
+ */
44
+ + (instancetype)instance;
45
+
46
+ /**
47
+ Parses the feature files that matches one or more of the passed tags if any.
48
+
49
+ @Note tags should not be prefixed with @@ symbole
50
+
51
+ @param featureFiles array of NSURL that presents the feature file paths
52
+ @param tags array of strings to filter which the features that will be parsed to be executed, if nil then all feature files will be parsed.
53
+ @param tags array of string to filter which features should not be executed.
54
+
55
+ @Note tags in featureTags parameter should not exist in the execludedTags parameter as it doesn't make any sense.
56
+ */
57
+ - (void)parseFeatureFiles:(NSArray *)featureFiles bundle:(NSBundle *)bundle withTags:(NSArray *)tags execludeFeaturesWithTags:(NSArray *)execludedFeatures;
58
+
59
+ /**
60
+ Associates the passed class with the passed feature instance for later usage.
61
+ It is mainly used to eliminate the need create a class for a feature multiple times.
62
+ @param class
63
+ @param feature
64
+ */
65
+ - (void)setClass:(Class)klass forFeature:(CCIFeature *)feature;
66
+
67
+ /**
68
+ Returns the passed class that is associated with the passed feature.
69
+ @param class
70
+ */
71
+ - (CCIFeature *)getFeatureForClass:(Class)klass;
72
+ @end