Permalink
Browse files

Version Bump 7.0

  • Loading branch information...
Shashikant86 committed Oct 4, 2017
1 parent 196b1b8 commit cb10d323ed3f8ac6b5231fa9e97d38def398f13d
Showing with 81 additions and 106 deletions.
  1. +78 −103 README.md
  2. +1 −1 XCFit.podspec
  3. +1 −1 homebrew/xcfit
  4. +1 −1 lib/XCFit/version.rb
View
181 README.md
@@ -1,4 +1,4 @@
#### 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)]()
@@ -87,12 +87,12 @@
* **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**
@@ -101,16 +101,16 @@ 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.
---
@@ -128,25 +128,12 @@ This will install Xcode Templates with skeleton code to support BDD in iOS app.
* **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.
#### 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 templates can be installed using Rubygem.
#### XCFit RubyGem Installation
@@ -161,7 +148,7 @@ 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.
@@ -176,9 +163,8 @@ $ xcfit setup_xcode_templates
- 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
@@ -205,7 +191,7 @@ Latest version should support
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
@@ -250,9 +236,8 @@ We can build, test package using the Commands available for the Swift Package Ma
---
# XCFit Swift Framework : Protocol Oriented BDD+ Page Object + Pre-Defined Steps
## Protocol Oriented BDD
# XCFit Swift Framework : Protocol Oriented BDD
## Protocol Oriented BDD(Recommended)
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/)
@@ -270,65 +255,24 @@ XCFit template supports Protocol Oriented BDD. Swift is a protocol oriented lang
### 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)
## 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
* **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.
## Getting XCFit Framework for pre-defined BDD Style steps
@@ -340,24 +284,24 @@ Cocoapods is more automated than Carthage. We can create `Podfile` and add speci
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
```
@@ -370,24 +314,22 @@ $ pod install
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.
@@ -407,19 +349,65 @@ and add the paths to the frameworks you want to use under “Input Files”, e.g
$(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
@@ -429,7 +417,6 @@ You will get access to lots of predefined BDD style human readable steps. It's n
**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
@@ -445,7 +432,6 @@ This will create template Fastfile with all the required lanes. You can replace
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)
---
@@ -543,8 +529,6 @@ Now close the existing Xcode session and Xcode Workspace `.xcworkspace` next tim
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
@@ -573,8 +557,6 @@ This will chekcout and build XCFit and Cucumberish frameworks inside the `Cartha
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.
@@ -700,8 +682,6 @@ Now you should be able to build an “Acceptance Tests” target. Once, build is
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.
@@ -758,11 +738,6 @@ Big Thanks to
Shashikant86, shashikant.jagtap@icloud.com
# TODO
* Add More Step Definitions for Cucumberish Projects
* Improve Swift Package with additional XCUI test helpers
# LICENSE
View
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'XCFit'
s.version = '6.1.0'
s.version = '7.0.0'
s.summary = 'Full Stack BDD for iOS and macOS Apps with Swift, Xcode using XCUITest, Cucumberish, FitNesse and friends.'
s.description = <<-DESC
View
@@ -3,7 +3,7 @@
require 'fileutils'
require 'tempfile'
VERSION = "6.1.0"
VERSION = "7.0.0"
@root_dir = File.expand_path('~')
@root_lib_dir = File.join(@root_dir, 'Library')
View
@@ -1,3 +1,3 @@
module XCFit
VERSION = "6.1.0"
VERSION = "7.0.0"
end

0 comments on commit cb10d32

Please sign in to comment.