xcfit 6.1.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +78 -103
- data/XCFit.podspec +1 -1
- data/homebrew/xcfit +1 -1
- data/lib/XCFit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fac080f3eb50a2486f051e9ab0d30ac3a5ee9d0
|
4
|
+
data.tar.gz: 1d79d62dc1c11dd2b6b1b0e13a4b5d0fa371b4c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa01d01805938559f821aa8edf096d2dc560027c88456fee421a5a2d6a9b2d90a4ee8a4da6c7f90f59f290222bb0686931b2ea40de0b8b6ddafa600508093965
|
7
|
+
data.tar.gz: 7e1eb1dd77a7cdfb4627ce85434c7c6ee2136b934fd7a267abdbdc92820a1131978fe1541c09be2d3aec2d333fc277a7142a948fabc8afd993ac31a555845196
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#### XCFit Project Details
|
1
|
+
#### XCFit Project Details
|
2
2
|
------------------------------------------------------
|
3
3
|
[![Version](https://img.shields.io/cocoapods/v/XCFit.svg?style=flat&label=pod)](http://cocoapods.org/pods/XCFit)
|
4
4
|
[![CocoaPods](https://img.shields.io/cocoapods/at/XCFit.svg)]()
|
@@ -87,12 +87,12 @@
|
|
87
87
|
|
88
88
|
* **RubyGems** -- [xcfit-RubyGem](https://rubygems.org/gems/xcfit) to get automated Xcode Templates
|
89
89
|
|
90
|
-
The
|
90
|
+
The Rubygem method is preferred.
|
91
91
|
|
92
92
|
|
93
93
|
# Tech & Software Requirements
|
94
94
|
|
95
|
-
XCFit is pure Swift but other libraries like Fitnesse and Cucumberish need some additional softwares.
|
95
|
+
XCFit is pure Swift but other libraries like Fitnesse and Cucumberish need some additional softwares.
|
96
96
|
|
97
97
|
**Hardware**
|
98
98
|
|
@@ -101,16 +101,16 @@ You must have Mac Operating System with OSX/MacOS Sierra or above.
|
|
101
101
|
**Software**
|
102
102
|
|
103
103
|
|
104
|
-
* **[Xcode
|
104
|
+
* **[Xcode 9](https://developer.apple.com/xcode/)**
|
105
105
|
- XCFit 4 only Supports Xcode 8.3 and above however XCFit 3 can be used with **Xcode 8.2**
|
106
|
-
* **[Swift
|
106
|
+
* **[Swift 4](https://swift.org/download/)**
|
107
107
|
- XCFit currenly support Swift 3.0 and Swift 3.1.
|
108
108
|
* **[Ruby](https://www.ruby-lang.org/en/)**
|
109
109
|
- Ruby is required to setup XCFit templates either using Homebrew or Rubygem. Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X. You can use system Ruby with sudo.
|
110
110
|
* **[Curl on Mac](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/curl.1.html)**
|
111
111
|
- Might be pre-installed but worth double checking.
|
112
|
-
* **[Homebrew](http://brew.sh)**
|
113
|
-
* **Fitnesse
|
112
|
+
* **[Homebrew](http://brew.sh)** Optional
|
113
|
+
* **Fitnesse - Optional** : You might need to have [iOS-Sim](https://www.npmjs.com/package/ios-sim), [Java](https://www.java.com/en/) if you want to use Fitnesse.
|
114
114
|
|
115
115
|
|
116
116
|
---
|
@@ -128,25 +128,12 @@ This will install Xcode Templates with skeleton code to support BDD in iOS app.
|
|
128
128
|
|
129
129
|
* **Framework Installation**
|
130
130
|
|
131
|
-
XCFit Swift Framework provides pre-defined BDD Style steps with XCUITest to support Protocol-oriented BDD and writing tests using Page Object pattern. The supporting Frameworks like Cucumberish and OCSlim which
|
131
|
+
XCFit Swift Framework provides pre-defined BDD Style steps with XCUITest to support Protocol-oriented BDD and writing tests using Page Object pattern. The supporting Frameworks like Cucumberish and OCSlim which can be used to write BDD Steps. XCFit Swift Framework is available on [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit), Carthage and Swift Package manager. [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) and [OCSlimProject](https://github.com/paulstringer/OCSlimProject) are available on Cocoapods.
|
132
132
|
|
133
133
|
|
134
134
|
## Template Installation
|
135
135
|
|
136
|
-
XCFit templates can be installed using
|
137
|
-
|
138
|
-
#### Homebrew Installation
|
139
|
-
|
140
|
-
Assuming you have already installed [Homebrew](http://brew.sh). Let's tap the formula
|
141
|
-
|
142
|
-
$ brew tap shashikant86/homebrew-taps
|
143
|
-
|
144
|
-
Now, we can install XCFit brew package using
|
145
|
-
|
146
|
-
$ brew install xcfit
|
147
|
-
|
148
|
-
|
149
|
-
This will download XCFit templates in the '~/Library/Developer/Xcode/Templates/' directory.
|
136
|
+
XCFit templates can be installed using Rubygem.
|
150
137
|
|
151
138
|
#### XCFit RubyGem Installation
|
152
139
|
|
@@ -161,7 +148,7 @@ You can choose any of the above method. Rubygems method is prefered.
|
|
161
148
|
|
162
149
|
### Setup Xcode Templates
|
163
150
|
|
164
|
-
In existing app or brand new app, we have to enable the Xcode templates for targets to speed up the
|
151
|
+
In existing app or brand new app, we have to enable the Xcode templates for targets to speed up the
|
165
152
|
##### Xcode Templates for XCFit
|
166
153
|
|
167
154
|
To setup Templates for Xcode 8 for XCUI ptotocol-oriented BDD, Cucumberish target and Gherkin File Type.
|
@@ -176,9 +163,8 @@ $ xcfit setup_xcode_templates
|
|
176
163
|
|
177
164
|
- This will add couple of templates to your Xcode for iOS apps. In your app if you go to 'File--->New--->Target'
|
178
165
|
|
179
|
-
You will see new option for iOS i.e 'XCFit'. Once Clicked on it. You will see Protocol BDD, Cucumberish UI and Fitnesse Acceptance Tests. XCUI POM, Fitnesse Acceptance Unit Test bundles.
|
166
|
+
You will see new option for iOS i.e 'XCFit'. Once Clicked on it. You will see Protocol BDD, Cucumberish UI and Fitnesse Acceptance Tests. XCUI POM, Fitnesse Acceptance Unit Test bundles.
|
180
167
|
|
181
|
-
![image](https://github.com/Shashikant86/XCFit5-GIF/blob/master/templates.png)
|
182
168
|
|
183
169
|
|
184
170
|
## Framework Installation
|
@@ -205,7 +191,7 @@ Latest version should support
|
|
205
191
|
pod 'XCFit'
|
206
192
|
end
|
207
193
|
```
|
208
|
-
You can use any of the method above to setup `Podfile`.
|
194
|
+
You can use any of the method above to setup `Podfile`.
|
209
195
|
|
210
196
|
Now that, we have `Podfile` setup, we can install dependencies using command
|
211
197
|
|
@@ -250,9 +236,8 @@ We can build, test package using the Commands available for the Swift Package Ma
|
|
250
236
|
|
251
237
|
|
252
238
|
---
|
253
|
-
# XCFit Swift Framework : Protocol Oriented BDD
|
254
|
-
|
255
|
-
## Protocol Oriented BDD
|
239
|
+
# XCFit Swift Framework : Protocol Oriented BDD
|
240
|
+
## Protocol Oriented BDD(Recommended)
|
256
241
|
|
257
242
|
You can read step by step tutorial on my blog on Protocol-Oriented BDD [here](http://shashikantjagtap.net/introducing-protocol-oriented-bdd-swift-ios-apps/)
|
258
243
|
|
@@ -270,15 +255,15 @@ XCFit template supports Protocol Oriented BDD. Swift is a protocol oriented lang
|
|
270
255
|
|
271
256
|
### What's in the Protocol Oriented BDD Template ?
|
272
257
|
|
273
|
-
* **Feature
|
258
|
+
* **Feature.swift**
|
274
259
|
|
275
260
|
It's your feature will all the requirements which can be written as Acceptance tests
|
276
261
|
|
277
|
-
* **
|
262
|
+
* **FeatureSteps.swift**
|
278
263
|
|
279
264
|
It's extension on the Feature where you need to implement step definition in Given When Then format
|
280
265
|
|
281
|
-
* **
|
266
|
+
* **FeatureElements.swift**
|
282
267
|
|
283
268
|
All the XCUIElements for that Feature.
|
284
269
|
|
@@ -286,49 +271,8 @@ All the XCUIElements for that Feature.
|
|
286
271
|
|
287
272
|
This is test where you call Given When Then from Extensions. You can import `XCFit` framework and extend this class 'XCFit' and also confirms to 'Feature' protocol
|
288
273
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
## Page Object Pattern
|
294
|
-
|
295
|
-
XCFit templates gives an option to use very polular [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html) with Apple's Xcode UI Testing framework. You can install templates and start using the code straight way, no need to use framework unless you want to use pre-defined BDD style tests.
|
296
|
-
|
297
|
-
|
298
|
-
## Setup 'Page Object Test bundle' Target
|
299
|
-
|
300
|
-
- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
|
301
|
-
|
302
|
-
- Now Select 'XCFit' for iOS app and Click on 'Page Object Test Bundle'
|
303
|
-
|
304
|
-
- Once Clicked on the target e.g 'XCUI POM Test Bundle' Xcode will create UI testing target with properly structured Xcode Groups and required files. You can then make physical directories on Disk Or change the folder/group structure as per your need.
|
305
|
-
|
306
|
-
- You may want to delete autogenerated UI test from Apple's standard template.
|
307
|
-
|
308
|
-
- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
![image](https://github.com/Shashikant86/xcfitgif/blob/master/XCFitPOM_Templates.gif)
|
313
|
-
|
314
|
-
### What's in the XCUI POM Template ?
|
315
|
-
|
316
|
-
* **YOUR_APP_TARGETPageObjectTests.swift**
|
317
|
-
|
318
|
-
This file is at the base of the target. It's exactly same file that Apple's XCUI Test generate at first. You may use it for recording the tests or simply delete it if not needed.
|
319
|
-
|
320
|
-
* **Screens**
|
321
|
-
|
322
|
-
This is groups where we can abstract logic of every screen in the app. Example file are 'HomeScreen.swift' and 'BaseScreen.swift' This assumes that your apps is made up of multiple screens. You can write individual screen class which extend BaseScreen. All the functionality related to screen can be included in this class.
|
323
|
-
|
324
|
-
|
325
|
-
* **Tests**
|
326
|
-
|
327
|
-
This group has all the test for our app. Currently demo template has two tests 'HomeScreenTest.swift' and 'ProtocolOrientedTest.swift'. This examples shows how XCUI test can be implemented in the Object Orinted way and Protocol oriented way.
|
328
|
-
|
329
|
-
* **TestBase**
|
330
|
-
|
331
|
-
Testbase is group where we can abstract all setup, teardown and common stuff in the base class. Every Screen then use this class as base. You can add more stuff as needed e.g Fixtures, Launch Arguments
|
274
|
+
* **UITestBase.swift**
|
275
|
+
This is a base class for all the Test. Once XCFit imported then we can extend this class with XCFit to get the pre-defined steps.
|
332
276
|
|
333
277
|
## Getting XCFit Framework for pre-defined BDD Style steps
|
334
278
|
|
@@ -340,24 +284,24 @@ Cocoapods is more automated than Carthage. We can create `Podfile` and add speci
|
|
340
284
|
|
341
285
|
This will create a Podfile, you need to replace your target names as required.
|
342
286
|
|
343
|
-
* **Swift
|
287
|
+
* **Swift 4**
|
344
288
|
|
345
289
|
We can create `Podfile` and add specific dependency for the target
|
346
290
|
|
347
291
|
```ruby
|
348
292
|
target '$_YOUR__TARGET' do
|
349
|
-
pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '
|
293
|
+
pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '7.0.0'
|
350
294
|
end
|
351
295
|
```
|
352
296
|
This will doownload Cocoapods supporting Swift 3.0.2
|
353
297
|
|
354
298
|
* **Swift 3.1**
|
355
299
|
|
356
|
-
You can
|
300
|
+
You can get version 6.0.0 to work with Swift 3.1
|
357
301
|
|
358
302
|
```ruby
|
359
303
|
target '$_YOUR__TARGET' do
|
360
|
-
pod 'XCFit'
|
304
|
+
pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '6.0.0'
|
361
305
|
end
|
362
306
|
```
|
363
307
|
|
@@ -370,24 +314,22 @@ $ pod install
|
|
370
314
|
Close existing Xcode Session and Open `.xcworkspace/`. Now in the 'testBase' class just `import XCFit` and extend the class to `XCFit` class. The predefined steps are ready to use.
|
371
315
|
|
372
316
|
|
373
|
-
![image](https://github.com/Shashikant86/xcfitgif/blob/master/Pod_install_XCFit.gif)
|
374
|
-
|
375
317
|
### Carthage
|
376
318
|
|
377
|
-
XCFit and Cucumberish can be installed as
|
319
|
+
XCFit and Cucumberish can be installed as Carthage. We need to create `Cartfile` in the root of the project. Depending on which version of Swift you are using, we can use different tag
|
378
320
|
|
379
|
-
* **Swift
|
321
|
+
* **Swift 4**
|
380
322
|
|
381
|
-
Add the following to `Cartfile` to get Swift
|
323
|
+
Add the following to `Cartfile` to get Swift 4 compatable source
|
382
324
|
|
383
|
-
github "Shashikant86/XCFit" "
|
325
|
+
github "Shashikant86/XCFit" "7.0.0"
|
384
326
|
|
385
327
|
|
386
328
|
* **Swift 3.1**
|
387
329
|
|
388
330
|
You can get latest tag will work with Swift 3.1 then `Cartfile` can have following
|
389
331
|
|
390
|
-
github "Shashikant86/XCFit" "
|
332
|
+
github "Shashikant86/XCFit" "6.0.0"
|
391
333
|
|
392
334
|
|
393
335
|
Now fetch dependency and build XCFit using.
|
@@ -407,19 +349,65 @@ and add the paths to the frameworks you want to use under “Input Files”, e.g
|
|
407
349
|
$(SRCROOT)/Carthage/Build/iOS/XCFit.framework
|
408
350
|
|
409
351
|
|
410
|
-
Here is Carthage looks like
|
411
352
|
|
412
|
-
![image](https://github.com/Shashikant86/xcfitgif/blob/master/XCFit_Carthage.gif)
|
413
353
|
|
414
354
|
You can choose any of the above method but Cocoapods is easy and less manual.
|
415
|
-
|
416
355
|
## Import XCFit & Use Predefined Steps
|
417
356
|
|
418
357
|
There are some predefined XCFit steps we can use by importing `XCFit` and extending out test class to `XCFit`. There are plenty of Pre-Defined BDD Style Steps available [here](https://github.com/Shashikant86/XCFit/blob/master/Pre-Defined_Steps/XCFit_Predefined_Steps.md). You can use predefined steps wherever they make sense however it's fairly easy to write your own.
|
419
358
|
|
420
359
|
#### Using Steps inside Protocol Oriented BDD pattern
|
421
360
|
|
422
|
-
You can simply import `XCFit` inside the
|
361
|
+
You can simply import `XCFit` inside the `UITestBase` class and extend it to XCFit. You can also use `FeatureSteps.swift` to implement or override some steps. You can read step by step tutorial on my blog on Protocol-Oriented BDD [here](http://shashikantjagtap.net/introducing-protocol-oriented-bdd-swift-ios-apps/)
|
362
|
+
|
363
|
+
# Practical Demo
|
364
|
+
|
365
|
+
[![Alt text](https://img.youtube.com/vi/7gqPxy6UVRw/0.jpg)](https://www.youtube.com/watch?v=7gqPxy6UVRw)
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
** =====I would strongly recommend to use Protocol Oriented Approach for BDD and you can ignore the below mentioned patterns ===== **
|
370
|
+
|
371
|
+
|
372
|
+
---
|
373
|
+
## Page Object Pattern
|
374
|
+
|
375
|
+
XCFit templates gives an option to use very polular [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html) with Apple's Xcode UI Testing framework. You can install templates and start using the code straight way, no need to use framework unless you want to use pre-defined BDD style tests.
|
376
|
+
|
377
|
+
|
378
|
+
## Setup 'Page Object Test bundle' Target
|
379
|
+
|
380
|
+
- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
|
381
|
+
|
382
|
+
- Now Select 'XCFit' for iOS app and Click on 'Page Object Test Bundle'
|
383
|
+
|
384
|
+
- Once Clicked on the target e.g 'XCUI POM Test Bundle' Xcode will create UI testing target with properly structured Xcode Groups and required files. You can then make physical directories on Disk Or change the folder/group structure as per your need.
|
385
|
+
|
386
|
+
- You may want to delete autogenerated UI test from Apple's standard template.
|
387
|
+
|
388
|
+
- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
|
389
|
+
|
390
|
+
|
391
|
+
### What's in the XCUI POM Template ?
|
392
|
+
|
393
|
+
* **YOUR_APP_TARGETPageObjectTests.swift**
|
394
|
+
|
395
|
+
This file is at the base of the target. It's exactly same file that Apple's XCUI Test generate at first. You may use it for recording the tests or simply delete it if not needed.
|
396
|
+
|
397
|
+
* **Screens**
|
398
|
+
|
399
|
+
This is groups where we can abstract logic of every screen in the app. Example file are 'HomeScreen.swift' and 'BaseScreen.swift' This assumes that your apps is made up of multiple screens. You can write individual screen class which extend BaseScreen. All the functionality related to screen can be included in this class.
|
400
|
+
|
401
|
+
|
402
|
+
* **Tests**
|
403
|
+
|
404
|
+
This group has all the test for our app. Currently demo template has two tests 'HomeScreenTest.swift' and 'ProtocolOrientedTest.swift'. This examples shows how XCUI test can be implemented in the Object Orinted way and Protocol oriented way.
|
405
|
+
|
406
|
+
* **TestBase**
|
407
|
+
|
408
|
+
Testbase is group where we can abstract all setup, teardown and common stuff in the base class. Every Screen then use this class as base. You can add more stuff as needed e.g Fixtures, Launch Arguments
|
409
|
+
|
410
|
+
|
423
411
|
|
424
412
|
#### Using Steps in Page Object Pattern
|
425
413
|
|
@@ -429,7 +417,6 @@ You will get access to lots of predefined BDD style human readable steps. It's n
|
|
429
417
|
|
430
418
|
**Don't like Pre-defined steps, you can easily override the steps, covered in the later section [here](#advise-on-using-pre-defines-bdd-style-steps)**
|
431
419
|
|
432
|
-
![image](https://github.com/Shashikant86/xcfitgif/blob/master/pre-defined_xcfit_steps.gif)
|
433
420
|
|
434
421
|
|
435
422
|
## Setting Fastlane for XCFit
|
@@ -445,7 +432,6 @@ This will create template Fastfile with all the required lanes. You can replace
|
|
445
432
|
|
446
433
|
This will run all our tests using Fastlane that will be easy to plug it with any CI server.
|
447
434
|
|
448
|
-
![image](https://github.com/Shashikant86/XCFit5-GIF/blob/master/fastfile.gif)
|
449
435
|
|
450
436
|
|
451
437
|
---
|
@@ -543,8 +529,6 @@ Now close the existing Xcode session and Xcode Workspace `.xcworkspace` next tim
|
|
543
529
|
We now have everything we needed to run demo Cucumber demo test. Update Scheme if don't want to run unit test or other type of tests.
|
544
530
|
and press 'CMD+U'
|
545
531
|
|
546
|
-
![image](https://github.com/Shashikant86/xcfitgif/blob/master/cucumberish_template.gif)
|
547
|
-
|
548
532
|
Congratulations !! You have just ran your first Cucumber BDD Scenario in the Xcode.
|
549
533
|
|
550
534
|
#### Create Separate Scheme if needed
|
@@ -573,8 +557,6 @@ This will chekcout and build XCFit and Cucumberish frameworks inside the `Cartha
|
|
573
557
|
|
574
558
|
Once drag and drop is don and we have "Features" directory then we are ready to launch our BDD Style tests using 'CMD+U'. The entire Carthage Setup looks like this
|
575
559
|
|
576
|
-
![image](https://github.com/Shashikant86/xcfitgif/blob/master/CarthageCucumberish.gif)
|
577
|
-
|
578
560
|
## Cucumberish Pre-Defined Steps
|
579
561
|
|
580
562
|
There are some pre-defined Cucumberish Steps available to use directly without any need to implement in the step definition. You can see list of steps [here](https://github.com/Shashikant86/XCFit/blob/master/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md). You already have those steps in the 'CommonStepDefinitions.swift' file. You can modify the steps as per your project need or add your own.
|
@@ -700,8 +682,6 @@ Now you should be able to build an “Acceptance Tests” target. Once, build is
|
|
700
682
|
|
701
683
|
Now if you select “AcceptanceUnitTarget” and press CMD+U.
|
702
684
|
|
703
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/FitnesseXCTest.gif)
|
704
|
-
|
705
685
|
|
706
686
|
Now we can see that FitNesse tests are running as shown above. We can add this to main scheme to make sure we are running it after the unit tests to follow proper development workflow. We can build and run it as our normal unit tests.
|
707
687
|
|
@@ -758,11 +738,6 @@ Big Thanks to
|
|
758
738
|
|
759
739
|
Shashikant86, shashikant.jagtap@icloud.com
|
760
740
|
|
761
|
-
# TODO
|
762
|
-
|
763
|
-
* Add More Step Definitions for Cucumberish Projects
|
764
|
-
* Improve Swift Package with additional XCUI test helpers
|
765
|
-
|
766
741
|
|
767
742
|
# LICENSE
|
768
743
|
|
data/XCFit.podspec
CHANGED
data/homebrew/xcfit
CHANGED
data/lib/XCFit/version.rb
CHANGED