README.md in xcfit-6.1.0 vs README.md in xcfit-7.0.0
- old
+ new
@@ -1,6 +1,6 @@
-#### XCFit Project Details
+#### XCFit Project Details
------------------------------------------------------
[![Version](https://img.shields.io/cocoapods/v/XCFit.svg?style=flat&label=pod)](http://cocoapods.org/pods/XCFit)
[![CocoaPods](https://img.shields.io/cocoapods/at/XCFit.svg)]()
[![CocoaPods](https://img.shields.io/cocoapods/dt/XCFit.svg?label=pod-downloads)]()
[![GitHub release](https://img.shields.io/github/release/Shashikant86/xcfit.svg?label=git-release)]()
@@ -85,34 +85,34 @@
* **Homebrew** - We can tap 'shashikant86/homebrew-taps' and Install XCFit to download Xcode Templates
* **RubyGems** -- [xcfit-RubyGem](https://rubygems.org/gems/xcfit) to get automated Xcode Templates
-The rubygem method is preferred.
+The Rubygem method is preferred.
# Tech & Software Requirements
-XCFit is pure Swift but other libraries like Fitnesse and Cucumberish need some additional softwares.
+XCFit is pure Swift but other libraries like Fitnesse and Cucumberish need some additional softwares.
**Hardware**
You must have Mac Operating System with OSX/MacOS Sierra or above.
**Software**
-* **[Xcode 8.3](https://developer.apple.com/xcode/)**
+* **[Xcode 9](https://developer.apple.com/xcode/)**
- XCFit 4 only Supports Xcode 8.3 and above however XCFit 3 can be used with **Xcode 8.2**
-* **[Swift 3.1](https://swift.org/download/)**
+* **[Swift 4](https://swift.org/download/)**
- XCFit currenly support Swift 3.0 and Swift 3.1.
* **[Ruby](https://www.ruby-lang.org/en/)**
- 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.
* **[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.
-* **[Homebrew](http://brew.sh)**
-* **Fitnesse only 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.
+* **[Homebrew](http://brew.sh)** Optional
+* **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.
---
# Installation
@@ -126,30 +126,17 @@
This will install Xcode Templates with skeleton code to support BDD in iOS app. The templates are XCUI based Protocol-oriented BDD templates, Page Object Templates, Cucumberish BDD Templates and OCSlim Fitnesse Templates (optional). The templates can be installed with [xcfit-RubyGem](https://rubygems.org/gems/xcfit) or [Homebrew](http://brew.sh). You need to select only one method of installtion. The rubygem method is preferred.
* **Framework Installation**
-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 cab 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.
+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.
## Template Installation
-XCFit templates can be installed using Homebrew or Rubygem.
+XCFit templates can be installed using Rubygem.
-#### Homebrew Installation
-
-Assuming you have already installed [Homebrew](http://brew.sh). Let's tap the formula
-
- $ brew tap shashikant86/homebrew-taps
-
-Now, we can install XCFit brew package using
-
- $ brew install xcfit
-
-
-This will download XCFit templates in the '~/Library/Developer/Xcode/Templates/' directory.
-
#### XCFit RubyGem Installation
If you can't use HomeBrew for some reason then XCFit can be installed using [RubyGems](https://rubygems.org/). This will set our Xcode with BDD templates for XCFit and Cucumberish
$ gem install xcfit
@@ -159,11 +146,11 @@
You can choose any of the above method. Rubygems method is prefered.
### Setup Xcode Templates
-In existing app or brand new app, we have to enable the Xcode templates for targets to speed up the
+In existing app or brand new app, we have to enable the Xcode templates for targets to speed up the
##### Xcode Templates for XCFit
To setup Templates for Xcode 8 for XCUI ptotocol-oriented BDD, Cucumberish target and Gherkin File Type.
@@ -174,13 +161,12 @@
```
- This will add couple of templates to your Xcode for iOS apps. In your app if you go to 'File--->New--->Target'
-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. As shown
+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.
-![image](https://github.com/Shashikant86/XCFit5-GIF/blob/master/templates.png)
## Framework Installation
XCFit, Cucumberish or OCSlimProject Framework can be installed using Cocoapods. XCFit and Cuucmberish can be installed using Carthage as well.
@@ -203,11 +189,11 @@
```ruby
target '$_YOUR__TARGET' do
pod 'XCFit'
end
```
-You can use any of the method above to setup `Podfile`.
+You can use any of the method above to setup `Podfile`.
Now that, we have `Podfile` setup, we can install dependencies using command
```sh
$ pod install
@@ -248,14 +234,13 @@
We can build, test package using the Commands available for the Swift Package Manager.
---
-# XCFit Swift Framework : Protocol Oriented BDD+ Page Object + Pre-Defined Steps
+# XCFit Swift Framework : Protocol Oriented BDD
+## Protocol Oriented BDD(Recommended)
-## Protocol Oriented BDD
-
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/)
XCFit template supports Protocol Oriented BDD. Swift is a protocol oriented language and we don't want to miss the point of Protocol, Extensions and Enums. To setup template. 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/)
- From Xcode, create a new app(Or use existing app) and select File ---> New ----> Target
@@ -268,98 +253,57 @@
- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
### What's in the Protocol Oriented BDD Template ?
-* **Feature+Protocol.swift**
+* **Feature.swift**
It's your feature will all the requirements which can be written as Acceptance tests
-* **Feature+Extensions.swift**
+* **FeatureSteps.swift**
It's extension on the Feature where you need to implement step definition in Given When Then format
-* **Feature+Enums.swift**
+* **FeatureElements.swift**
All the XCUIElements for that Feature.
* **YOUR_TARGET_Test.swift**
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
-![image](https://github.com/Shashikant86/XCFit5-GIF/blob/master/xcfit5-demo.gif)
+* **UITestBase.swift**
+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.
-
-
-## Page Object Pattern
-
-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.
-
-
-## Setup 'Page Object Test bundle' Target
-
-- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
-
-- Now Select 'XCFit' for iOS app and Click on 'Page Object Test Bundle'
-
-- 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.
-
-- You may want to delete autogenerated UI test from Apple's standard template.
-
-- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
-
-
-
-![image](https://github.com/Shashikant86/xcfitgif/blob/master/XCFitPOM_Templates.gif)
-
-### What's in the XCUI POM Template ?
-
-* **YOUR_APP_TARGETPageObjectTests.swift**
-
-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.
-
-* **Screens**
-
-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.
-
-
-* **Tests**
-
-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.
-
-* **TestBase**
-
-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
-
## Getting XCFit Framework for pre-defined BDD Style steps
### Cocoapods
You can get XCFit Framework easily. Create `Podfile` and add specific dependency for the target
Cocoapods is more automated than Carthage. We can create `Podfile` and add specific dependency for the target or we can use XCFit template `Podfile` using command.
$ xcfit setup_xcfit_podfile
This will create a Podfile, you need to replace your target names as required.
-* **Swift 3.0.2**
+* **Swift 4**
We can create `Podfile` and add specific dependency for the target
```ruby
target '$_YOUR__TARGET' do
- pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '3.0.0'
+ pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '7.0.0'
end
```
This will doownload Cocoapods supporting Swift 3.0.2
* **Swift 3.1**
-You can doenload latest version 5.0.0 to work with Swift 3.1
+You can get version 6.0.0 to work with Swift 3.1
```ruby
target '$_YOUR__TARGET' do
- pod 'XCFit'
+ pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '6.0.0'
end
```
Now that, We need to install the framework using
@@ -368,28 +312,26 @@
```
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.
-![image](https://github.com/Shashikant86/xcfitgif/blob/master/Pod_install_XCFit.gif)
-
### Carthage
-XCFit and Cucumberish can be installed as Cartahge. 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
+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
-* **Swift 3.0.2**
+* **Swift 4**
-Add the following to `Cartfile` to get Swift 3.0.2 compatable source
+Add the following to `Cartfile` to get Swift 4 compatable source
- github "Shashikant86/XCFit" "3.0.0"
+ github "Shashikant86/XCFit" "7.0.0"
* **Swift 3.1**
You can get latest tag will work with Swift 3.1 then `Cartfile` can have following
- github "Shashikant86/XCFit" "5.0.0"
+ github "Shashikant86/XCFit" "6.0.0"
Now fetch dependency and build XCFit using.
@@ -405,33 +347,78 @@
$(SRCROOT)/Carthage/Build/iOS/XCFit.framework
-Here is Carthage looks like
-![image](https://github.com/Shashikant86/xcfitgif/blob/master/XCFit_Carthage.gif)
You can choose any of the above method but Cocoapods is easy and less manual.
-
## Import XCFit & Use Predefined Steps
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.
#### Using Steps inside Protocol Oriented BDD pattern
-You can simply import `XCFit` inside the test class and extend it to XCFit. You can also use `Feature+Extensions.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/)
+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/)
+# Practical Demo
+
+[![Alt text](https://img.youtube.com/vi/7gqPxy6UVRw/0.jpg)](https://www.youtube.com/watch?v=7gqPxy6UVRw)
+
+
+
+** =====I would strongly recommend to use Protocol Oriented Approach for BDD and you can ignore the below mentioned patterns ===== **
+
+
+---
+## Page Object Pattern
+
+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.
+
+
+## Setup 'Page Object Test bundle' Target
+
+- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
+
+- Now Select 'XCFit' for iOS app and Click on 'Page Object Test Bundle'
+
+- 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.
+
+- You may want to delete autogenerated UI test from Apple's standard template.
+
+- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
+
+
+### What's in the XCUI POM Template ?
+
+* **YOUR_APP_TARGETPageObjectTests.swift**
+
+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.
+
+* **Screens**
+
+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.
+
+
+* **Tests**
+
+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.
+
+* **TestBase**
+
+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
+
+
+
#### Using Steps in Page Object Pattern
You can simply import `XCFit` inside the test class and extend it to XCFit
You will get access to lots of predefined BDD style human readable steps. It's not mandatory to use those steps unless you wish.
**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)**
-![image](https://github.com/Shashikant86/xcfitgif/blob/master/pre-defined_xcfit_steps.gif)
## Setting Fastlane for XCFit
[Fastlane](https://fastlane.tools/) is a awesome tool for iOS Continuous Delivery which automates most of the iOS development tasks. We can use it to run tests written using XCFit, We can setup sample `Fastfile` using XCFit command
@@ -443,11 +430,10 @@
$ fastlane xcfit
This will run all our tests using Fastlane that will be easy to plug it with any CI server.
-![image](https://github.com/Shashikant86/XCFit5-GIF/blob/master/fastfile.gif)
---
@@ -541,12 +527,10 @@
Now close the existing Xcode session and Xcode Workspace `.xcworkspace` next time.
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.
and press 'CMD+U'
-![image](https://github.com/Shashikant86/xcfitgif/blob/master/cucumberish_template.gif)
-
Congratulations !! You have just ran your first Cucumber BDD Scenario in the Xcode.
#### Create Separate Scheme if needed
XCFit adds 'Cucumberish' target to existing Scheme. You can remove that target and run separate scheme to keep it independent from Unit tests. Make sure you make the new scheme executable for Running.
@@ -571,12 +555,10 @@
* From the build phases of the cucumberish target select ` Link Binary with Libraries` and drag `Cucumberish.framework` from `Carthage/Build/iOS` directory
* Add `New Copy Files Phase` and select destination as 'Frameworks' and Add Cucumberish Frameworks from `Carthage/Build/iOS` directory. Select 'Create Group' and 'Copy if needed' when prompted.
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
-![image](https://github.com/Shashikant86/xcfitgif/blob/master/CarthageCucumberish.gif)
-
## Cucumberish Pre-Defined Steps
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.
**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)**
@@ -698,13 +680,11 @@
#### Test AcceptanceUnitTests Target
Now if you select “AcceptanceUnitTarget” and press CMD+U.
-![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/FitnesseXCTest.gif)
-
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.
# Continuous Integration with Xcode Server
@@ -755,14 +735,9 @@
# Author
Shashikant86, shashikant.jagtap@icloud.com
-
-# TODO
-
- * Add More Step Definitions for Cucumberish Projects
- * Improve Swift Package with additional XCUI test helpers
# LICENSE
Copyright © 2014 Shashikant Jagtap, http://shashikantjagtap.net