xcfit 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md +12 -0
  4. data/Pre-Defined_Steps/XCFit_Predefined_Steps.md +49 -0
  5. data/README.md +53 -31
  6. data/XCFit.podspec +1 -1
  7. data/XCFit4Demo/Cartfile +1 -0
  8. data/XCFit4Demo/Cartfile.resolved +2 -0
  9. data/XCFit4Demo/XCFit4Demo.xcodeproj/project.pbxproj +864 -0
  10. data/XCFit4Demo/XCFit4Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  11. data/XCFit4Demo/XCFit4Demo/AppDelegate.swift +46 -0
  12. data/XCFit4Demo/XCFit4Demo/Assets.xcassets/AppIcon.appiconset/Contents.json +38 -0
  13. data/XCFit4Demo/XCFit4Demo/Base.lproj/LaunchScreen.storyboard +27 -0
  14. data/XCFit4Demo/XCFit4Demo/Base.lproj/Main.storyboard +53 -0
  15. data/XCFit4Demo/XCFit4Demo/Info.plist +38 -0
  16. data/XCFit4Demo/XCFit4Demo/ViewController.swift +33 -0
  17. data/XCFit4Demo/XCFit4DemoCucumberTests/BaseScreen.swift +21 -0
  18. data/XCFit4Demo/XCFit4DemoCucumberTests/CommonStepDefinitions.swift +89 -0
  19. data/XCFit4Demo/XCFit4DemoCucumberTests/Extensions.swift +57 -0
  20. data/XCFit4Demo/XCFit4DemoCucumberTests/Features/demo.feature +8 -0
  21. data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreen.swift +24 -0
  22. data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreenSteps.swift +29 -0
  23. data/XCFit4Demo/XCFit4DemoCucumberTests/Hooks.swift +27 -0
  24. data/XCFit4Demo/XCFit4DemoCucumberTests/Info.plist +22 -0
  25. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests-Bridging-Header.h +17 -0
  26. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.h +22 -0
  27. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.m +27 -0
  28. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.swift +39 -0
  29. data/XCFit4Demo/XCFit4DemoTests/Info.plist +22 -0
  30. data/XCFit4Demo/XCFit4DemoTests/XCFit4DemoTests.swift +36 -0
  31. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Extensions.swift +60 -0
  32. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreen.swift +23 -0
  33. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreenTest.swift +28 -0
  34. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Info.plist +22 -0
  35. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/XCFit4DemoXCUIPoMTestsTestBase.swift +36 -0
  36. data/homebrew/xcfit +1 -1
  37. data/lib/XCFit/version.rb +1 -1
  38. metadata +33 -6
  39. data/Docs/InitialVersion.md +0 -340
  40. data/Docs/README_XCFit2.md +0 -572
  41. data/Docs/Xcode7.md +0 -273
  42. data/Docs/xcdoe7swift2.md +0 -311
data/Docs/Xcode7.md DELETED
@@ -1,273 +0,0 @@
1
-
2
-
3
- #XCFit : Xcode 7 V
4
- ## XCFit - 'Swift' Your iOS/macOS apps towards BDD
5
-
6
- ####XCFit a.k.a ([XCUI](https://developer.apple.com/videos/play/wwdc2015/406/0), [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) and [Fitnesse](https://github.com/paulstringer/OCSlimProject) Integrations Tests) is a full stack Xcode BDD framework for [Swift](https://swift.org) iOS and macOS apps. XCFit allows us to write API, UI and Acceptance Tests with Swift in human readable language using tools like [Cucumber](https://cucumber.io/) and [Fitnesse](http://fitnesse.org/) in Xcode. We can still use Apple's brand new UI Testing framework (XCUI) under the hood of Cucumberish. XCFit is fully automated solution for Cucumberish and Fitnesse. You can use 80(Fitnesse):20(Cucumberish) formula to automate Acceptance and UI Testing for better coverage and faster feedback. XCFit is available on [RubyGem](https://rubygems.org/gems/xcfit) and [CocoaPods](http://cocoadocs.org/docsets/XCFit).
7
-
8
-
9
- ### Quick Demo with Example App
10
-
11
- You can clone the existing repo which has a demo app. To get started..Watch this animated GIF for the steps below.
12
-
13
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Quick_Demo.gif)
14
-
15
- ```
16
- $ git clone https://github.com/Shashikant86/XCFit
17
- $ cd XCFit/XCFitDemo
18
- $ open XCFitDemo.xcworkspace
19
- ```
20
- Run Unit, UI and Cucumberish test with Xcode. "cmd + U". Edit Scheme if nessesary to avoid running Unit Tests for this demo. Or Run nit from command line. Update Simulator device/OS version as installed in your Xcode if nessessary
21
-
22
- ```
23
- $ xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3' test | xcpretty -r html -r junit --test --color
24
- ```
25
- Watch out HTML and JUnit reports generated in the 'Build/reports/' directory with XCPretty. Install XCpretty if you havent got already.
26
-
27
- Running Fitnesse Tests: Clean, Build and Execute
28
-
29
- ```
30
- $ xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitAcceptanceTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3' clean build | xcpretty
31
-
32
- $java -jar fitnesse-standalone.jar -v -o -c "FrontPage?suite&format=junit"
33
-
34
- ```
35
-
36
- ###### Using Fastlane
37
-
38
- Assuming you have Bundler rubygem installed if not install it by "gem install bundler"
39
-
40
- ```
41
- $ bundle install
42
- $ bundle exec fastlane cucumberish
43
- $ bundle exec fastlane fitnesse
44
- ```
45
-
46
-
47
- Curently XCFitDemo App is configured on TravisCI which runs both Cucumberish and Fitnesse Tests. The sample .travis.yml is in the Github repo and sample logs from TravisCI [here](https://travis-ci.org/Shashikant86/XCFit/builds/145963673).
48
-
49
-
50
- Big Thanks to
51
- - [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) : Provide native [Gherkin](https://github.com/cucumber/cucumber/wiki/Gherkin) parser for iOS Apps to enable BDD in Xcode using Given When Then. Yay!
52
- - [OCSlimProject](https://github.com/paulstringer/OCSlimProject) : Provide Xcode Templates to enable BDD with Decision Tables using Fitnesse
53
-
54
- XCFit automated configuration of these two guys.
55
-
56
- ### Version
57
- CocoaPods -- [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit) : 0.1.0
58
-
59
- RubyGems -- [xcfit-RubyGem](https://rubygems.org/gems/xcfit) : 0.8.0
60
-
61
- ### Tech & Software Requirements
62
-
63
- XCFit uses a number of open source projects to work properly. You need to have following
64
-
65
- Hardware : You must have Mac Operating System with OSX/MacOS version > 10.9
66
-
67
- Software:
68
- * [Ruby](https://www.ruby-lang.org/en/) - Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X
69
- * [Xcode](https://developer.apple.com/xcode/) - Ideally Xcode 7.X
70
- * [RubyGems](https://rubygems.org/) - RubyGem with [Cocoapods](https://cocoapods.org/) installed
71
- * [Curl on Mac](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/curl.1.html) - Might be pre-installed but worth double checking.
72
- * Ruby Packages : Xcpretty, Fastlane(Optional), Rake, Bundler.. Install with 'gem install <package_name>'
73
-
74
-
75
- ### Installation
76
-
77
- XCFit requires [RubyGems](https://rubygems.org/) to run.
78
-
79
- You need Gulp installed globally:
80
-
81
-
82
- $ gem install xcfit
83
-
84
- Now you are good to get started with XCFit for now. Later we also need to install XCFit Pod.
85
-
86
- # Usage
87
- Now that you can execute 'xcfit' command from your terminal/iTerm etc etc. Example Output Looks like this :
88
-
89
- ```
90
- $ xcfit
91
- Tasks:
92
- xcfit get_cucumberish VERSION # Downloads Cucumberish version and Create Features directory. You must execute this from Cucumberish Xcode Target directory
93
- xcfit get_fitnesse # Download Fitnesse JAR file from Internet. You must execute this from Xcode Fitnesse Acceptance Test Xcode Target directory
94
- xcfit help [TASK] # Describe available tasks or one specific task
95
- xcfit set_xcode_templates # Generate All Xcode Templates for the Gherkin Feature Files & targets for Cucumberish and Fitnesse
96
- xcfit version # Get the current version number
97
-
98
- ```
99
-
100
- ## Setup Xcode Templates
101
-
102
- In existing app or brand new app, we have to enable the Xcode templates for files and targets to speed up the things. Run following command from your termonal
103
-
104
-
105
- ```sh
106
- $ xcfit set_xcode_templates
107
-
108
- ```
109
-
110
- - This will add couple of templates to your Xcode for iOS and macOS apps. In your app if you go to 'File--->New--->Target'
111
-
112
- You will see new option for iOS and OSX i.e 'XCFit'. Once Clicked on it. You will see Cucumberish API, Cucumberish UI and Fitnesse Acceptance Tests targets. As shown
113
-
114
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/new_targets.png)
115
-
116
-
117
-
118
- - Once Clicked on the target e.g 'Cucumberish UI Test Bundle' Xcode will create UI testing target with all the required files with Bridging hrader for Cucumberish UI Testing.
119
- Once Clicked on the target e.g 'Fitnesse Acceptance Test Bundle' Xcode will create UI tAcceptance test with all the required files with Bridging headers for the Fitnesse Acceptance Test. We will see that in details soon.
120
-
121
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFit_Setup.gif)
122
- You can watch YouTube video of XCFit setup [here](https://www.youtube.com/watch?v=Q3cKinwYwhE)
123
-
124
- - This script also set new file type in Xcode to create new Gherking feature file
125
-
126
- ## Setting up Cucumberish UI Target
127
-
128
- 3 Steps to setup Cucumberish. You don't need to use Cocoapods to setup this target.
129
-
130
-
131
- - Add new target iOS/macOS project and Select "File -> New -> Target -> XCFit -> Cucumberish UI Test Bundle". Give it a name you like e.g CucumberishUITests
132
-
133
- Now that Xcode has created brand new target with all required Swift and Objective-C files to run Cucumberish. All Xcode setting has been done by the Xcode Template. Don't worry about configuting anything.
134
-
135
-
136
- - Now that you have to CD into the Cucumberish target directory .eg CucumberishUITests
137
-
138
- ```sh
139
- $ cd $CUCUMBERISH_TARGET_DIR
140
- $ xcfit get_cucumberish 0.0.7
141
- ```
142
- This will download Cucumberish directory from version 0.0.7 and also creats 'Features' directory. You can then reference those directory in Xcode. For "Cucumberish" directory select 'Copy if needed and Create Group' and for the "Features" directory select don't create group or Copy if needed. Just " create folder reference"
143
- Now Add sample Feature File to 'Features' directory either by File->New->Gherkin Or Just add it using your favourite text editor e.g demo.feature with content
144
-
145
- ```
146
- Feature: Demo App Feature
147
-
148
- Scenario: Demo Scenario
149
-
150
- Given the app is running
151
-
152
- ```
153
-
154
- - Finally from the Cucumberish target 'General' setting select 'Testing -> Target To Test' and configure scheme to add Cucumeerish UI target to Test
155
-
156
- You are done !!
157
-
158
- You can watch YouTube video of Cucumberish Setup [here](https://www.youtube.com/watch?v=Wd9myhNkpx4)
159
-
160
- You can add more feature/Scenarios and implement steps definitions inside your Swift File. [Ahmed-Ali](https://github.com/Ahmed-Ali) creator of Cucumberish already implemented useful pre-defined steps have a look at this [Swift file](https://github.com/Ahmed-Ali/Cucumberish/blob/master/CucumberishExample/CucumberishExampleUITests/CCIStepDefinitions.swift). You are free to try Page Object Pattern and all other crazy stuff to abstract and refactor your Swift code.
161
-
162
-
163
-
164
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/CucumberishDemo.gif)
165
-
166
- ## Setting up Fitnesse Acceptance Target
167
-
168
- You can also setup Fitnesse Acceptance Tests but you need to use Cocoapod for this target.
169
-
170
- Basically Steps are pretty much same mentioned in the [OCSlimProject](http://paulstringer.github.io/OCSlimProject/) but most of them are automated for simplicity. Here is simple way to set Fitnesse Acceptance tests for iOS/MacOS Apps
171
-
172
-
173
-
174
- - Create new target, "File --> New --> Target --> XCFit --> Fitnesse Acceptance Test". Give it a suitable name e.g 'AcceptanceTests'
175
-
176
- - Create/Update Podfile with
177
-
178
-
179
- ```ruby
180
-
181
- use_frameworks!
182
-
183
- target 'AcceptanceTests' do
184
- pod 'XCFit'
185
- end
186
- ```
187
-
188
- Run 'Pod install' and build newly created Acceptance target from Xcode. You should see 'LaunchFitnesse' Script geerated and Your app should be talking to fitnesse now.
189
-
190
- - Now CD into FITNESSE_TARGET directory and Get Fitnesse JAR file by running
191
-
192
- ```sh
193
- $ cd $FITNESSE_TARGET
194
- $ xcfit get_fitnesse
195
- ```
196
-
197
- You should have fitnesse-standalone file downloaded in the target directory. You can now execute 'LaunchFitnesse'
198
-
199
- ```sh
200
- $ ./LaunchFitnesse
201
- ```
202
-
203
- Now you should have Fitnesse up and runnig. Follow Paul's article for the details on how to write acceptance tests [here](http://stringerstheory.net/acceptance-testing-with-ios/)
204
-
205
- You can watch YouTube video of XCFit Fitnesse [here](https://www.youtube.com/watch?v=Wd9myhNkpx4)
206
-
207
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/AcceptanceTests.gif)
208
-
209
- ## Continous Integration & Test Reporting
210
-
211
- Continous Integration is very important and you simply can't avoid that. XCFit will be easily configured on any CI server including Apple's own [Xcode Server](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/) or very polular one [Jenkins](https://jenkins.io/) as we can generate reports in both HTML and JUnit format.
212
- As of now, you might be running tests within Xcode, but there are some awsome tools which allows us to run our tests from command line. The 'xcodebuild' is being used to build and test Xcode Schemes. [Fastlane](https://github.com/fastlane/fastlane) seems much easier option to automate everything but it's upto you. These are long commands but you k ow better how to Script it Or Fastlane it, right ? :)
213
-
214
- Curently XCFitDemo App is configured on TravisCI which runs both Cucumberish and Fitnesse Tests. The sample .travis.yml is in the Github repo and sample logs from TravisCI [here](https://travis-ci.org/Shashikant86/XCFit/builds/145963673). Watch out Live Execution :
215
-
216
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Travis_XCFit.gif)
217
-
218
- ### Cucumberish
219
-
220
- You can execute Cucumberish tests with like this for XCFitDemo App.
221
-
222
- [XCPretty](https://github.com/supermarin/xcpretty) can be used to generate JUnit Or HTML report as below
223
-
224
-
225
- ```sh
226
- xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' test | xcpretty -r html -r junit --test --color
227
- ```
228
-
229
- You can now analyse the reports generated in the 'build/reports' directory. You will find both HTML and JUnit reports. You can configure these reports with Xcode-Server, Jenkins, TeamCity easily in the post build setting.
230
-
231
- ```
232
- $ open build/reports/tests.html
233
- ```
234
-
235
-
236
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/html_reports.png)
237
-
238
- ### Fitnesse
239
-
240
- You can first build the Acceptance target
241
-
242
- ```sh
243
- $ xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitAcceptanceTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' clean build | xcpretty
244
- ```
245
-
246
- Now run the Fitnesse tests using
247
-
248
- ```sh
249
-
250
- $ java -jar fitnesse-standalone.jar -v -o -c "FrontPage?suite"
251
- ```
252
- You can also set reports directory and generate Junit style reports inside the "XCFitDemo/FitNesseRoot/files/testResults/" directory. You can configure these reports with Xcode-Server, Jenkins, TeamCity easily in the post build setting.
253
-
254
-
255
-
256
-
257
-
258
-
259
- # Video Demo
260
-
261
- ### XCFit Xcode Setup
262
-
263
- [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/Q3cKinwYwhE/0.jpg)](http://www.youtube.com/watch?v=Q3cKinwYwhE)
264
-
265
-
266
- ### XCFit Cucumberish Demo
267
-
268
- [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/Wd9myhNkpx4/0.jpg)](http://www.youtube.com/watch?v=Wd9myhNkpx4)
269
-
270
-
271
- ### XCFit Fitnesse Demo
272
-
273
- [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/xFRSIugJ-FA/0.jpg)](http://www.youtube.com/watch?v=xFRSIugJ-FA)
data/Docs/xcdoe7swift2.md DELETED
@@ -1,311 +0,0 @@
1
- #XCFit
2
- ## XCFit - 'Swift' Your iOS/macOS apps towards BDD
3
-
4
- ####XCFit a.k.a ([XCUI](https://developer.apple.com/videos/play/wwdc2015/406/0), [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) and [Fitnesse](https://github.com/paulstringer/OCSlimProject) Integrations Tests) is a full stack Xcode BDD framework for [Swift](https://swift.org) iOS and macOS apps. XCFit allows us to write API, UI and Acceptance Tests with Swift in human readable language using tools like [Cucumber](https://cucumber.io/) and [Fitnesse](http://fitnesse.org/) in Xcode. We can still use Apple's brand new UI Testing framework (XCUI) under the hood of Cucumberish. XCFit is fully automated solution for Cucumberish and Fitnesse. You can use 80(Fitnesse):20(Cucumberish) formula to automate Acceptance and UI Testing for better coverage and faster feedback. XCFit is available on [RubyGem](https://rubygems.org/gems/xcfit) and [CocoaPods](http://cocoadocs.org/docsets/XCFit).
5
-
6
-
7
- ### XCFit Features
8
- There are few reason you should go for XCFit
9
- ***
10
- - You can now write Given When Then and Decision Table in Xcode !! YAY.. Thanks to Cucumberish and OCSlimProject ! And XCFit automated them !!
11
- - You can now write/Execute all your Acdeptance Tests and UI Tests using Apple's brand new programming language "Swift" in Xcode. Goodbye Appium, Calabash, Frank, KIF and Goodbye Ruby,Java, Python. It's pure Swift !!
12
-
13
- - XCFit provides Xcode Templates to create new Cucumberish and Fitnesse targets which reduce hectic Xcode configuration steps. It's all automated in XCFit
14
- - One command to set all fully automated Xcode template for Cucumberish and Fitnesse targets
15
- - New Template to create Gherkin Feature file in Xcode
16
- - Automated [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) Setup in one command
17
- - Enhanced [OCSlimProject](https://github.com/paulstringer/OCSlimProject) templates and automated Fitnesse download process.
18
- - XCFit target templates are independent of native Xcode Test targets.
19
- - We can stiil use Apple's brand new XCUI Testing framework. Its native Xcode implementation, No Appium, Calabash etc etc
20
- - Setup Cucumberish and Fitnesse in Xcode within few minutes !!
21
-
22
- ***
23
-
24
-
25
- ### Quick Demo with Example App
26
-
27
- You can clone the existing repo which has a demo app. To get started..Watch this animated GIF for the steps below.
28
-
29
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Quick_Demo.gif)
30
-
31
- ```
32
- $ git clone https://github.com/Shashikant86/XCFit
33
- $ cd XCFit/XCFitDemo
34
- $ open XCFitDemo.xcworkspace
35
- ```
36
- Run Unit, UI and Cucumberish test with Xcode. "cmd + U". Edit Scheme if nessesary to avoid running Unit Tests for this demo. Or Run nit from command line. Update Simulator device/OS version as installed in your Xcode if nessessary
37
-
38
- ```
39
- $ xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3' test | xcpretty -r html -r junit --test --color
40
- ```
41
- Watch out HTML and JUnit reports generated in the 'Build/reports/' directory with XCPretty. Install XCpretty if you havent got already.
42
-
43
- Running Fitnesse Tests: Clean, Build and Execute
44
-
45
- ```
46
- $ xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitAcceptanceTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3' clean build | xcpretty
47
-
48
- $java -jar fitnesse-standalone.jar -v -o -c "FrontPage?suite&format=junit"
49
-
50
- ```
51
-
52
- ###### Using Fastlane
53
-
54
- Assuming you have Bundler rubygem installed if not install it by "gem install bundler"
55
-
56
- ```
57
- $ bundle install
58
- $ bundle exec fastlane cucumberish
59
- $ bundle exec fastlane fitnesse
60
- ```
61
-
62
-
63
- Curently XCFitDemo App is configured on TravisCI which runs both Cucumberish and Fitnesse Tests. The sample .travis.yml is in the Github repo and sample logs from TravisCI [here](https://travis-ci.org/Shashikant86/XCFit/builds/145963673).
64
-
65
-
66
- Big Thanks to
67
- - [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) : Provide native [Gherkin](https://github.com/cucumber/cucumber/wiki/Gherkin) parser for iOS Apps to enable BDD in Xcode using Given When Then. Yay!
68
- - [OCSlimProject](https://github.com/paulstringer/OCSlimProject) : Provide Xcode Templates to enable BDD with Decision Tables using Fitnesse
69
-
70
- XCFit automated configuration of these two guys.
71
-
72
- ### Version
73
- CocoaPods -- [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit) : 0.1.0
74
-
75
- RubyGems -- [xcfit-RubyGem](https://rubygems.org/gems/xcfit) : 0.8.0
76
-
77
- ### Tech & Software Requirements
78
-
79
- XCFit uses a number of open source projects to work properly. You need to have following
80
-
81
- Hardware : You must have Mac Operating System with OSX/MacOS version > 10.9
82
-
83
- Software:
84
- * [Ruby](https://www.ruby-lang.org/en/) - Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X
85
- * [Xcode](https://developer.apple.com/xcode/) - Ideally Xcode 7.X
86
- * [RubyGems](https://rubygems.org/) - RubyGem with [Cocoapods](https://cocoapods.org/) installed
87
- * [Curl on Mac](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/curl.1.html) - Might be pre-installed but worth double checking.
88
- * Ruby Packages : Xcpretty, Fastlane(Optional), Rake, Bundler.. Install with 'gem install <package_name>'
89
-
90
-
91
- ### Installation
92
-
93
- XCFit requires [RubyGems](https://rubygems.org/) to run.
94
-
95
- You need Gulp installed globally:
96
-
97
-
98
- $ gem install xcfit
99
-
100
- Now you are good to get started with XCFit for now. Later we also need to install XCFit Pod.
101
-
102
- # Usage
103
- Now that you can execute 'xcfit' command from your terminal/iTerm etc etc. Example Output Looks like this :
104
-
105
- ```
106
- $ xcfit
107
- Tasks:
108
- xcfit get_cucumberish VERSION # Downloads Cucumberish version and Create Features directory. You must execute this from Cucumberish Xcode Target directory
109
- xcfit get_fitnesse # Download Fitnesse JAR file from Internet. You must execute this from Xcode Fitnesse Acceptance Test Xcode Target directory
110
- xcfit help [TASK] # Describe available tasks or one specific task
111
- xcfit set_xcode_templates # Generate All Xcode Templates for the Gherkin Feature Files & targets for Cucumberish and Fitnesse
112
- xcfit version # Get the current version number
113
-
114
- ```
115
-
116
- ## Setup Xcode Templates
117
-
118
- In existing app or brand new app, we have to enable the Xcode templates for files and targets to speed up the things. Run following command from your termonal
119
-
120
-
121
- ```sh
122
- $ xcfit set_xcode_templates
123
-
124
- ```
125
-
126
- - This will add couple of templates to your Xcode for iOS and macOS apps. In your app if you go to 'File--->New--->Target'
127
-
128
- You will see new option for iOS and OSX i.e 'XCFit'. Once Clicked on it. You will see Cucumberish API, Cucumberish UI and Fitnesse Acceptance Tests targets. As shown
129
-
130
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/new_targets.png)
131
-
132
-
133
-
134
- - Once Clicked on the target e.g 'Cucumberish UI Test Bundle' Xcode will create UI testing target with all the required files with Bridging hrader for Cucumberish UI Testing.
135
- Once Clicked on the target e.g 'Fitnesse Acceptance Test Bundle' Xcode will create UI tAcceptance test with all the required files with Bridging headers for the Fitnesse Acceptance Test. We will see that in details soon.
136
-
137
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFit_Setup.gif)
138
- You can watch YouTube video of XCFit setup [here](https://www.youtube.com/watch?v=Q3cKinwYwhE)
139
-
140
- - This script also set new file type in Xcode to create new Gherking feature file
141
-
142
- ## Setting up Cucumberish UI Target
143
-
144
- 3 Steps to setup Cucumberish. You don't need to use Cocoapods to setup this target.
145
-
146
-
147
- - Add new target iOS/macOS project and Select "File -> New -> Target -> XCFit -> Cucumberish UI Test Bundle". Give it a name you like e.g CucumberishUITests
148
-
149
- Now that Xcode has created brand new target with all required Swift and Objective-C files to run Cucumberish. All Xcode setting has been done by the Xcode Template. Don't worry about configuting anything.
150
-
151
-
152
- - Now that you have to CD into the Cucumberish target directory .eg CucumberishUITests
153
-
154
- ```sh
155
- $ cd $CUCUMBERISH_TARGET_DIR
156
- $ xcfit get_cucumberish 0.0.7
157
- ```
158
- This will download Cucumberish directory from version 0.0.7 and also creats 'Features' directory. You can then reference those directory in Xcode. For "Cucumberish" directory select 'Copy if needed and Create Group' and for the "Features" directory select don't create group or Copy if needed. Just " create folder reference"
159
- Now Add sample Feature File to 'Features' directory either by File->New->Gherkin Or Just add it using your favourite text editor e.g demo.feature with content
160
-
161
- ```
162
- Feature: Demo App Feature
163
-
164
- Scenario: Demo Scenario
165
-
166
- Given the app is running
167
-
168
- ```
169
-
170
- - Finally from the Cucumberish target 'General' setting select 'Testing -> Target To Test' and configure scheme to add Cucumeerish UI target to Test
171
-
172
- You are done !!
173
-
174
- You can watch YouTube video of Cucumberish Setup [here](https://www.youtube.com/watch?v=Wd9myhNkpx4)
175
-
176
- You can add more feature/Scenarios and implement steps definitions inside your Swift File. [Ahmed-Ali](https://github.com/Ahmed-Ali) creator of Cucumberish already implemented useful pre-defined steps have a look at this [Swift file](https://github.com/Ahmed-Ali/Cucumberish/blob/master/CucumberishExample/CucumberishExampleUITests/CCIStepDefinitions.swift). You are free to try Page Object Pattern and all other crazy stuff to abstract and refactor your Swift code.
177
-
178
-
179
-
180
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/CucumberishDemo.gif)
181
-
182
- ## Setting up Fitnesse Acceptance Target
183
-
184
- You can also setup Fitnesse Acceptance Tests but you need to use Cocoapod for this target.
185
-
186
- Basically Steps are pretty much same mentioned in the [OCSlimProject](http://paulstringer.github.io/OCSlimProject/) but most of them are automated for simplicity. Here is simple way to set Fitnesse Acceptance tests for iOS/MacOS Apps
187
-
188
-
189
-
190
- - Create new target, "File --> New --> Target --> XCFit --> Fitnesse Acceptance Test". Give it a suitable name e.g 'AcceptanceTests'
191
-
192
- - Create/Update Podfile with
193
-
194
-
195
- ```ruby
196
-
197
- use_frameworks!
198
-
199
- target 'AcceptanceTests' do
200
- pod 'XCFit'
201
- end
202
- ```
203
-
204
- Run 'Pod install' and build newly created Acceptance target from Xcode. You should see 'LaunchFitnesse' Script geerated and Your app should be talking to fitnesse now.
205
-
206
- - Now CD into FITNESSE_TARGET directory and Get Fitnesse JAR file by running
207
-
208
- ```sh
209
- $ cd $FITNESSE_TARGET
210
- $ xcfit get_fitnesse
211
- ```
212
-
213
- You should have fitnesse-standalone file downloaded in the target directory. You can now execute 'LaunchFitnesse'
214
-
215
- ```sh
216
- $ ./LaunchFitnesse
217
- ```
218
-
219
- Now you should have Fitnesse up and runnig. Follow Paul's article for the details on how to write acceptance tests [here](http://stringerstheory.net/acceptance-testing-with-ios/)
220
-
221
- You can watch YouTube video of XCFit Fitnesse [here](https://www.youtube.com/watch?v=Wd9myhNkpx4)
222
-
223
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/AcceptanceTests.gif)
224
-
225
- ## Continous Integration & Test Reporting
226
-
227
- Continous Integration is very important and you simply can't avoid that. XCFit will be easily configured on any CI server including Apple's own [Xcode Server](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/) or very polular one [Jenkins](https://jenkins.io/) as we can generate reports in both HTML and JUnit format.
228
- As of now, you might be running tests within Xcode, but there are some awsome tools which allows us to run our tests from command line. The 'xcodebuild' is being used to build and test Xcode Schemes. [Fastlane](https://github.com/fastlane/fastlane) seems much easier option to automate everything but it's upto you. These are long commands but you k ow better how to Script it Or Fastlane it, right ? :)
229
-
230
- Curently XCFitDemo App is configured on TravisCI which runs both Cucumberish and Fitnesse Tests. The sample .travis.yml is in the Github repo and sample logs from TravisCI [here](https://travis-ci.org/Shashikant86/XCFit/builds/145963673). Watch out Live Execution :
231
-
232
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Travis_XCFit.gif)
233
-
234
- ### Cucumberish
235
-
236
- You can execute Cucumberish tests with like this for XCFitDemo App.
237
-
238
- [XCPretty](https://github.com/supermarin/xcpretty) can be used to generate JUnit Or HTML report as below
239
-
240
-
241
- ```sh
242
- xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' test | xcpretty -r html -r junit --test --color
243
- ```
244
-
245
- You can now analyse the reports generated in the 'build/reports' directory. You will find both HTML and JUnit reports. You can configure these reports with Xcode-Server, Jenkins, TeamCity easily in the post build setting.
246
-
247
- ```
248
- $ open build/reports/tests.html
249
- ```
250
-
251
-
252
- ![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/html_reports.png)
253
-
254
- ### Fitnesse
255
-
256
- You can first build the Acceptance target
257
-
258
- ```sh
259
- $ xcodebuild -workspace XCFitDemo.xcworkspace -scheme XCFitAcceptanceTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' clean build | xcpretty
260
- ```
261
-
262
- Now run the Fitnesse tests using
263
-
264
- ```sh
265
-
266
- $ java -jar fitnesse-standalone.jar -v -o -c "FrontPage?suite"
267
- ```
268
- You can also set reports directory and generate Junit style reports inside the "XCFitDemo/FitNesseRoot/files/testResults/" directory. You can configure these reports with Xcode-Server, Jenkins, TeamCity easily in the post build setting.
269
-
270
-
271
-
272
- ## What XCFit can solve in iOS/macOS team?
273
- XCFit can bring lot of improvement the way you work. The most common problems in iOS development is explained by Paul Stringer in this [article](http://stringerstheory.net/acceptance-testing-with-ios/). XCFit can solve few of them
274
-
275
- - Better Developer/QA collabration, Early QA Involvement.
276
-
277
- Usually,in the iOS development world, Developer build an app using Swift and Objective-C and army of manual and automated QA uses tools like Apppium, Calabash using languages like Ruby, Java, Python WTF !!. QA and Developers world is totally different. With XCFit you will be speaking same language that is "Swift". QA can write test script as we build. No need to wait until build is handed over. Just work with developer ! Little bit of learning curve for QA but you will save developers time as they don't to learn Java, Pyth or Ruby to help QA team
278
-
279
- - Quick Acceptance & UI testing setup
280
-
281
- You will be surprised by how easily/quickly you can setup Fitnesse(Acceptance Test) and Cucumberish(UI Testing) environmant in Xcode and running your first test.
282
-
283
- - Getting Business people involved
284
-
285
- As we can now able to write scenarios with Given/When/Then and decision tables. We can get business people involved to contribute to acceptance criteria. In short we got all benefits of BDD in iOS/macOS project.
286
-
287
- - Developers don't need to learn Ruby or similar ! Just stick to Swift
288
-
289
- You must be happy as you won't need to learn other language just in case QA ask something to solve. With XCFit it's everything Swift.
290
-
291
- - Fix failed attempt to automate testing by QA team
292
-
293
- As of now your QA team might have tried all wrappers on [UIAutomation](https://developer.apple.com/library/tvos/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UIAutomation.html) e.g Appium, Calabash, Frank, KIF etc etc and keeping themselve busy writing some Ruby, Python, Java code to automate testing and all that attempts results in Slow, Brittle, Untrusted, Non-valuable UI tests causing harm to mobile development rather than good. With XCFit, everyone will be speaking same language and you can cover businness logic with lighting fast Fitnesse Tests and major journeys with UI tests. Keep it 80:20 means 80% Fitness and 20% Cucumberish or XCUI.
294
-
295
-
296
-
297
- # Video Demo
298
-
299
- ### XCFit Xcode Setup
300
-
301
- [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/Q3cKinwYwhE/0.jpg)](http://www.youtube.com/watch?v=Q3cKinwYwhE)
302
-
303
-
304
- ### XCFit Cucumberish Demo
305
-
306
- [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/Wd9myhNkpx4/0.jpg)](http://www.youtube.com/watch?v=Wd9myhNkpx4)
307
-
308
-
309
- ### XCFit Fitnesse Demo
310
-
311
- [![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/xFRSIugJ-FA/0.jpg)](http://www.youtube.com/watch?v=xFRSIugJ-FA)