README.md in xcfit-4.0.9 vs README.md in xcfit-5.0.0

- old
+ new

@@ -32,19 +32,19 @@ # XCFit Features *** - You can now write Given When Then (Gherkin), Predefined BDD Steps and Decision Table in Xcode. In Short, you can do BDD in Xcode for your iOS app. - XCFit supports Swift so no need to use other languages like Ruby, Java, Python to write acceptance and UI tests for iOS. - - XCFit provides automated Xcode Target Templates for Cucumberish, Fitnesse and Page Object Pattern(XCUI) targets which reduce hectic Xcode configuration steps. It also arrange code in Xcode groups. + - XCFit provides automated Xcode Target Templates for Protocol Oriented BDD, Page Object Pattern, Cucumberish, Fitnesse and Page Object Pattern(XCUI) targets which reduce hectic Xcode configuration steps. It also arrange code in Xcode groups. - XCFit will setup Xcode Templates with skeleton code and provide BDD Style Steps with Swift Framework which is available on Cocoapods, Carthage and Swift Package Manager. ### XCFIT & Other Frameworks - * **XCFit Swift Framework with Pre-defined BDD Steps and Page Object Pattern Templates** + * **XCFit Swift Framework with Pre-defined BDD Steps, Protocol & Page Object Templates** - XCFit setup [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html) for Apple's [XCUI Test](https://developer.apple.com/videos/play/wwdc2015/406/) using 'XCUI POM Test Bundle' Templates. We can get pre-defined BDD steps by using XCFit Swift Framework from [CocoaPods](http://cocoadocs.org/docsets/XCFit), Carthage and Swift Package Manager. + XCFit provides templates for Protocol Oriented BDD using 'Protocol BDD Bundle' and [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html) for Apple's [XCUI Test](https://developer.apple.com/videos/play/wwdc2015/406/) using 'XCUI POM Test Bundle' Templates. We can get pre-defined BDD steps by using XCFit Swift Framework from [CocoaPods](http://cocoadocs.org/docsets/XCFit), Carthage and Swift Package Manager. * **Cucumberish BDD Framework and Cucucmber Style Xcode Templates(Optional Objective-C)** XCFit setup [Cucumber](https://cucumber.io) style BDD framework with "[Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) UI Test Bundle' Templates. * **Fitnesse Acceptance Tests for iOS using OCSlim Project (Optional Objective-C)** @@ -154,67 +154,51 @@ - This will add couple of templates to your Xcode for iOS and macOS 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 Cucumberish UI and Fitnesse Acceptance Tests. XCUI POM, Fitnesse Acceptance Unit Test bundles. As shown -![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Xcode8-Templates.png) +![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. ### Cocoapods -Cocoapods is more automated than Carthage. We can create `Podfile` and add specific dependency for the target. We can install XCFit Cocoapods depending on Swift verson we are using -* **Swift 3.0.2** +#### Use XCFit Template Podfile -Cocoapods is more automated than Carthage. We can 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. -```ruby - target '$_YOUR__TARGET' do - pod 'XCFit', :git => 'https://github.com/Shashikant86/XCFit.git', :tag => '3.0.0' - end -``` -This will doownload Cocoapods supporting Swift 3.0.2 + $ xcfit setup_xcfit_podfile -* **Swift 3.1** +This will create a Podfile, you need to replace your target names as required. -You can doenload latest version 4.0.0 to work with Swift 3.1 +#### Manual Cocoapods Installtion +We can install XCFit Cocoapods depending on Swift version we are using +Latest version should support + ```ruby target '$_YOUR__TARGET' do pod 'XCFit' end ``` +Now that, we have `Podfile` setup, we can install dependencies using command -Same way we can get 'Cucumberish' and 'OCSlim' for the specific target. - ```sh $ pod install ``` You need to close the existing Xcode session and Xcode Workspace .xcworkspace next time. ### 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 +You can get latest tag t work with Swift 3.1 then `Cartfile` can have following -* **Swift 3.0.2** - -Add the following to `Cartfile` to get Swift 3.0.2 compatable source - - github "Shashikant86/XCFit" "3.0.0" - - -* **Swift 3.1** - -You can get lates tag t work with Swift 3.1 then `Cartfile` can have following - github "Shashikant86/XCFit" - - Now, we can fetch and build Carthage Dependencies using following command. $ carthage update --platform iOS This will checkout and build XCFit frameworks then we can manually drag those frameworks in the `Build Phases` of the test targets. This is explained in details in the later section. @@ -234,22 +218,22 @@ ``` Now we can use fetch XCFit using $ swift package fetch -We can build, test package using the commnds avavilable for the Swift Package Manager. +We can build, test package using the Commands available for the Swift Package Manager. --- # XCFit Swift Framework : XCUI Protocol Oriented, Page Object Pattern + Pre-Defined Steps ## Protocol Oriented BDD -XCFit template supports Protocol Oriented BDD. Swift is a protocol oriented language and wedon't want to miss the point of Protocol, Extensions and Enums. To setup template +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 -- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target +- From Xcode, create a new app(Or use existing app) and select File ---> New ----> Target - Now Select 'XCFit' for iOS app and Click on 'Protocol Oriented BDD Bundle' - Once Clicked 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. @@ -319,25 +303,30 @@ ## 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** -Cocoapods is more automated than Carthage. We can create `Podfile` and add specific dependency for the target + 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' end ``` This will doownload Cocoapods supporting Swift 3.0.2 * **Swift 3.1** -You can doenload latest version 4.0.0 to work with Swift 3.1 +You can doenload latest version 5.0.0 to work with Swift 3.1 ```ruby target '$_YOUR__TARGET' do pod 'XCFit' end @@ -365,13 +354,13 @@ github "Shashikant86/XCFit" "3.0.0" * **Swift 3.1** -You can get lates tag t work with Swift 3.1 then `Cartfile` can have following +You can get latest tag will work with Swift 3.1 then `Cartfile` can have following - github "Shashikant86/XCFit" "4.0.0" + github "Shashikant86/XCFit" "5.0.0" Now fetch dependency and build XCFit using. @@ -395,12 +384,20 @@ 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 base class to `XCFit`. There are plenty of Pre-Defined BDD Style Stpes available [here](https://github.com/Shashikant86/XCFit/blob/master/Pre-Defined_Steps/XCFit_Predefined_Steps.md). You can use prefined steps wherever they make sense however it's fairly esasy to write your own. +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. + +#### Using Steps in Page Object Pattern + +You can simply import `XCFit` inside the test class and extend it to XCFit + Your test will read something like this: ``` import XCTest import XCFit @@ -424,17 +421,32 @@ ``` -You will get access to lots of predefined BDD style human redable steps. It's not mandatory to use those steps unless you wish. +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 + + + $ xcfit setup_xcfit_fastfile + +This will create template Fastfile with all the required lanes. You can replace the YOUR_SCHEME, WORKSPACE and other variables as required. We can then run + + $ fastlane xcfit + +This will run all our tests using Fastlane that will be easy to plug it with any CI server. + + --- + # Setting Cucumberish BDD Scenarios in Xcode ## Setup 'iOS UI Cucumberish Test Bundle' Target