xcfit 2.0.4 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -9
- data/Docs/InitialVersion.md +340 -0
- data/Package.swift +5 -0
- data/README.md +348 -145
- data/XCFit.gemspec +1 -1
- data/XCFit.podspec +17 -9
- data/XCFit/Classes/Cucumberish/Core/CCIBlockDefinitions.h +400 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIFeaturesManager.h +72 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIFeaturesManager.m +141 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.h +51 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.m +245 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIArgument.h +62 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIArgument.m +117 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIAroundHock.h +37 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIAroundHock.m +37 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIBackground.h +46 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIBackground.m +117 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIExample.h +89 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIExample.m +128 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIFeature.h +49 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIFeature.m +174 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIHock.h +36 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIHock.m +34 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCILocation.h +61 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCILocation.m +91 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.h +97 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.m +224 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStep.h +85 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStep.m +98 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStepDefinition.h +43 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStepDefinition.m +65 -0
- data/XCFit/Classes/Cucumberish/Cucumberish.h +133 -0
- data/XCFit/Classes/Cucumberish/Cucumberish.m +604 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstBuilder.h +15 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstBuilder.m +312 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstNode.h +20 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstNode.m +79 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHBackground.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHBackground.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHComment.h +11 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHComment.m +27 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDataTable.h +14 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDataTable.m +30 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDocString.h +14 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDocString.m +29 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHExamples.h +24 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHExamples.m +49 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHFeature.h +24 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHFeature.m +50 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialect.h +25 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialect.m +64 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProvider.h +9 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProvider.m +124 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProviderProtocol.h +10 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageConstants.h +9 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageConstants.m +10 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageSetting.h +17 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageSetting.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLine.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLine.m +179 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineProtocol.h +64 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineSpan.h +9 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineSpan.m +26 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasDescriptionProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasLocationProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasRowsProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasStepsProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasTagsProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHLocation.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHLocation.m +41 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHNode.h +4 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHNode.m +5 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser+Extensions.h +10 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser+Extensions.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser.h +132 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser.m +2735 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParserException.h +55 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParserException.m +192 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenario.h +14 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenario.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition.h +23 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition.m +41 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition_Private.h +6 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioOutline.h +15 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioOutline.m +26 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStep.h +16 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStep.m +35 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStepArgument.h +4 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStepArgument.m +5 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableCell.h +13 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableCell.m +28 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableRow.h +13 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableRow.m +29 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTag.h +13 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTag.m +28 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHToken.h +26 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHToken.m +50 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenMatcher.h +29 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenMatcher.m +283 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenScanner.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenScanner.m +59 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/NSString+Trim.h +7 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/NSString+Trim.m +28 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/gherkin-languages.json +2969 -0
- data/XCFit/Classes/Cucumberish/Utils/NSArray+Hashes.h +24 -0
- data/XCFit/Classes/Cucumberish/Utils/NSArray+Hashes.m +44 -0
- data/XCFit/Classes/Cucumberish/Utils/NSObject+Dictionary.h +7 -0
- data/XCFit/Classes/Cucumberish/Utils/NSObject+Dictionary.m +83 -0
- data/XCFit/Classes/Cucumberish/Utils/NSString+Formatter.h +32 -0
- data/XCFit/Classes/Cucumberish/Utils/NSString+Formatter.m +70 -0
- data/Xcode7-Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +13 -0
- data/Xcode7-Templates/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +11 -0
- data/lib/XCFit/version.rb +1 -1
- metadata +108 -38
- data/XCFit/Assets/.gitkeep +0 -0
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateInfo.plist +0 -22
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/___FILEBASENAME___.feature +0 -20
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/AcceptanceTests-Bridging-Header.h +0 -1
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/FixtureExample.swift +0 -31
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/SlimTables.h +0 -28
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateInfo.plist +0 -150
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -1
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -15
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateInfo.plist +0 -123
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -7
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.feature +0 -11
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +0 -14
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -17
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +0 -23
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +0 -123
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -7
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.feature +0 -11
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +0 -14
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -17
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +0 -25
- data/XCFit/Assets/XCFit/Mac Acceptance Tests.xctemplate/Empty.xib +0 -12
- data/XCFit/Assets/XCFit/Mac Acceptance Tests.xctemplate/TemplateInfo.plist +0 -54
- data/XCFit/Assets/XCFit/MacOS API Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
- data/XCFit/Assets/XCFit/MacOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
- data/XCFit/Assets/XCFit/iOS API Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
- data/XCFit/Assets/XCFit/iOS Acceptance Tests.xctemplate/TemplateInfo.plist +0 -52
- data/XCFit/Assets/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a6bc50869cd1436a9cc712aff3b0234a8a8bfd3
|
4
|
+
data.tar.gz: 729394f9e92ecde9f846910c9ff3661a57feeeb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad23c796e3fd0b06cc4721c63ced0e3bb9a3458d16cde23e2a0b3e4da19f0fc0766b94dea845c321dd53c9ef464c7cc1fc4e41d8f595b0564a12b26a56dee01f
|
7
|
+
data.tar.gz: e205e6da57c70d4347b98a534ef5aa564a9aeef8204a4cec7f1af3e2696a141cbff0a3a9b3d115d113a09578f21125d77a78131c4de433462250ca422d9f2d49
|
data/.travis.yml
CHANGED
@@ -5,15 +5,13 @@
|
|
5
5
|
osx_image: xcode7.3
|
6
6
|
language: objective-c
|
7
7
|
# cache: cocoapods
|
8
|
-
podfile:
|
9
|
-
|
10
|
-
|
11
|
-
- danger
|
12
|
-
# - pod install --project-directory=XCFitDemo
|
8
|
+
podfile: XCFit2Demo/Podfile
|
9
|
+
gemfile: XCFit2Demo/Gemfile
|
10
|
+
|
13
11
|
script:
|
14
|
-
- cd
|
12
|
+
- cd XCFit2Demo
|
15
13
|
- pwd
|
16
14
|
- set -o pipefail && xcodebuild -list
|
17
|
-
-
|
18
|
-
-
|
19
|
-
|
15
|
+
- bundle install
|
16
|
+
- echo "==========Now Running XCUI Cucumberish Tests==================="
|
17
|
+
- bundle exec fastlane xcfit_ui_test
|
@@ -0,0 +1,340 @@
|
|
1
|
+
[![CI Status](http://img.shields.io/travis/Shashikant86/XCFit.svg?style=flat)](https://travis-ci.org/Shashikant86/XCFit)
|
2
|
+
[![Version](https://img.shields.io/cocoapods/v/XCFit.svg?style=flat)](http://cocoapods.org/pods/XCFit)
|
3
|
+
[![License](https://img.shields.io/cocoapods/l/XCFit.svg?style=flat)](http://cocoapods.org/pods/XCFit)
|
4
|
+
[![Platform](https://img.shields.io/cocoapods/p/XCFit.svg?style=flat)](http://cocoapods.org/pods/XCFit)
|
5
|
+
|
6
|
+
# XCFit : Xcode 8 + Swift 3
|
7
|
+
|
8
|
+
#### 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).
|
9
|
+
|
10
|
+
### XCFit Features
|
11
|
+
***
|
12
|
+
- You can now write Given When Then and Decision Table in Xcode !! YAY.. Thanks to Cucumberish and OCSlimProject ! And XCFit automated them !!
|
13
|
+
- 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 !!
|
14
|
+
- XCFit provides Xcode Templates to create new Cucumberish and Fitnesse targets which reduce hectic Xcode configuration steps. It's all automated in XCFit
|
15
|
+
- One command to set all fully automated Xcode template for Cucumberish and Fitnesse targets
|
16
|
+
- New Template to create Gherkin Feature file in Xcode
|
17
|
+
- Automated [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) Setup in one command
|
18
|
+
- Enhanced [OCSlimProject](https://github.com/paulstringer/OCSlimProject) templates and automated Fitnesse download process.
|
19
|
+
- XCFit target templates are independent of native Xcode Test targets.
|
20
|
+
- We can stiil use Apple's brand new XCUI Testing framework. Its native Xcode implementation, No Appium, Calabash etc etc
|
21
|
+
- Setup Cucumberish and Fitnesse in Xcode within few minutes !!
|
22
|
+
|
23
|
+
***
|
24
|
+
|
25
|
+
### Xcode 7 Users
|
26
|
+
|
27
|
+
If you are still XCode 7 users then please follow [this](https://github.com/Shashikant86/XCFit/blob/master/Docs/xcdoe7swift2.md) link for documentation
|
28
|
+
|
29
|
+
|
30
|
+
### Quick Demo with Example App
|
31
|
+
|
32
|
+
You can clone the existing repo which has a demo app we can run Unit, Fitnesse and Cucumbertish Tests as XCTest
|
33
|
+
```
|
34
|
+
$ git clone https://github.com/Shashikant86/XCFit
|
35
|
+
$ cd XCFit/XCFitnesse
|
36
|
+
$ open XCFitnesse.xcworkspace
|
37
|
+
```
|
38
|
+
Run Unit, Fitnesse and Cucumberish test with Xcode. "cmd + U". We can execute it using Fastlane
|
39
|
+
|
40
|
+
|
41
|
+
```
|
42
|
+
$ bundle install
|
43
|
+
$ bundle exec fastlane xctest_fitnesse
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
Watch this animated GIF for the steps below.
|
48
|
+
|
49
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFitDemo.gif)
|
50
|
+
|
51
|
+
|
52
|
+
Big Thanks to
|
53
|
+
- [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!
|
54
|
+
- [OCSlimProject](https://github.com/paulstringer/OCSlimProject) : Provide Xcode Templates to enable BDD with Decision Tables using Fitnesse
|
55
|
+
|
56
|
+
XCFit automated configuration of these two guys.
|
57
|
+
|
58
|
+
### Version
|
59
|
+
CocoaPods -- [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit) : 0.1.0
|
60
|
+
|
61
|
+
RubyGems -- [xcfit-RubyGem](https://rubygems.org/gems/xcfit) : 2.0.1
|
62
|
+
|
63
|
+
### Tech & Software Requirements
|
64
|
+
|
65
|
+
XCFit uses a number of open source projects to work properly. You need to have following
|
66
|
+
|
67
|
+
Hardware : You must have Mac Operating System with OSX/MacOS version > 10.9
|
68
|
+
|
69
|
+
Software:
|
70
|
+
* [Ruby](https://www.ruby-lang.org/en/) - Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X
|
71
|
+
* [Xcode8](https://developer.apple.com/xcode/) - Ideally Xcode 8
|
72
|
+
* [RubyGems](https://rubygems.org/) - RubyGem with [Cocoapods](https://cocoapods.org/) installed
|
73
|
+
* [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.
|
74
|
+
* NodeJS and iOS-Sim
|
75
|
+
* Ruby Packages : Xcpretty, Fastlane(Optional), Rake, Bundler.. Install with 'gem install <package_name>'
|
76
|
+
|
77
|
+
|
78
|
+
### Installation
|
79
|
+
|
80
|
+
XCFit requires [RubyGems](https://rubygems.org/) to run.
|
81
|
+
|
82
|
+
You need Gulp installed globally:
|
83
|
+
|
84
|
+
|
85
|
+
$ gem install xcfit
|
86
|
+
|
87
|
+
Now you are good to get started with XCFit for now. Later we also need to install XCFit Pod.
|
88
|
+
|
89
|
+
# Usage
|
90
|
+
Now that you can execute 'xcfit' command from your terminal/iTerm etc etc. Example Output Looks like this :
|
91
|
+
|
92
|
+
```
|
93
|
+
$ xcfit
|
94
|
+
Tasks:
|
95
|
+
xcfit get_cucumberish VERSION # Downloads Cucumberish version and Create Features directory. You must execute this from Cucumberish Xcode Target directory
|
96
|
+
xcfit get_fitnesse # Download Fitnesse JAR file from Internet. You must execute this from Xcode Fitnesse Acceptance Test Xcode Target directory
|
97
|
+
xcfit help [TASK] # Describe available tasks or one specific task
|
98
|
+
xcfit set_xcode_templates # Generate All Xcode Templates for the Gherkin Feature Files & targets for Cucumberish and Fitnesse
|
99
|
+
xcfit version # Get the current version number
|
100
|
+
|
101
|
+
```
|
102
|
+
|
103
|
+
## Setup Xcode Templates
|
104
|
+
|
105
|
+
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 terminal
|
106
|
+
|
107
|
+
|
108
|
+
```sh
|
109
|
+
$ xcfit set_xcode_templates
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
- This will add couple of templates to your Xcode for iOS and macOS apps. In your app if you go to 'File--->New--->Target'
|
114
|
+
|
115
|
+
You will see new option for iOS and OSX i.e 'XCFit'. Once Clicked on it. You will see Cucumberish UI and Fitnesse Acceptance Tests targets. As shown
|
116
|
+
|
117
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/new_targets_xcode8.png)
|
118
|
+
|
119
|
+
- 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.
|
120
|
+
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.
|
121
|
+
|
122
|
+
- This script also set new file type in Xcode to create new Gherking feature file
|
123
|
+
|
124
|
+
## Setting up Cucumberish UI Target
|
125
|
+
|
126
|
+
Few Steps to setup BDD Styles in Xcode8
|
127
|
+
|
128
|
+
##### Add New Target for Cucumberish
|
129
|
+
|
130
|
+
- 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
|
131
|
+
|
132
|
+
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.
|
133
|
+
####### Link Target Application
|
134
|
+
The most important thing is link your target to application to test. Cucumberish target 'General' setting select 'Testing -> Target To Test' and configure scheme to add Cucumeerish UI target to Test
|
135
|
+
|
136
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/LinkTargetTestApp.png)
|
137
|
+
|
138
|
+
#### Cucumberish Page Object Pattern Directory Structure
|
139
|
+
|
140
|
+
Now that, you can observe that new target has nice directory structure following [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html)
|
141
|
+
|
142
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/DirectoryStructure.png)
|
143
|
+
|
144
|
+
##### Download Cucumberish in the target
|
145
|
+
|
146
|
+
This can be done in two ways. By directly downloading contents of "Cucumberish" directory into the target directory or using Cocoapods.
|
147
|
+
###### Using Direct Download with XCFit
|
148
|
+
- Now that you have to CD into the Cucumberish target directory .eg CucumberishUITests
|
149
|
+
|
150
|
+
```sh
|
151
|
+
$ cd $_YOUR_CUCUMBERISH_TARGET_DIR
|
152
|
+
$ xcfit get_cucumberish 1.0.0
|
153
|
+
```
|
154
|
+
This will download Cucumberish directory from version 1.0.0 and also create '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"
|
155
|
+
|
156
|
+
###### Using Cocoapods
|
157
|
+
|
158
|
+
- In your Podfile, add following Pod entry and update/install pod
|
159
|
+
|
160
|
+
```ruby
|
161
|
+
target '$_YOUR_CUCUMBERISH_TARGET' do
|
162
|
+
pod 'Cucumberish', :git => 'https://github.com/Ahmed-Ali/Cucumberish'
|
163
|
+
end
|
164
|
+
```
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
```sh
|
169
|
+
$ pod update
|
170
|
+
```
|
171
|
+
|
172
|
+
|
173
|
+
##### Create Cucumber Features - Gherkin
|
174
|
+
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
|
175
|
+
|
176
|
+
```
|
177
|
+
Feature: Demo App Feature
|
178
|
+
|
179
|
+
Scenario: Demo Scenario
|
180
|
+
|
181
|
+
Given the app is running
|
182
|
+
|
183
|
+
```
|
184
|
+
|
185
|
+
##### Add Target To Test
|
186
|
+
|
187
|
+
- Finally, Run Your Test from Cucumberish Target by Pressing 'CMD+U'
|
188
|
+
|
189
|
+
You are done !!
|
190
|
+
|
191
|
+
Look how easy it is !
|
192
|
+
|
193
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/POM_Cucumberish.gif)
|
194
|
+
|
195
|
+
|
196
|
+
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.
|
197
|
+
|
198
|
+
|
199
|
+
## Setting up Fitnesse Acceptance Target with XCTest
|
200
|
+
|
201
|
+
You can also setup Fitnesse Acceptance Tests but you need to use Cocoapods for this target.
|
202
|
+
|
203
|
+
You can find detailed blog post on [Dzone](https://dzone.com/articles/integrate-fitnesse-with-xctest-using-xcode8)
|
204
|
+
|
205
|
+
#### Add Acceptance and Acceptance Unit Test Target to Project
|
206
|
+
|
207
|
+
We have all the predefined targets for FitNesse. Just add “Acceptance Tests” target from the template and “AcceptanceUnitTests” target from the bundle. You will need “FitNesse Suite page name” to create this target but just put “OCSlimProjectExamplePage” there for now . Add your ‘AcceptanceTests’ target as a ‘Target Dependancy’ of this new target in Build Phases. This ensures that it the latest code has been built prior to the tests being run.
|
208
|
+
|
209
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/targets.gif)
|
210
|
+
|
211
|
+
#### Add Pod Dependencies
|
212
|
+
We need to create a “Podfile” at the root of the project with the following content.
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
target 'AcceptanceTests' do
|
216
|
+
pod 'OCSlimProject'
|
217
|
+
end
|
218
|
+
target 'AcceptanceUnitTests' do
|
219
|
+
pod 'OCSlimProjectTestBundleSupport'
|
220
|
+
end
|
221
|
+
```
|
222
|
+
|
223
|
+
Now, we can run ‘pod install’ at this stage and close the current Xcode session and open project workspace.
|
224
|
+
|
225
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/pod_install.gif)
|
226
|
+
|
227
|
+
#### Build Acceptance Tests Target
|
228
|
+
At this stage, we should be able to build the “Acceptance Tests” target. If you are using Xcode8, you might see some warning related to the Swift3 Syntax. Just Click on ‘Edit-> Convert-> To Current Swift Syntax
|
229
|
+
|
230
|
+
Now you should be able to build an “Acceptance Tests” target. Once, build is successful, you should see “LaunchFitnesse” script is generated in the root of the project. We can launch and execute the fitness test as shown below.
|
231
|
+
|
232
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/build_acceptace.gif)
|
233
|
+
|
234
|
+
#### Test AcceptanceUnitTests Target
|
235
|
+
|
236
|
+
Now if you select “AcceptanceUnitTarget” and press CMD+U.
|
237
|
+
|
238
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/RunXCUITest.gif)
|
239
|
+
|
240
|
+
|
241
|
+
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.
|
242
|
+
|
243
|
+
|
244
|
+
### Taking Control with Bundler, Fastlane, and Trainer
|
245
|
+
|
246
|
+
Now that , we have seen how to run FitNesse acceptance tests from Xcode but it’s a good idea to run it with Fastlane. We can also take control of version of Cocoapods and Fastlane by using Bundler. Let’s create a Gemfile at the root of the project with the following gem
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
source "https://rubygems.org"
|
250
|
+
gem 'cocoapods'
|
251
|
+
gem 'fastlane' plugins_path = File.join(File.dirname(__FILE__), '.', 'Pluginfile') eval(File.read(plugins_path), binding) if File.exist?(plugins_path
|
252
|
+
```
|
253
|
+
|
254
|
+
Let’s also create directory “fastlane” and make “Fastfile” with following content
|
255
|
+
|
256
|
+
```ruby
|
257
|
+
|
258
|
+
fastlane_version "1.104.0"
|
259
|
+
default_platform :ios
|
260
|
+
platform :ios do
|
261
|
+
before_all do
|
262
|
+
system "rm -rf ../test_reports/"
|
263
|
+
system "bundle install"
|
264
|
+
system "pod install"
|
265
|
+
system "bundle exec fastlane add_plugin trainer"
|
266
|
+
end
|
267
|
+
desc "Runs all the Unit tests and Fitnesse Aceptance Tests"
|
268
|
+
lane :xctest_fitnesse do
|
269
|
+
scan(scheme: "FitnesseXCTestDemo",
|
270
|
+
destination: 'platform=iOS Simulator,name=iPhone 7 Plus,OS=10.0',
|
271
|
+
output_directory: "test_reports/",
|
272
|
+
output_types: "html",
|
273
|
+
fail_build: false )
|
274
|
+
trainer(output_directory: "test_reports/trainer_report/")
|
275
|
+
end
|
276
|
+
end
|
277
|
+
```
|
278
|
+
|
279
|
+
Now we will create a “fastlane/PluginFile” to add “trainer” plugin.
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
gem 'fastlane-plugin-trainer'
|
283
|
+
|
284
|
+
```
|
285
|
+
|
286
|
+
After running “bundle install” we should be able to run those test from command line like this :
|
287
|
+
|
288
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/xcfitnesse.gif)
|
289
|
+
|
290
|
+
|
291
|
+
You can watch YouTube video of XCFTest-Fitnesse [here](https://www.youtube.com/watch?v=xqvy1vN87e8)
|
292
|
+
|
293
|
+
|
294
|
+
# Video Demo
|
295
|
+
|
296
|
+
### XCTest Fitnesse Demo
|
297
|
+
|
298
|
+
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/xqvy1vN87e8/0.jpg)](http://www.youtube.com/watch?v=xxqvy1vN87e8)
|
299
|
+
|
300
|
+
|
301
|
+
## Author
|
302
|
+
|
303
|
+
Shashikant86, shashikant.jagtap@icloud.com
|
304
|
+
|
305
|
+
# TODO
|
306
|
+
|
307
|
+
* Swift Implementation of Gherkin Parser
|
308
|
+
* Cocoapods free installation. Carthage or Swift Package Manager once ready
|
309
|
+
* Setting up XCFit on Apple's own CI Xcode Server
|
310
|
+
|
311
|
+
## LICENSE
|
312
|
+
|
313
|
+
Copyright © 2014 Shashikant Jagtap, http://shashikantjagtap.net
|
314
|
+
|
315
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
316
|
+
a copy of this software and associated documentation files (the
|
317
|
+
"Software"), to deal in the Software without restriction, including
|
318
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
319
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
320
|
+
permit persons to whom the Software is furnished to do so, subject to
|
321
|
+
the following conditions:
|
322
|
+
|
323
|
+
The above copyright notice and this permission notice shall be
|
324
|
+
included in all copies or substantial portions of the Software.
|
325
|
+
|
326
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
327
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
328
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
329
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
330
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
331
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
332
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
333
|
+
|
334
|
+
## Contributing
|
335
|
+
|
336
|
+
1. Fork it ( https://github.com/Shashikant86/XCFit/fork )
|
337
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
338
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
339
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
340
|
+
5. Create a new Pull Request
|
data/Package.swift
ADDED
data/README.md
CHANGED
@@ -3,106 +3,119 @@
|
|
3
3
|
[![License](https://img.shields.io/cocoapods/l/XCFit.svg?style=flat)](http://cocoapods.org/pods/XCFit)
|
4
4
|
[![Platform](https://img.shields.io/cocoapods/p/XCFit.svg?style=flat)](http://cocoapods.org/pods/XCFit)
|
5
5
|
|
6
|
-
# XCFit :
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
### XCFit
|
6
|
+
# XCFit : Full Stack BDD in Xcode
|
7
|
+
|
8
|
+
**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 level, 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), [CocoaPods](http://cocoadocs.org/docsets/XCFit) and Swift Package Manager.**
|
9
|
+
|
10
|
+
### XCFit 2.0 has just released !
|
11
|
+
|
12
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFit2Release.png)
|
13
|
+
|
14
|
+
* [XCFit : Full Stack BDD in Xcode](#xcfit--full-stack-bdd-in-xcode)
|
15
|
+
* [XCFit Features](#xcfit-features)
|
16
|
+
* [Tech & Software Requirements](#tech--software-requirements)
|
17
|
+
* [Installation](#installation)
|
18
|
+
* [Setup Xcode Templates](#setup-xcode-templates)
|
19
|
+
* [Setting Cucumberish BDD Scenarios in Xcode](#setting-cucumberish-bdd-scenarios-in-xcode)
|
20
|
+
* [XCUI Page Object Pattern](#xcui-page-object-pattern)
|
21
|
+
* [Fitnesse for iOS: Acceptance/Contract Tests](#fitnesse-for-ios-acceptancecontract-tests)
|
22
|
+
* [Continuous Integration Fastlane](#continuous-integration--fastlane)
|
23
|
+
* [XCFit: Swift Package Manager](#xcfit-swift-package-manager)
|
24
|
+
* [Quick Demo with Example App](#quick-demo-with-example-app)
|
25
|
+
* [Acknowledgements](#acknowledgements)
|
26
|
+
* [Author](#author)
|
27
|
+
* [TODO](#todo)
|
28
|
+
* [LICENSE](#license)
|
29
|
+
* [Contributing](#contributing)
|
30
|
+
|
31
|
+
# XCFit Features
|
11
32
|
***
|
12
|
-
- You can now write Given When Then and Decision Table in Xcode
|
13
|
-
- You can now write/Execute all your
|
14
|
-
- XCFit provides Xcode Templates
|
15
|
-
-
|
16
|
-
- New Template to create Gherkin Feature file in Xcode
|
17
|
-
- Automated [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) Setup in one command
|
18
|
-
- Enhanced [OCSlimProject](https://github.com/paulstringer/OCSlimProject) templates and automated Fitnesse download process.
|
19
|
-
- XCFit target templates are independent of native Xcode Test targets.
|
20
|
-
- We can stiil use Apple's brand new XCUI Testing framework. Its native Xcode implementation, No Appium, Calabash etc etc
|
21
|
-
- Setup Cucumberish and Fitnesse in Xcode within few minutes !!
|
33
|
+
- You can now write Given When Then (Gherkin) and Decision Table in Xcode. In Short, you can do BDD in Xcode for your iOS app.
|
34
|
+
- You can now write/Execute all your Acceptance 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 !!
|
35
|
+
- 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. All happens in one command
|
36
|
+
- XCFit will setup test frameworks within a minute and works for Xcode 8 and Xcode 7.
|
22
37
|
|
23
|
-
***
|
24
38
|
|
25
|
-
###
|
39
|
+
### XCFIT allows follwing frameworks
|
40
|
+
* **Cucumberish BDD Framework**
|
26
41
|
|
27
|
-
|
42
|
+
XCFit setup [Cucumber](https://cucumber.io) style BDD framework with "[Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) UI Test Bundle' Templates
|
43
|
+
* **Page Object Pattern for XCUI Test framework from Apple**
|
28
44
|
|
45
|
+
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
|
46
|
+
* **Fitnesse Acceptance Tests for iOS using OCSlim Project**
|
29
47
|
|
30
|
-
|
48
|
+
XCFit allows us to setup [Fitnesse](http://fitnesse.org/) style decision table test framework with [OCSlimProject](https://github.com/paulstringer/OCSlimProject) using 'Acceptance Tests Bundle' templates.
|
31
49
|
|
32
|
-
You can clone the existing repo which has a demo app we can run Unit, Fitnesse and Cucumbertish Tests as XCTest
|
33
|
-
```
|
34
|
-
$ git clone https://github.com/Shashikant86/XCFit
|
35
|
-
$ cd XCFit/XCFitnesse
|
36
|
-
$ open XCFitnesse.xcworkspace
|
37
|
-
```
|
38
|
-
Run Unit, Fitnesse and Cucumberish test with Xcode. "cmd + U". We can execute it using Fastlane
|
39
|
-
|
40
|
-
|
41
|
-
```
|
42
|
-
$ bundle install
|
43
|
-
$ bundle exec fastlane xctest_fitnesse
|
44
|
-
```
|
45
|
-
|
46
|
-
|
47
|
-
Watch this animated GIF for the steps below.
|
48
|
-
|
49
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFitDemo.gif)
|
50
50
|
|
51
|
+
### XCFit Available on
|
51
52
|
|
52
|
-
|
53
|
-
- [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!
|
54
|
-
- [OCSlimProject](https://github.com/paulstringer/OCSlimProject) : Provide Xcode Templates to enable BDD with Decision Tables using Fitnesse
|
55
|
-
|
56
|
-
XCFit automated configuration of these two guys.
|
53
|
+
* **CocoaPods** -- [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit) : BDD Style scenarios for iOS App
|
57
54
|
|
58
|
-
|
59
|
-
CocoaPods -- [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit) : 0.1.0
|
55
|
+
* **RubyGems** -- [xcfit-RubyGem](https://rubygems.org/gems/xcfit) : Automated Xcode Templates
|
60
56
|
|
61
|
-
|
57
|
+
* **Swift Package Manager** : 2.0.0 : XCUI Test Framework Helpers
|
62
58
|
|
63
|
-
|
59
|
+
# Tech & Software Requirements
|
64
60
|
|
65
61
|
XCFit uses a number of open source projects to work properly. You need to have following
|
66
62
|
|
67
|
-
Hardware
|
63
|
+
**Hardware**
|
68
64
|
|
69
|
-
|
70
|
-
* [Ruby](https://www.ruby-lang.org/en/) - Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X
|
71
|
-
* [Xcode8](https://developer.apple.com/xcode/) - Ideally Xcode 8
|
72
|
-
* [RubyGems](https://rubygems.org/) - RubyGem with [Cocoapods](https://cocoapods.org/) installed
|
73
|
-
* [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.
|
74
|
-
* NodeJS and iOS-Sim
|
75
|
-
* Ruby Packages : Xcpretty, Fastlane(Optional), Rake, Bundler.. Install with 'gem install <package_name>'
|
65
|
+
You must have Mac Operating System with OSX/MacOS version > 10.9
|
76
66
|
|
67
|
+
**Software**
|
77
68
|
|
78
|
-
|
69
|
+
* **[Ruby](https://www.ruby-lang.org/en/)**
|
70
|
+
- Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X. You can use system Ruby with sudo
|
71
|
+
* **[Xcode8](https://developer.apple.com/xcode/)**
|
72
|
+
- Ideally Xcode 8 but works on Xcode 7 as well.
|
73
|
+
* **[RubyGems](https://rubygems.org/)**
|
74
|
+
- RubyGem with [Cocoapods](https://cocoapods.org/) installed
|
75
|
+
* **[Curl on Mac](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/curl.1.html)**
|
76
|
+
- Might be pre-installed but worth double checking.
|
77
|
+
* **[iOS-Sim](https://www.npmjs.com/package/ios-sim)**
|
78
|
+
- Node Package required to launch iOS app for Fitnesse Acceptance tests.
|
79
|
+
* [**Java**](https://www.java.com/en/)
|
80
|
+
- Java should be installed on Mac, it is required for Fitnesse Acceptance Test
|
81
|
+
* **Ruby Packages(optional)**
|
82
|
+
- Xcpretty, Fastlane(Optional), Rake, Bundler etc
|
79
83
|
|
80
|
-
|
84
|
+
---
|
81
85
|
|
82
|
-
|
86
|
+
# Installation
|
83
87
|
|
88
|
+
## Install XCFit Gem
|
89
|
+
In order to get started, We need to install XCFit from [RubyGems](https://rubygems.org/). This will set our Xcode for BDD
|
84
90
|
|
85
|
-
|
91
|
+
$ gem install xcfit
|
86
92
|
|
87
|
-
|
93
|
+
You need to use with 'sudo' if you are using system (pre-installed) Ruby(2.0). XCFit gem will be used to set all the Xcode Templated for Xcode 8 as well Xcode 7
|
88
94
|
|
89
|
-
# Usage
|
90
95
|
Now that you can execute 'xcfit' command from your terminal/iTerm etc etc. Example Output Looks like this :
|
91
96
|
|
92
97
|
```
|
93
|
-
$
|
98
|
+
$xcfit
|
94
99
|
Tasks:
|
95
|
-
xcfit get_cucumberish VERSION
|
96
|
-
xcfit get_fitnesse
|
97
|
-
xcfit help [TASK]
|
98
|
-
xcfit
|
99
|
-
xcfit
|
100
|
-
|
100
|
+
xcfit get_cucumberish VERSION
|
101
|
+
xcfit get_fitnesse
|
102
|
+
xcfit help [TASK]
|
103
|
+
xcfit set_xcode7_templates
|
104
|
+
xcfit set_xcode_templates
|
101
105
|
```
|
102
106
|
|
103
|
-
## Setup Xcode Templates
|
104
107
|
|
105
|
-
|
108
|
+
## Install XCFit Cocoapod and Swift Package (Covered later)
|
109
|
+
|
110
|
+
Later, we need to install [XCFit](http://cocoadocs.org/docsets/XCFit) from CocoaPods to enable Cucumberish and Fitnesse test. We can also get XCFit from Swift Package Manager if we need to have additional helpers for the XCUI test framework.
|
111
|
+
|
112
|
+
---
|
113
|
+
|
114
|
+
# Setup Xcode Templates
|
115
|
+
|
116
|
+
In existing app or brand new app, we have to enable the Xcode templates for targets to speed up the things.
|
117
|
+
##### Xcode 8
|
118
|
+
To setup Templates for Xcode 8.
|
106
119
|
|
107
120
|
|
108
121
|
```sh
|
@@ -110,90 +123,245 @@ $ xcfit set_xcode_templates
|
|
110
123
|
|
111
124
|
```
|
112
125
|
|
126
|
+
##### Xcode 7
|
127
|
+
|
128
|
+
To setup Templates for Xcode 7.x.
|
129
|
+
|
130
|
+
|
131
|
+
```sh
|
132
|
+
$ xcfit set_xcode7_templates
|
133
|
+
|
134
|
+
```
|
135
|
+
|
113
136
|
- This will add couple of templates to your Xcode for iOS and macOS apps. In your app if you go to 'File--->New--->Target'
|
114
137
|
|
115
|
-
You will see new option for iOS
|
138
|
+
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
|
116
139
|
|
117
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/
|
140
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Xcode8-Templates.png)
|
118
141
|
|
119
|
-
|
120
|
-
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.
|
142
|
+
---
|
121
143
|
|
122
|
-
|
144
|
+
# Setting Cucumberish BDD Scenarios in Xcode
|
123
145
|
|
124
|
-
##
|
146
|
+
## Setup 'iOS UI Cucumberish Test Bundle' Target
|
125
147
|
|
126
|
-
|
148
|
+
- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
|
127
149
|
|
128
|
-
|
150
|
+
- Now Select 'XCFit' for iOS app and Click on 'Cucumberish UI Test Bundle'
|
129
151
|
|
130
|
-
-
|
152
|
+
- Once Clicked on the target e.g 'Cucumberish UI Test Bundle' Xcode will create UI testing target with all the required files with Bridging header for Cucumberish UI Testing. It create Page Object Pattern with all required files with screens, steps definitions and Cucumberish initialiser swift file.
|
131
153
|
|
132
|
-
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.
|
133
|
-
####### Link Target Application
|
134
|
-
The most important thing is link your target to application to test. Cucumberish target 'General' setting select 'Testing -> Target To Test' and configure scheme to add Cucumeerish UI target to Test
|
135
154
|
|
136
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/
|
155
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFit_CucumberishTemplates.gif)
|
137
156
|
|
138
|
-
|
157
|
+
### What's in the Cucumberish Template ?
|
139
158
|
|
140
|
-
|
159
|
+
* **YOUR_CUCUMBERISH_TARGET.swift**
|
141
160
|
|
142
|
-
|
161
|
+
This file is at the base of the target. This initiate Cucumberish for project. We need to register all step definitions in this file.
|
162
|
+
* **Screens**
|
143
163
|
|
144
|
-
|
164
|
+
This is groups where we can abstract logic of every screen in the app. Example file are 'HomeScreen.swift' and 'BaseScreen.swift'
|
145
165
|
|
146
|
-
|
147
|
-
|
148
|
-
|
166
|
+
* **Step_Definitions**
|
167
|
+
|
168
|
+
This groups has all the step definitions related to screen. Example file 'HomeScreenSteps.swift'. Once implemented we need to register it in the initialiser file mentioned above.
|
169
|
+
|
170
|
+
* **Common**
|
171
|
+
|
172
|
+
This group has common code like extensions and common steps. The example file 'CommonStepDefinitions.swift' has some steps that can be used in the feature file. It also has 'Hooks.swift' to ad cucumber hooks.
|
173
|
+
|
174
|
+
* **Supporting Files**
|
175
|
+
|
176
|
+
This groups all the Objective-C headers and Bridging headers needed to get Cucumberish working with Swift.
|
177
|
+
|
178
|
+
### What's not in the Cucumberish Template
|
179
|
+
|
180
|
+
* **Features Directory**
|
181
|
+
|
182
|
+
We don't have 'Features' directory in the template because it needs to have directory on the disk and should be added to Xcode as 'Folder Reference' not Group.
|
183
|
+
|
184
|
+
- Create a Direcory called "Feature"
|
185
|
+
|
186
|
+
- Now Add sample Gherkin 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
|
149
187
|
|
150
|
-
```sh
|
151
|
-
$ cd $_YOUR_CUCUMBERISH_TARGET_DIR
|
152
|
-
$ xcfit get_cucumberish 1.0.0
|
153
188
|
```
|
154
|
-
|
189
|
+
Feature: Demo App Feature
|
190
|
+
|
191
|
+
Scenario: Demo Scenario
|
192
|
+
|
193
|
+
Given the app is running
|
194
|
+
|
195
|
+
```
|
196
|
+
|
197
|
+
- Now Drag and Drop 'Features' directory to Xcode Cucumberish target
|
198
|
+
|
199
|
+
- Select only '**Create folder references**' Option. ** Do Not Select 'Create groups' Or 'Copy items if needed**'
|
200
|
+
|
201
|
+
Here is how to do it.
|
202
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/AddFeaturesDirectory.gif)
|
203
|
+
|
204
|
+
* **Cucumberish Header Files**
|
205
|
+
|
206
|
+
We still don't have content of [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish/tree/master/Cucumberish) to be included in our project.
|
207
|
+
|
208
|
+
### Getting Cucumberish into our Target
|
155
209
|
|
156
|
-
|
210
|
+
In order to get [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish/tree/master/Cucumberish) source content. There are few ways we can do that
|
157
211
|
|
158
|
-
-
|
212
|
+
- ***Adding XCFit CocoaPod to Project***
|
213
|
+
|
214
|
+
Create a 'Podfile' if you don't have already. In your Podfile, add following Pod entry and update/install pod
|
159
215
|
|
160
216
|
```ruby
|
161
217
|
target '$_YOUR_CUCUMBERISH_TARGET' do
|
162
|
-
pod '
|
163
|
-
end
|
218
|
+
pod 'XCFit'
|
219
|
+
end
|
164
220
|
```
|
165
221
|
|
166
222
|
|
167
223
|
|
168
224
|
```sh
|
169
|
-
$ pod
|
225
|
+
$ pod install
|
170
226
|
```
|
171
227
|
|
228
|
+
You can do that easily.
|
229
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/AddPod.gif)
|
230
|
+
|
231
|
+
Now close the existing Xcode session and Xcode Workspace next time.
|
232
|
+
|
233
|
+
> **Note** There is issue with Cocoapods when you have ``'use_frameworks!'``, it will not import header files and build will fail. If you are not using Frameworks in th Podfile then this approach is OK.
|
234
|
+
|
235
|
+
- ***Manually Copy Content of Cucumberish and Drag to Xcode - Prefered Way***
|
236
|
+
|
237
|
+
We can manually copy content of [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish/tree/master/Cucumberish) directory and drag to target as with option "**Create groups" and "Copy items if needed**".
|
238
|
+
|
239
|
+
Here is How to setup everything in a minute
|
240
|
+
|
241
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFitStartUp.gif)
|
242
|
+
|
243
|
+
- ***Use Carthage without build and drag the folder to target***
|
172
244
|
|
173
|
-
|
174
|
-
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
|
245
|
+
Create a `Cartfile ` with following Content
|
175
246
|
|
176
247
|
```
|
177
|
-
|
248
|
+
github "Ahmed-Ali/Cucumberish"
|
249
|
+
```
|
250
|
+
Now run Carthage wihtout build option.
|
251
|
+
|
252
|
+
$ carthage update --platform iOS --no-build
|
253
|
+
|
254
|
+
Now in the `Carthage/Checkout` directory has Cucumberish. Just add that to target or workspace.
|
178
255
|
|
179
|
-
|
256
|
+
Please choose one of the suitable option for you.
|
180
257
|
|
181
|
-
|
258
|
+
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.
|
259
|
+
and press 'CMD+U'
|
260
|
+
|
261
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/CucumberTest.gif)
|
262
|
+
|
263
|
+
Congratulations !! You have just ran your first Cucumber BDD Scenario in the Xcode. Now add your own :)
|
264
|
+
|
265
|
+
#### Create Separate Scheme if needed
|
266
|
+
|
267
|
+
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.
|
182
268
|
|
269
|
+
---
|
270
|
+
|
271
|
+
# XCUI Page Object Pattern
|
272
|
+
|
273
|
+
Now, we have seen that it's failrly easy to setup BDD Style tests with Cucumberish but some people don't want that overhead of adding extra layer of Gherkin. XCFit gives an option to use very polular [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html) with Apple's Xcode UI Testing framework.
|
274
|
+
|
275
|
+
## Setup 'XCUI POM Test bundle' Target
|
276
|
+
|
277
|
+
- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
|
278
|
+
|
279
|
+
- Now Select 'XCFit' for iOS app and Click on 'XCUI POM Test Bundle'
|
280
|
+
|
281
|
+
- 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.
|
282
|
+
|
283
|
+
- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
|
284
|
+
|
285
|
+
|
286
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCUIPOM.gif)
|
287
|
+
|
288
|
+
### What's in the XCUI POM Template ?
|
289
|
+
|
290
|
+
* **YOUR_CUCUMBERISH_TARGETPageObjectTests.swift**
|
291
|
+
|
292
|
+
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.
|
293
|
+
|
294
|
+
* **Screens**
|
295
|
+
|
296
|
+
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.
|
297
|
+
|
298
|
+
* **Sections**
|
299
|
+
|
300
|
+
This group has 'HomeElements.swift' class which stores all the locators of HomeScreen in enums. Sections are defined to store locators of the screen in the form of enums. Here are some samples we can store Images, Buttons and Static Texts of the HomeScreens. We can access those enums from anywhere from the Test methods or page objects.
|
301
|
+
|
302
|
+
* **Protocols**
|
303
|
+
|
304
|
+
Swift is protocol oriented language so feel to start with Protocol per screen. This group has 'HomeProtocol.swift' file where there is way to implement protocol oriented testing. Here is example of sample protocol for the homescreen. We can implement this protocol in the XCTest method as needed or we can write some extensions to support Testing.
|
305
|
+
|
306
|
+
* **Tests**
|
307
|
+
|
308
|
+
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.
|
309
|
+
|
310
|
+
* **TestBase**
|
311
|
+
|
312
|
+
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
|
313
|
+
|
314
|
+
|
315
|
+
---
|
316
|
+
|
317
|
+
# Fitnesse for iOS: Acceptance/Contract Tests
|
318
|
+
|
319
|
+
[Fitnesse](http://fitnesse.org/) is fully integrated standalone wiki and acceptance testing framework for BDD Style testing. As of now we have seen Cucumber and Page Object pattern test frameworks. If you really wanted to get more information about Fitnnese for iOS, please follow documentation on [OCSlim](http://paulstringer.github.io/OCSlimProject/) project. XCFit adopted the framework as dependeny to make it full stack BDD. We will cover basic setup as part of this document.
|
320
|
+
|
321
|
+
## Setup 'Acceptance Test' Target template
|
322
|
+
|
323
|
+
- From Xcode, create a new app(Or use existing app) and selct File ---> New ----> Target
|
324
|
+
|
325
|
+
- Now Select 'XCFit' for iOS app and Click on 'iOS Acceptance Tests '
|
326
|
+
|
327
|
+
- Once Clicked on the target e.g 'OS Acceptance Tests' Xcode will create new target with all required files and groups for Acceptance testing
|
328
|
+
|
329
|
+
- Select 'Acceptance Test' Scheme from Xcode and try to build
|
330
|
+
|
331
|
+
- The build will fail as we need fix some **Swift3** related issue as well as we need to add **XCFit/OCSlimProject** Pod to the to the podfile.
|
332
|
+
|
333
|
+
** Watch it so far**
|
334
|
+
|
335
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/AcceptanceTestsTarget.gif)
|
336
|
+
|
337
|
+
1. To Fix Swift Issue : Just Click on ‘Edit-> Convert-> To Current Swift Syntax
|
338
|
+
2. To Fix Pod issue : Add 'XCFit' for AcceptanceTests target
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
target 'AcceptanceTests' do
|
342
|
+
pod 'OCSlimProject'
|
343
|
+
end
|
344
|
+
```
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
```sh
|
349
|
+
$ pod install
|
183
350
|
```
|
184
351
|
|
185
|
-
|
352
|
+
Now, You should be able to build 'Acceptance Tests" target.
|
186
353
|
|
187
|
-
|
354
|
+
You should also note that, the script 'Launch Fitnesse' has been created in the base of the project. Launch the fitness by exucuting that script from command line
|
188
355
|
|
189
|
-
|
356
|
+
$ sh Launch Fitnesse
|
190
357
|
|
191
|
-
|
358
|
+
The browser will popup with example test. You should be able to excute that suite and see then running and passing
|
192
359
|
|
193
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/
|
360
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/AcceptanceTestsTargetPod.gif)
|
194
361
|
|
362
|
+
If you get any errors at this stage, please confirm that you have Java as well as ios-sim node package installed.
|
195
363
|
|
196
|
-
|
364
|
+
So, Congratulations again.. You have just executed Fitnesse test fro browser which is talking to your app.
|
197
365
|
|
198
366
|
|
199
367
|
## Setting up Fitnesse Acceptance Target with XCTest
|
@@ -206,48 +374,41 @@ You can find detailed blog post on [Dzone](https://dzone.com/articles/integrate-
|
|
206
374
|
|
207
375
|
We have all the predefined targets for FitNesse. Just add “Acceptance Tests” target from the template and “AcceptanceUnitTests” target from the bundle. You will need “FitNesse Suite page name” to create this target but just put “OCSlimProjectExamplePage” there for now . Add your ‘AcceptanceTests’ target as a ‘Target Dependancy’ of this new target in Build Phases. This ensures that it the latest code has been built prior to the tests being run.
|
208
376
|
|
209
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/targets.gif)
|
210
377
|
|
211
378
|
#### Add Pod Dependencies
|
212
379
|
We need to create a “Podfile” at the root of the project with the following content.
|
213
380
|
|
214
|
-
```ruby
|
215
|
-
target 'AcceptanceTests' do
|
216
|
-
pod 'OCSlimProject'
|
217
|
-
end
|
381
|
+
```ruby
|
218
382
|
target 'AcceptanceUnitTests' do
|
219
|
-
pod 'OCSlimProjectTestBundleSupport'
|
383
|
+
pod 'OCSlimProjectTestBundleSupport'
|
220
384
|
end
|
221
385
|
```
|
222
386
|
|
223
387
|
Now, we can run ‘pod install’ at this stage and close the current Xcode session and open project workspace.
|
224
388
|
|
225
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/pod_install.gif)
|
226
|
-
|
227
389
|
#### Build Acceptance Tests Target
|
228
390
|
At this stage, we should be able to build the “Acceptance Tests” target. If you are using Xcode8, you might see some warning related to the Swift3 Syntax. Just Click on ‘Edit-> Convert-> To Current Swift Syntax
|
229
391
|
|
230
392
|
Now you should be able to build an “Acceptance Tests” target. Once, build is successful, you should see “LaunchFitnesse” script is generated in the root of the project. We can launch and execute the fitness test as shown below.
|
231
393
|
|
232
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/build_acceptace.gif)
|
233
394
|
|
234
395
|
#### Test AcceptanceUnitTests Target
|
235
396
|
|
236
397
|
Now if you select “AcceptanceUnitTarget” and press CMD+U.
|
237
398
|
|
238
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/
|
399
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/FitnesseXCTest.gif)
|
239
400
|
|
240
401
|
|
241
402
|
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.
|
242
403
|
|
243
404
|
|
244
|
-
|
405
|
+
# Continuous Integration + Fastlane
|
245
406
|
|
246
|
-
Now that , we have seen how to run FitNesse acceptance tests from Xcode but it’s a good idea to run it with Fastlane. We can also take control of version of Cocoapods and Fastlane by using Bundler. Let’s create a Gemfile at the root of the project with the following gem
|
407
|
+
Now that , we have seen how to run Cucumberish, XCUIPOM, FitNesse acceptance tests from Xcode but it’s a good idea to run it with Fastlane. We can also take control of version of Cocoapods and Fastlane by using Bundler. Let’s create a Gemfile at the root of the project with the following gem
|
247
408
|
|
248
409
|
```ruby
|
249
410
|
source "https://rubygems.org"
|
250
|
-
gem 'cocoapods'
|
411
|
+
gem 'cocoapods'
|
251
412
|
gem 'fastlane' plugins_path = File.join(File.dirname(__FILE__), '.', 'Pluginfile') eval(File.read(plugins_path), binding) if File.exist?(plugins_path
|
252
413
|
```
|
253
414
|
|
@@ -264,51 +425,93 @@ before_all do
|
|
264
425
|
system "pod install"
|
265
426
|
system "bundle exec fastlane add_plugin trainer"
|
266
427
|
end
|
267
|
-
desc "Runs all the
|
268
|
-
lane :
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
428
|
+
desc "Runs all the XCUI POM, Cucumberish tests"
|
429
|
+
lane :xcfit_ui_test do
|
430
|
+
scan(
|
431
|
+
scheme: "XCFit2Demo",
|
432
|
+
destination: 'platform=iOS Simulator,name=iPhone 7 Plus,OS=10.0',
|
433
|
+
output_directory: "test_reports/",
|
434
|
+
output_types: "html",
|
435
|
+
fail_build: false
|
436
|
+
)
|
437
|
+
end
|
438
|
+
|
439
|
+
desc "Runs Fitnesse Tests"
|
440
|
+
lane :fitnesse do
|
441
|
+
scan(
|
442
|
+
scheme: "AcceptanceUnitTests",
|
443
|
+
destination: 'platform=iOS Simulator,name=iPhone 7 Plus,OS=10.0',
|
444
|
+
output_directory: "test_reports/",
|
445
|
+
output_types: "html",
|
446
|
+
fail_build: false
|
447
|
+
)
|
448
|
+
end
|
276
449
|
end
|
277
450
|
```
|
278
451
|
|
279
|
-
|
452
|
+
After running “bundle install” we should be able to run those test from command line like this :
|
453
|
+
|
454
|
+
$ bundle exec fastlane xcfit_ui_test
|
455
|
+
|
456
|
+
|
457
|
+
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/FastlaneXCFit.gif)
|
458
|
+
|
459
|
+
Once that done. We can have clear HTML reports genearted
|
280
460
|
|
281
|
-
|
282
|
-
|
461
|
+
|
462
|
+
# XCFit: Swift Package Manager
|
463
|
+
|
464
|
+
XCFit will be having full on support for XCUI Test helpers so that we can use Apple's XCUI Test Framework painless to use. There is [sample swift package](https://github.com/Shashikant86/XCFitDemoSwiftPackage) on Github to test XCFit
|
465
|
+
Full Documetation and API implementation still in progress. You can grab it like this
|
283
466
|
|
284
467
|
```
|
468
|
+
import PackageDescription
|
469
|
+
|
470
|
+
let package = Package(
|
471
|
+
name: "XCFit",
|
472
|
+
dependencies: [
|
473
|
+
.Package(url: "https://github.com/Shashikant86/XCFit.git", majorVersion: 2),
|
474
|
+
]
|
475
|
+
)
|
476
|
+
```
|
285
477
|
|
286
|
-
After running “bundle install” we should be able to run those test from command line like this :
|
287
478
|
|
288
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/xcfitnesse.gif)
|
289
479
|
|
480
|
+
# Quick Demo with Example App
|
481
|
+
|
482
|
+
You can clone the existing repo which has a demo app we can run Unit, Fitnesse and Cucumbertish Tests as XCTest
|
483
|
+
```
|
484
|
+
$ git clone https://github.com/Shashikant86/XCFit
|
485
|
+
$ cd XCFit/XCFit2Demo
|
486
|
+
$ open XCFit2Demo.xcworkspace
|
487
|
+
```
|
488
|
+
Run Unit, Fitnesse and Cucumberish test with Xcode. "cmd + U". We can execute it using Fastlane
|
290
489
|
|
291
|
-
You can watch YouTube video of XCFTest-Fitnesse [here](https://www.youtube.com/watch?v=xqvy1vN87e8)
|
292
490
|
|
491
|
+
```
|
492
|
+
$ bundle install
|
493
|
+
$ bundle exec fastlane xcfit_ui_test
|
494
|
+
```
|
293
495
|
|
294
|
-
# Video Demo
|
295
496
|
|
296
|
-
|
497
|
+
# Acknowledgements
|
297
498
|
|
298
|
-
|
499
|
+
Big Thanks to
|
500
|
+
- [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!
|
501
|
+
- [OCSlimProject](https://github.com/paulstringer/OCSlimProject) : Provide Xcode Templates to enable BDD with Decision Tables using Fitnesse
|
299
502
|
|
300
503
|
|
301
|
-
|
504
|
+
# Author
|
302
505
|
|
303
506
|
Shashikant86, shashikant.jagtap@icloud.com
|
304
507
|
|
305
508
|
# TODO
|
306
509
|
|
307
|
-
*
|
308
|
-
*
|
510
|
+
* Add More Step Definitions for Cucumberish Projects
|
511
|
+
* Improve Swift Package with additional XCUI test helpers
|
309
512
|
* Setting up XCFit on Apple's own CI Xcode Server
|
310
513
|
|
311
|
-
|
514
|
+
# LICENSE
|
312
515
|
|
313
516
|
Copyright © 2014 Shashikant Jagtap, http://shashikantjagtap.net
|
314
517
|
|
@@ -331,7 +534,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
331
534
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
332
535
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
333
536
|
|
334
|
-
|
537
|
+
# Contributing
|
335
538
|
|
336
539
|
1. Fork it ( https://github.com/Shashikant86/XCFit/fork )
|
337
540
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|