xcfit 3.1.7 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md +2 -2
- data/README.md +119 -46
- data/XCFit.gemspec +1 -1
- data/XCFit.podspec +1 -1
- data/homebrew/xcfit +1 -1
- data/lib/XCFit/version.rb +1 -1
- metadata +1 -30
- data/XCFit4Demo/Cartfile +0 -1
- data/XCFit4Demo/Cartfile.resolved +0 -2
- data/XCFit4Demo/XCFit4Demo/AppDelegate.swift +0 -46
- data/XCFit4Demo/XCFit4Demo/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -38
- data/XCFit4Demo/XCFit4Demo/Base.lproj/LaunchScreen.storyboard +0 -27
- data/XCFit4Demo/XCFit4Demo/Base.lproj/Main.storyboard +0 -53
- data/XCFit4Demo/XCFit4Demo/Info.plist +0 -38
- data/XCFit4Demo/XCFit4Demo/ViewController.swift +0 -33
- data/XCFit4Demo/XCFit4Demo.xcodeproj/project.pbxproj +0 -864
- data/XCFit4Demo/XCFit4Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/XCFit4Demo/XCFit4DemoCucumberTests/BaseScreen.swift +0 -21
- data/XCFit4Demo/XCFit4DemoCucumberTests/CommonStepDefinitions.swift +0 -89
- data/XCFit4Demo/XCFit4DemoCucumberTests/Extensions.swift +0 -57
- data/XCFit4Demo/XCFit4DemoCucumberTests/Features/demo.feature +0 -8
- data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreen.swift +0 -24
- data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreenSteps.swift +0 -29
- data/XCFit4Demo/XCFit4DemoCucumberTests/Hooks.swift +0 -27
- data/XCFit4Demo/XCFit4DemoCucumberTests/Info.plist +0 -22
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests-Bridging-Header.h +0 -17
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.h +0 -22
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.m +0 -27
- data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.swift +0 -39
- data/XCFit4Demo/XCFit4DemoTests/Info.plist +0 -22
- data/XCFit4Demo/XCFit4DemoTests/XCFit4DemoTests.swift +0 -36
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Extensions.swift +0 -60
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreen.swift +0 -23
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreenTest.swift +0 -28
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Info.plist +0 -22
- data/XCFit4Demo/XCFit4DemoXCUIPoMTests/XCFit4DemoXCUIPoMTestsTestBase.swift +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 879281ccd2515f263e2753ad8ade3e963a2cd081
|
4
|
+
data.tar.gz: f91ff78cf2d2fa7be831cc89d48d9e178addb3e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce0845512600362a4589845aa50da17eb7870ac8c227af1185fe883baec7cb229a976c95449e7910afeaeaf5c3327e9ea69ba4eaf2a76e23d4ae21bc356c43de
|
7
|
+
data.tar.gz: e67c4bda1b215041735b79281e99e7a6fd4ed42a0999aa5c9fc7e9b8a628ff192103facad573661dd07200cd94c2366ae36f5d5465adfba81583c24c38fb6226
|
@@ -7,8 +7,8 @@ There are some predefined BDD Style Steps for the Cucumberish
|
|
7
7
|
|
8
8
|
Given the app is running
|
9
9
|
Given/When/Then/ I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view|field|textView
|
10
|
-
|
11
|
-
Given/When/Then/ I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view) ([1-9]{1}) time(?:s)
|
10
|
+
Given/When/Then/ I double tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view|field|textView
|
11
|
+
Given/When/Then/ I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view) ([1-9]{1}) time(?:s)
|
12
12
|
Given/When/Then/ I write \"([^\\\"]*)\" (?:into|in) (?:the )?\"([^\\\"]*)\" (field|text view)
|
13
13
|
Given/When/Then/ I switch (on|off) the \"([^\\\"]*)\" switch
|
14
14
|
Given/When/Then/ I launched an App
|
data/README.md
CHANGED
@@ -5,21 +5,23 @@
|
|
5
5
|
|
6
6
|
# XCFit : Full Stack iOS BDD in Xcode
|
7
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)
|
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) Integration Tests) is a full stack Xcode BDD framework for iOS apps written in [Swift](https://swift.org). XCFit allows us to write BDD Style API/Contract 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 XCFit and Cucumberish. XCFit provides automated Xcode templates to setup skeleton of BDD which are available on [Homebrew](http://brew.sh), [RubyGem](https://rubygems.org/gems/xcfit). XCFit also packaged asSwift Framework to provide pre-defined BDD Steps written in Swift. XCFit Swift framework is available on [CocoaPods](http://cocoadocs.org/docsets/XCFit), Carthage and Swift Package Manager.**
|
9
9
|
|
10
10
|
### XCFit
|
11
11
|
|
12
12
|
|
13
|
-
* [XCFit : Full Stack BDD in Xcode](#xcfit--full-stack-bdd-in-xcode)
|
13
|
+
* [XCFit : Full Stack iOS BDD in Xcode](#xcfit--full-stack-bdd-in-xcode)
|
14
14
|
* [XCFit Features](#xcfit-features)
|
15
15
|
* [Tech & Software Requirements](#tech--software-requirements)
|
16
16
|
* [Installation](#installation)
|
17
17
|
* [XCFit Swift Framework](#xcfit-swift-framework--xcui-page-object-pattern--pre-defined-steps)
|
18
18
|
* [Setting Cucumberish BDD Scenarios in Xcode](#setting-cucumberish-bdd-scenarios-in-xcode)
|
19
|
+
* [Advide on using pre-defined BDD Steps](#advise-on-using-pre-defines-bdd-style-steps)
|
19
20
|
* [Fitnesse for iOS: Acceptance/Contract Tests](#fitnesse-for-ios-acceptancecontract-tests)
|
20
21
|
* [Continuous Integration with Xcode Server](#continuous-integration-with-xcode-server)
|
21
22
|
* [XCFit: Swift Package Manager](#xcfit-swift-package-manager)
|
22
23
|
* [Quick Demo with Example App](#quick-demo-with-example-app)
|
24
|
+
* [Step By Step Video Demo](#step-by-step-video-demo)
|
23
25
|
* [Acknowledgements](#acknowledgements)
|
24
26
|
* [Author](#author)
|
25
27
|
* [TODO](#todo)
|
@@ -29,34 +31,34 @@
|
|
29
31
|
# XCFit Features
|
30
32
|
***
|
31
33
|
- 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.
|
32
|
-
-
|
34
|
+
- XCFit supports Swift so no need to use other languages like Ruby, Java, Python to write acceptance and UI tests for iOS.
|
33
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.
|
34
|
-
- XCFit will setup Xcode
|
36
|
+
- 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.
|
35
37
|
|
36
38
|
|
37
|
-
### XCFIT
|
39
|
+
### XCFIT & Other Frameworks
|
38
40
|
|
39
41
|
* **XCFit Swift Framework with Pre-defined BDD Steps and Page Object Pattern Templates**
|
40
42
|
|
41
43
|
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.
|
42
44
|
|
43
|
-
* **Cucumberish BDD Framework and Cucucmber Style Xcode Templates**
|
45
|
+
* **Cucumberish BDD Framework and Cucucmber Style Xcode Templates(Optional Objective-C)**
|
44
46
|
|
45
47
|
XCFit setup [Cucumber](https://cucumber.io) style BDD framework with "[Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) UI Test Bundle' Templates.
|
46
|
-
* **Fitnesse Acceptance Tests for iOS using OCSlim Project**
|
48
|
+
* **Fitnesse Acceptance Tests for iOS using OCSlim Project (Optional Objective-C)**
|
47
49
|
|
48
50
|
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.
|
49
51
|
|
50
52
|
|
51
53
|
### Where to get XCFit
|
52
54
|
|
53
|
-
|
55
|
+
#### XCFit Swift Framework
|
54
56
|
|
55
57
|
* **CocoaPods** -- [XCFit-CocoaPods](http://cocoadocs.org/docsets/XCFit) : XCFit Swift Frameworks and BDD Style predefined steps for the iOS App.
|
56
58
|
* **Carthage** -- You can install XCFit Swift Framework with Carthage as well for iOS Projects
|
57
59
|
* **Swift Package Manager** -- Swift Package Manager doesn't support iOS projects yet but XCFit is compatible with Swift Package manager as well.
|
58
60
|
|
59
|
-
|
61
|
+
#### XCFit Templates
|
60
62
|
|
61
63
|
* **Homebrew** - We can tap 'shashikant86/homebrew-taps' and Install XCFit to download Xcode Templates
|
62
64
|
|
@@ -76,16 +78,14 @@ You must have Mac Operating System with OSX/MacOS Sierra.
|
|
76
78
|
|
77
79
|
|
78
80
|
* **[Xcode 8.3](https://developer.apple.com/xcode/)**
|
79
|
-
-
|
81
|
+
- XCFit only Supports Xcode 8.3 and above.
|
80
82
|
* **[Swift 3.1](https://swift.org/download/)**
|
81
|
-
- Use Swift 3.1-dev snapshot and toolchain.
|
83
|
+
- Use Swift 3.1-dev snapshot and toolchain. Swift 3.1 is currenly in beta.
|
82
84
|
* **[Ruby](https://www.ruby-lang.org/en/)**
|
83
|
-
- Use [RVM](https://rvm.io/) for GEM management. Ideally Ruby > 2.X. You can use system Ruby with sudo
|
85
|
+
- 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.
|
84
86
|
* **[Curl on Mac](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/curl.1.html)**
|
85
87
|
- Might be pre-installed but worth double checking.
|
86
88
|
* **[Homebrew](http://brew.sh)**
|
87
|
-
* **RubyGems Packages(optional)**
|
88
|
-
- Xcpretty, Fastlane(Optional), Rake, Bundler etc
|
89
89
|
* **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.
|
90
90
|
|
91
91
|
|
@@ -100,16 +100,13 @@ XCFit installation has two steps.
|
|
100
100
|
* **Xcode Template Installation**
|
101
101
|
|
102
102
|
|
103
|
-
This will install Xcode Templates with skeleton code to support BDD in iOS app. The templates are XCUI Page Object Templates, Cucumberish BDD
|
103
|
+
This will install Xcode Templates with skeleton code to support BDD in iOS app. The templates are XCUI 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.
|
104
104
|
|
105
105
|
* **Framework Installation**
|
106
106
|
|
107
|
-
XCFit Swift Framework
|
107
|
+
XCFit Swift Framework provides pre-defined BDD Style steps with XCUI and 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.
|
108
108
|
|
109
109
|
|
110
|
-
|
111
|
-
XCFit can be installed using [Homebrew](http://brew.sh) or using [RubyGems](https://rubygems.org/).
|
112
|
-
|
113
110
|
## Template Installation
|
114
111
|
|
115
112
|
XCFit templates can be installed using Homebrew or Rubygem.
|
@@ -118,16 +115,18 @@ XCFit templates can be installed using Homebrew or Rubygem.
|
|
118
115
|
|
119
116
|
Assuming you have already installed [Homebrew](http://brew.sh). Let's tap the formula
|
120
117
|
|
121
|
-
brew tap shashikant86/homebrew-taps
|
118
|
+
$ brew tap shashikant86/homebrew-taps
|
119
|
+
|
122
120
|
Now, we can install XCFit brew package using
|
123
121
|
|
124
|
-
brew install xcfit
|
122
|
+
$ brew install xcfit
|
125
123
|
|
126
124
|
|
127
|
-
This will download XCFit templates.
|
125
|
+
This will download XCFit templates in the '~/Library/Developer/Xcode/Templates/' directory.
|
128
126
|
|
129
127
|
#### XCFit RubyGem Installation
|
130
|
-
|
128
|
+
|
129
|
+
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
|
131
130
|
|
132
131
|
$ gem install xcfit
|
133
132
|
|
@@ -139,7 +138,8 @@ You can choose any of the above method. Rubygems method is prefered.
|
|
139
138
|
### Setup Xcode Templates
|
140
139
|
|
141
140
|
In existing app or brand new app, we have to enable the Xcode templates for targets to speed up the things.
|
142
|
-
##### Xcode
|
141
|
+
##### Xcode Templates for XCFit
|
142
|
+
|
143
143
|
To setup Templates for Xcode 8 for XCUI, Cucumberish target and Gherkin File Type.
|
144
144
|
|
145
145
|
|
@@ -149,7 +149,7 @@ $ xcfit setup_xcode_templates
|
|
149
149
|
|
150
150
|
|
151
151
|
```
|
152
|
-
To Setup Fitnesse Templates
|
152
|
+
To Setup Fitnesse Templates (Optional)
|
153
153
|
|
154
154
|
```
|
155
155
|
$ xcfit setup_fitnesse_templates
|
@@ -163,7 +163,7 @@ You will see new option for iOS i.e 'XCFit'. Once Clicked on it. You will see Cu
|
|
163
163
|
|
164
164
|
## Framework Installation
|
165
165
|
|
166
|
-
XCFit, Cucumberish or OCSlimProject Framework can be installed using Cocoapods. XCFit and Cuucmberish can be installed using Carthage as well
|
166
|
+
XCFit, Cucumberish or OCSlimProject Framework can be installed using Cocoapods. XCFit and Cuucmberish can be installed using Carthage as well.
|
167
167
|
|
168
168
|
### Cocoapods
|
169
169
|
Cocoapods is more automated than Carthage. We can create `Podfile` and add specific dependency for the target
|
@@ -209,7 +209,8 @@ let package = Package(
|
|
209
209
|
Now we can use fetch XCFit using
|
210
210
|
|
211
211
|
$ swift package fetch
|
212
|
-
|
212
|
+
|
213
|
+
We can build, test package using the commnds avavilable for the Swift Package Manager.
|
213
214
|
|
214
215
|
|
215
216
|
|
@@ -227,13 +228,17 @@ XCFit templates gives an option to use very polular [Page Object Pattern](http:/
|
|
227
228
|
|
228
229
|
- 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.
|
229
230
|
|
231
|
+
- You may want to delete autogenerated UI test from Apple's standard template.
|
232
|
+
|
230
233
|
- You don't have to so any setting to run those demo XCUI tests. Just CMD+U and You are good to go !
|
231
234
|
|
235
|
+
|
236
|
+
|
232
237
|
![image](https://github.com/Shashikant86/xcfitgif/blob/master/XCFitPOM_Templates.gif)
|
233
238
|
|
234
239
|
### What's in the XCUI POM Template ?
|
235
240
|
|
236
|
-
* **
|
241
|
+
* **YOUR_APP_TARGETPageObjectTests.swift**
|
237
242
|
|
238
243
|
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.
|
239
244
|
|
@@ -253,46 +258,59 @@ Testbase is group where we can abstract all setup, teardown and common stuff in
|
|
253
258
|
## Getting XCFit Framework for pre-defined BDD Style steps
|
254
259
|
|
255
260
|
### Cocoapods
|
256
|
-
You can get XCFit Framework
|
261
|
+
You can get XCFit Framework easily. Create `Podfile` and add specific dependency for the target
|
257
262
|
|
258
263
|
```ruby
|
259
264
|
target '$_YOUR__TARGET' do
|
260
265
|
pod 'XCFit'
|
261
266
|
end
|
262
267
|
```
|
263
|
-
|
268
|
+
Now that, We need to install the framework using
|
264
269
|
|
265
270
|
```sh
|
266
271
|
$ pod install
|
267
272
|
```
|
273
|
+
|
268
274
|
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.
|
269
275
|
|
276
|
+
|
270
277
|
![image](https://github.com/Shashikant86/xcfitgif/blob/master/Pod_install_XCFit.gif)
|
271
278
|
|
272
279
|
### Carthage
|
273
280
|
|
274
|
-
|
281
|
+
It's easy to install XCFit using Carthage as well. Add following to `Cartfile`
|
275
282
|
|
276
283
|
github "Shashikant86/XCFit"
|
277
284
|
|
285
|
+
|
278
286
|
Now fetch dependency and build XCFit using.
|
279
287
|
|
288
|
+
|
280
289
|
$ carthage update --platform iOS
|
281
|
-
|
290
|
+
|
291
|
+
|
292
|
+
This will create 'Carthage' directory with built framework. We need to manually drag and drop this to our XCUIPoMTest' target build settings. On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk. On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: bin/sh), add the following contents to the script area below the shell:
|
293
|
+
|
282
294
|
|
283
295
|
/usr/local/bin/carthage copy-frameworks
|
296
|
+
|
284
297
|
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
|
285
298
|
|
299
|
+
|
286
300
|
$(SRCROOT)/Carthage/Build/iOS/XCFit.framework
|
287
301
|
|
302
|
+
|
288
303
|
Here is Carthage looks like
|
304
|
+
|
289
305
|
![image](https://github.com/Shashikant86/xcfitgif/blob/master/XCFit_Carthage.gif)
|
290
306
|
|
291
307
|
You can choose any of the above method but Cocoapods is easy and less manual.
|
292
308
|
|
293
|
-
|
309
|
+
## Import XCFit & Use Predefined Steps
|
310
|
+
|
311
|
+
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.
|
294
312
|
|
295
|
-
|
313
|
+
Your test will read something like this:
|
296
314
|
|
297
315
|
```
|
298
316
|
import XCTest
|
@@ -319,7 +337,10 @@ class XCFitTests: XCFit {
|
|
319
337
|
```
|
320
338
|
|
321
339
|
|
322
|
-
You will get access to lots of predefined BDD style human redable steps. It's not mandatory to use those steps unless you wish.
|
340
|
+
You will get access to lots of predefined BDD style human redable steps. It's not mandatory to use those steps unless you wish.
|
341
|
+
|
342
|
+
**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)**
|
343
|
+
|
323
344
|
![image](https://github.com/Shashikant86/xcfitgif/blob/master/pre-defined_xcfit_steps.gif)
|
324
345
|
|
325
346
|
|
@@ -335,6 +356,7 @@ You will get access to lots of predefined BDD style human redable steps. It's no
|
|
335
356
|
|
336
357
|
- 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.
|
337
358
|
|
359
|
+
Let's see what is inside the Cucumberish templates.
|
338
360
|
|
339
361
|
### What's in the Cucumberish Template ?
|
340
362
|
|
@@ -343,7 +365,7 @@ You will get access to lots of predefined BDD style human redable steps. It's no
|
|
343
365
|
This file is at the base of the target. This initiate Cucumberish for project. We need to register all step definitions in this file.
|
344
366
|
* **Screens**
|
345
367
|
|
346
|
-
This is groups where we can abstract logic of every screen in the app. Example file are 'HomeScreen.swift'
|
368
|
+
This is groups where we can abstract logic of every screen in the app. Example file are 'HomeScreen.swift'.
|
347
369
|
|
348
370
|
* **Step_Definitions**
|
349
371
|
|
@@ -351,7 +373,7 @@ This groups has all the step definitions related to screen. Example file 'HomeSc
|
|
351
373
|
|
352
374
|
* **Common**
|
353
375
|
|
354
|
-
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.
|
376
|
+
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.
|
355
377
|
|
356
378
|
* **Supporting Files**
|
357
379
|
|
@@ -380,7 +402,11 @@ Given the app is running
|
|
380
402
|
|
381
403
|
- Select only '**Create folder references**' Option. ** Do Not Select 'Create groups' Or 'Copy items if needed**'
|
382
404
|
|
383
|
-
Now, We have to get cucumberish framework either using Carthage or Cocoapods.
|
405
|
+
Now, We have to get cucumberish framework either using Carthage or Cocoapods.
|
406
|
+
|
407
|
+
## Get Cucumberish Framework
|
408
|
+
|
409
|
+
Cucumberish is one of the dependency of XCFit so you will get Cucumberish with XCFit while using it with Cocoapods however Carthage need more setup.
|
384
410
|
|
385
411
|
### Getting Cucumberish CocoaPod into our Target
|
386
412
|
|
@@ -409,7 +435,7 @@ and press 'CMD+U'
|
|
409
435
|
|
410
436
|
![image](https://github.com/Shashikant86/xcfitgif/blob/master/cucumberish_template.gif)
|
411
437
|
|
412
|
-
Congratulations !! You have just ran your first Cucumber BDD Scenario in the Xcode.
|
438
|
+
Congratulations !! You have just ran your first Cucumber BDD Scenario in the Xcode.
|
413
439
|
|
414
440
|
#### Create Separate Scheme if needed
|
415
441
|
|
@@ -434,6 +460,45 @@ Once drag and drop is don and we have "Features" directory then we are ready to
|
|
434
460
|
|
435
461
|
![image](https://github.com/Shashikant86/xcfitgif/blob/master/CarthageCucumberish.gif)
|
436
462
|
|
463
|
+
## Cucumberish Pre-Defined Steps
|
464
|
+
|
465
|
+
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.
|
466
|
+
**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)**
|
467
|
+
|
468
|
+
# Advise on using Pre-Defines BDD Style Steps
|
469
|
+
|
470
|
+
XCFit has pre-defined steps for both XCFit Swift framework as well as Cucumberish framework.
|
471
|
+
|
472
|
+
* **[XCFit Pre-Defined BDD Style Steps](https://github.com/Shashikant86/XCFit/blob/master/Pre-Defined_Steps/XCFit_Predefined_Steps.md)**
|
473
|
+
* **[Cucumberish Pre-Defined BDD Style Steps](https://github.com/Shashikant86/XCFit/blob/master/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md)**
|
474
|
+
|
475
|
+
It's recommended to use your own steps as predefined steps might not read well for your project needs. Pre-defined steps gives you guidance on how to implement your own step, however you can use pre-defined steps wherever they make sense to avoid duplication.
|
476
|
+
|
477
|
+
## Extending Predefined Steps.
|
478
|
+
|
479
|
+
You can easily override pre-defined BDD Style Steps by writing Swift Extensions and Changing Common step definitions in the Cucumberish 'CommonStepDefinitions.swift' file.
|
480
|
+
|
481
|
+
### Extending BDD Step from XCFit Framework
|
482
|
+
|
483
|
+
XCFit has a step **`givenILaunchedApplication()`** and you are not happy about the wordings. You can easily write and Extension and your steps like this :
|
484
|
+
|
485
|
+
```
|
486
|
+
|
487
|
+
extension XCFit {
|
488
|
+
|
489
|
+
func givenMyiOSApplicationHasBeenLaunched() {
|
490
|
+
XCUIApplication().launch()
|
491
|
+
}
|
492
|
+
|
493
|
+
}
|
494
|
+
```
|
495
|
+
|
496
|
+
Now you can use your own **`givenMyiOSApplicationHasBeenLaunched()`** step anywhere inside the Test target.
|
497
|
+
|
498
|
+
### Extending/Changing Cucumberish BDD Steps
|
499
|
+
|
500
|
+
XCFit template for setting Cucumberish has the Swift code for the all [pre-defined Cucumberish BDD Steps](https://github.com/Shashikant86/XCFit/blob/master/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md) inside the **'CommonStepDefinitions.swift'** file. You just need to add your own steps accordingly or change the exiasting one.
|
501
|
+
|
437
502
|
|
438
503
|
---
|
439
504
|
|
@@ -556,14 +621,22 @@ let package = Package(
|
|
556
621
|
# Quick Demo with Example App
|
557
622
|
|
558
623
|
You can clone the existing repo which has a demo app we can run Unit, Fitnesse and Cucumbertish Tests as XCTest
|
559
|
-
```
|
560
|
-
$ git clone https://github.com/Shashikant86/XCFit
|
561
|
-
$ cd XCFit/XCFit4Demo
|
562
|
-
$ open XCFit4Demo.xcodeproj/
|
563
|
-
```
|
564
|
-
Run XCUI and Cucumberish test with Xcode. "cmd + U". You can script it with `xcodebuild` or Fastlane Tools.
|
565
624
|
|
566
625
|
|
626
|
+
$ git clone https://github.com/Shashikant86/XCFit
|
627
|
+
$ cd XCFit/XCFit4Demo
|
628
|
+
$ open XCFit4Demo.xcworkspace/
|
629
|
+
|
630
|
+
Run XCUI and Cucumberish test with Xcode using **'XCFit4Demo'** Scheme, press "cmd + U". You can also use "**AcceptanceUnitTests"** target/scheme and press "CMD+U" to run fitnesse tests. You can script it with `xcodebuild` or Fastlane Tools.
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
# Step by Step Video Demo
|
635
|
+
|
636
|
+
You can watch step by step video demo on Youtube. Click the link below
|
637
|
+
|
638
|
+
[![Alt text](https://img.youtube.com/vi/7gqPxy6UVRw/0.jpg)](https://www.youtube.com/watch?v=7gqPxy6UVRw)
|
639
|
+
|
567
640
|
# Acknowledgements
|
568
641
|
|
569
642
|
Big Thanks to
|
@@ -579,7 +652,7 @@ Shashikant86, shashikant.jagtap@icloud.com
|
|
579
652
|
|
580
653
|
* Add More Step Definitions for Cucumberish Projects
|
581
654
|
* Improve Swift Package with additional XCUI test helpers
|
582
|
-
|
655
|
+
|
583
656
|
|
584
657
|
# LICENSE
|
585
658
|
|
data/XCFit.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.description = %q{XCFit is a full stack BDD framework in Xcode for iOS and macOS apps with Swift using Cucumberish and Fitnesse. Native Xcode implementation, No Appium, No Calabash, No Ruby or any other non iOS language. Checkout XCFIT POD}
|
14
14
|
spec.homepage = "https://github.com/Shashikant86/XCFit"
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|XCFit4Demo|XCFitnesse|spec|features|_Pods.xcodeproj|Sources|Tests|XCFit.xcodeproj)/}) }
|
17
17
|
spec.files.reject! { |fn| fn.include? "_Pods.xcodeproj" }
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
data/XCFit.podspec
CHANGED
data/homebrew/xcfit
CHANGED
data/lib/XCFit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcfit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shashikant86
|
@@ -78,35 +78,6 @@ files:
|
|
78
78
|
- Rakefile
|
79
79
|
- XCFit.gemspec
|
80
80
|
- XCFit.podspec
|
81
|
-
- XCFit4Demo/Cartfile
|
82
|
-
- XCFit4Demo/Cartfile.resolved
|
83
|
-
- XCFit4Demo/XCFit4Demo.xcodeproj/project.pbxproj
|
84
|
-
- XCFit4Demo/XCFit4Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
85
|
-
- XCFit4Demo/XCFit4Demo/AppDelegate.swift
|
86
|
-
- XCFit4Demo/XCFit4Demo/Assets.xcassets/AppIcon.appiconset/Contents.json
|
87
|
-
- XCFit4Demo/XCFit4Demo/Base.lproj/LaunchScreen.storyboard
|
88
|
-
- XCFit4Demo/XCFit4Demo/Base.lproj/Main.storyboard
|
89
|
-
- XCFit4Demo/XCFit4Demo/Info.plist
|
90
|
-
- XCFit4Demo/XCFit4Demo/ViewController.swift
|
91
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/BaseScreen.swift
|
92
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/CommonStepDefinitions.swift
|
93
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/Extensions.swift
|
94
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/Features/demo.feature
|
95
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/HomeScreen.swift
|
96
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/HomeScreenSteps.swift
|
97
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/Hooks.swift
|
98
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/Info.plist
|
99
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests-Bridging-Header.h
|
100
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.h
|
101
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.m
|
102
|
-
- XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.swift
|
103
|
-
- XCFit4Demo/XCFit4DemoTests/Info.plist
|
104
|
-
- XCFit4Demo/XCFit4DemoTests/XCFit4DemoTests.swift
|
105
|
-
- XCFit4Demo/XCFit4DemoXCUIPoMTests/Extensions.swift
|
106
|
-
- XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreen.swift
|
107
|
-
- XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreenTest.swift
|
108
|
-
- XCFit4Demo/XCFit4DemoXCUIPoMTests/Info.plist
|
109
|
-
- XCFit4Demo/XCFit4DemoXCUIPoMTests/XCFit4DemoXCUIPoMTestsTestBase.swift
|
110
81
|
- XCFit_Templates/XCFit/Cucumber Feature.xctemplate/TemplateIcon.png
|
111
82
|
- XCFit_Templates/XCFit/Cucumber Feature.xctemplate/TemplateIcon@2x.png
|
112
83
|
- XCFit_Templates/XCFit/Cucumber Feature.xctemplate/TemplateInfo.plist
|
data/XCFit4Demo/Cartfile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
github "Shashikant86/XCFit"
|
@@ -1,46 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// AppDelegate.swift
|
3
|
-
// XCFit4Demo
|
4
|
-
//
|
5
|
-
// Created by Shashikant Jagtap on 11/02/2017.
|
6
|
-
// Copyright © 2017 Shashikant Jagtap. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
import UIKit
|
10
|
-
|
11
|
-
@UIApplicationMain
|
12
|
-
class AppDelegate: UIResponder, UIApplicationDelegate {
|
13
|
-
|
14
|
-
var window: UIWindow?
|
15
|
-
|
16
|
-
|
17
|
-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
18
|
-
// Override point for customization after application launch.
|
19
|
-
return true
|
20
|
-
}
|
21
|
-
|
22
|
-
func applicationWillResignActive(_ application: UIApplication) {
|
23
|
-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
24
|
-
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
25
|
-
}
|
26
|
-
|
27
|
-
func applicationDidEnterBackground(_ application: UIApplication) {
|
28
|
-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
29
|
-
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
30
|
-
}
|
31
|
-
|
32
|
-
func applicationWillEnterForeground(_ application: UIApplication) {
|
33
|
-
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
34
|
-
}
|
35
|
-
|
36
|
-
func applicationDidBecomeActive(_ application: UIApplication) {
|
37
|
-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
38
|
-
}
|
39
|
-
|
40
|
-
func applicationWillTerminate(_ application: UIApplication) {
|
41
|
-
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
42
|
-
}
|
43
|
-
|
44
|
-
|
45
|
-
}
|
46
|
-
|
@@ -1,38 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"images" : [
|
3
|
-
{
|
4
|
-
"idiom" : "iphone",
|
5
|
-
"size" : "29x29",
|
6
|
-
"scale" : "2x"
|
7
|
-
},
|
8
|
-
{
|
9
|
-
"idiom" : "iphone",
|
10
|
-
"size" : "29x29",
|
11
|
-
"scale" : "3x"
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"idiom" : "iphone",
|
15
|
-
"size" : "40x40",
|
16
|
-
"scale" : "2x"
|
17
|
-
},
|
18
|
-
{
|
19
|
-
"idiom" : "iphone",
|
20
|
-
"size" : "40x40",
|
21
|
-
"scale" : "3x"
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"idiom" : "iphone",
|
25
|
-
"size" : "60x60",
|
26
|
-
"scale" : "2x"
|
27
|
-
},
|
28
|
-
{
|
29
|
-
"idiom" : "iphone",
|
30
|
-
"size" : "60x60",
|
31
|
-
"scale" : "3x"
|
32
|
-
}
|
33
|
-
],
|
34
|
-
"info" : {
|
35
|
-
"version" : 1,
|
36
|
-
"author" : "xcode"
|
37
|
-
}
|
38
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
3
|
-
<dependencies>
|
4
|
-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
|
5
|
-
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
6
|
-
</dependencies>
|
7
|
-
<scenes>
|
8
|
-
<!--View Controller-->
|
9
|
-
<scene sceneID="EHf-IW-A2E">
|
10
|
-
<objects>
|
11
|
-
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
12
|
-
<layoutGuides>
|
13
|
-
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
14
|
-
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
15
|
-
</layoutGuides>
|
16
|
-
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
17
|
-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
18
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
19
|
-
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
20
|
-
</view>
|
21
|
-
</viewController>
|
22
|
-
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
23
|
-
</objects>
|
24
|
-
<point key="canvasLocation" x="53" y="375"/>
|
25
|
-
</scene>
|
26
|
-
</scenes>
|
27
|
-
</document>
|