cs-bdd 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +93 -1
- data/bin/cs-bdd +9 -0
- data/lib/cs/bdd/version.rb +1 -1
- data/lib/skeleton/features/android/{steps_definition → step_definitions}/.gitkeep +0 -0
- data/lib/skeleton/features/ios/{steps_definition → step_definitions}/.gitkeep +0 -0
- data/lib/skeleton/features/ios/support/01_launch.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e520c9c43c7d3a85a0caa2b8f9ab6a906de0e882
|
4
|
+
data.tar.gz: bf35813d182a41587e491050199114e8de3e0381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be9e5f19148f6d64b59cc4142a209168bd590f54a6ad5cb7674b9d9b691d543779d18717d71f878c0c9436d379bd469a3f9a5b487cc6ae58116200b31b430783
|
7
|
+
data.tar.gz: 241a8fd3ff44a757bb1e36a82a6d51c9b006740cef07839d5a560e9acc2220b850a90dab9d09651bc4e5ee53a83af9f73955c9d464834d244668b6c9b4128c84
|
data/README.md
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
A simple gem to generate all the files needed to create a project that will support calabash for Android and iOS.
|
4
4
|
|
5
|
+
[Calabash](http://calaba.sh/) uses cucumber to support functional tests in Android and iOS and has one gem for each Platform:
|
6
|
+
|
7
|
+
> calabash-android (for Android) [(link)](https://github.com/calabash/calabash-android)
|
8
|
+
|
9
|
+
> calabash-cucumber (for iOS) [(link)](https://github.com/calabash/calabash-ios)
|
10
|
+
|
11
|
+
The project structure is based on [this site](http://rubygemtsl.com/2014/01/06/designing-maintainable-calabash-tests-using-screen-objects-2). This structure is based on three layers: the features, the steps and the screens.
|
12
|
+
|
13
|
+
1. Features: Contains all the features of the project, this features are Platform independent and will run when testing both Android and iOS;
|
14
|
+
2. Steps: Contains all the steps implementation of the features. This steps are Platform independent and will run when testing both Android and iOS;
|
15
|
+
3. Screens: Contains all the screens definition. A screen definition must contain an identification, the declaration of all the elements of the screen and the declaration of its actions. This layer is Platform dependent. This occurs because, in almost every project, the identification of the elements of the screens varies between the Platforms. One example is that in Android almost all elements have an id, but in iOS is most common to identify the elements by accessibility label. The Platform dependent screens must has the same name and same methods. This will allow your steps to be unique between platforms
|
16
|
+
|
17
|
+
> One example of this structure can be found in the generated files (see Usage) on the file base_steps.rb. This file implements some common steps to help you start your tests and show you how to uses the Platform dependent screens
|
18
|
+
|
19
|
+
> In my experience with tests I saw some cases that we will need to test features that are Platform dependent, like screens that send SMS which will only happen in Android. For this to happen, the generated structure has Features and Steps that are Platform dependent and can be found inside the folder `features/android` and `features/ios` of the generated project.
|
20
|
+
|
5
21
|
## Installation
|
6
22
|
|
7
23
|
Install it as:
|
@@ -10,7 +26,83 @@ Install it as:
|
|
10
26
|
|
11
27
|
## Usage
|
12
28
|
|
13
|
-
|
29
|
+
This gem works only in the terminal, so for help, type:
|
30
|
+
|
31
|
+
```
|
32
|
+
cs-bdd
|
33
|
+
cs-bdd generate
|
34
|
+
```
|
35
|
+
|
36
|
+
To see the gem version type:
|
37
|
+
|
38
|
+
```
|
39
|
+
cs-bdd version
|
40
|
+
```
|
41
|
+
|
42
|
+
To generate a structure of one project that can support both Android and iOS features for Calabash type:
|
43
|
+
|
44
|
+
```
|
45
|
+
cs-bdd new ProjectName
|
46
|
+
```
|
47
|
+
|
48
|
+
This command will create a folder named ProjectName in the current directory and will create all the files needed. This gem support localizations. To create a localized project, in Portuguese, type:
|
49
|
+
|
50
|
+
```
|
51
|
+
cs-bdd new ProjectName --lang=pt
|
52
|
+
```
|
53
|
+
|
54
|
+
> The default language is English ('en'). The elements of Gherkin such as Given, When, Than, And, Scenario will be translated to all Gherkin supported languages, but the generators accept only a little quantity of languages(see than in the folder: `lib/cs/bdd/locales`).
|
55
|
+
|
56
|
+
> **CS-BDD doesn't support your mother language?** No problem make a fork, create your yml translation file, uses the en.yml file as a template. Translate it and make a pull request. There are only 15 lines to be translated, this will take no time.
|
57
|
+
|
58
|
+
> **Don't know how to identify your yml file?** See the Gherkin supported languages [here](https://github.com/cucumber/gherkin/blob/master/lib/gherkin/i18n.json).
|
59
|
+
|
60
|
+
Once the project is created, opens the folder (`cd ProjectName`).
|
61
|
+
|
62
|
+
> **The generators commands ONLY WORK in the ROOT FOLDER of the project**.
|
63
|
+
|
64
|
+
There are nine generators that are responsible to create the templates for Features, Step definitions and Screens.
|
65
|
+
|
66
|
+
For Features you can type:
|
67
|
+
|
68
|
+
```
|
69
|
+
cs-bdd generate feature FeatureName
|
70
|
+
cs-bdd generate aFeature AndroidFeatureName
|
71
|
+
cs-bdd generate iFeature iOSFeatureName
|
72
|
+
```
|
73
|
+
|
74
|
+
> The feature generator will create a Platform independent feature and its files. So this command will create the FeatureName.feature file in the folder `feature`, the file FeatureName_steps.rb in the folder `features/step_definitions`, the the files FeatureName_screen.rb in the folders `features/android/screens` and `features/ios/screens`.
|
75
|
+
|
76
|
+
> The aFeature and iFeature generator will create and Platform dependent feature so, for example, the aFeature generator will create the AndroidFeatureName.feature file in the folder `features/android/features`, the file AndroidFeatureName_steps.rb in the folder `features/androd/step_definitions` and the screen file AndroidFeatureName_screen.rb in the folder `features/android/screens`.
|
77
|
+
|
78
|
+
Don't forget about internationalization. All the generators accept the option `--lang=pt` or with some other language.
|
79
|
+
|
80
|
+
For Steps definitions you can type:
|
81
|
+
|
82
|
+
```
|
83
|
+
cs-bdd generate step StepName
|
84
|
+
cs-bdd generate aStep AndroidStepName
|
85
|
+
cs-bdd generate iStep iOSStepName
|
86
|
+
```
|
87
|
+
|
88
|
+
> The step generator will create a Platform independent step file named StepName_steps.rb in the folder `features/step_definitions`
|
89
|
+
|
90
|
+
> The aStep generator will create an Android step file named AndroidStepName_steps.rb in the folder `features/android/step_definitions`
|
91
|
+
|
92
|
+
> The iStep generator will create an iOS step file name iOSStepName_steps.rb in the folder `features/ios/step_definitions`
|
93
|
+
|
94
|
+
For Screens type:
|
95
|
+
|
96
|
+
```
|
97
|
+
cs-bdd generate screen ScreenName
|
98
|
+
cs-bdd generate aScreen AndroidScreenName
|
99
|
+
cs-bdd generate iScreen iOSScreenName
|
100
|
+
```
|
101
|
+
|
102
|
+
> The screen generator will create both Platform dependent screens in the folders `features/android/screens` and `features/ios/screens`.
|
103
|
+
|
104
|
+
> The aScreen and iScreen will create only the Android and iOS dependent screens respectively.
|
105
|
+
|
14
106
|
|
15
107
|
## Contributing
|
16
108
|
|
data/bin/cs-bdd
CHANGED
@@ -73,6 +73,15 @@ module CS
|
|
73
73
|
create_steps_file name, 'IOS'
|
74
74
|
end
|
75
75
|
|
76
|
+
desc "screen [RESOURCE_NAME]", "Generates the Android and iOS dependent screens"
|
77
|
+
option :lang, :banner => "any of the gherkin supported languages", :default => :en
|
78
|
+
def screen name
|
79
|
+
I18n.config.default_locale = options[:lang]
|
80
|
+
in_root_project_folder?
|
81
|
+
create_screen_file name, 'Android'
|
82
|
+
create_screen_file name, 'IOS'
|
83
|
+
end
|
84
|
+
|
76
85
|
desc "aScreen [RESOURCE_NAME]", "Generates an Android dependent screen"
|
77
86
|
option :lang, :banner => "any of the gherkin supported languages", :default => :en
|
78
87
|
def aScreen name
|
data/lib/cs/bdd/version.rb
CHANGED
File without changes
|
File without changes
|
@@ -90,6 +90,10 @@ def reinstall_app
|
|
90
90
|
# You can either pass it as a parameter in the cucumber command or set it here
|
91
91
|
#ENV["APP_BUNDLE_ID"] = "bundle_id"
|
92
92
|
|
93
|
+
# Booting the device to avoid problems with the app installation
|
94
|
+
%x(open -a "iOS Simulator" --args -CurrentDeviceUDID #{ENV['DEVICE_TARGET']} > /dev/null)
|
95
|
+
sleep(7)
|
96
|
+
|
93
97
|
# Reinstalling the app using terminal commands
|
94
98
|
system( "echo 'Installing the app...'" )
|
95
99
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cs-bdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Tanner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,13 +110,13 @@ files:
|
|
110
110
|
- lib/skeleton/config/scripts/ios/run_tests_all_devices.sh
|
111
111
|
- lib/skeleton/features/android/android_screen_base.rb
|
112
112
|
- lib/skeleton/features/android/features/.gitkeep
|
113
|
-
- lib/skeleton/features/android/
|
113
|
+
- lib/skeleton/features/android/step_definitions/.gitkeep
|
114
114
|
- lib/skeleton/features/android/support/app_installation_hooks.rb
|
115
115
|
- lib/skeleton/features/android/support/app_life_cycle_hooks.rb
|
116
116
|
- lib/skeleton/features/android/support/hooks.rb
|
117
117
|
- lib/skeleton/features/ios/features/.gitkeep
|
118
118
|
- lib/skeleton/features/ios/ios_screen_base.rb
|
119
|
-
- lib/skeleton/features/ios/
|
119
|
+
- lib/skeleton/features/ios/step_definitions/.gitkeep
|
120
120
|
- lib/skeleton/features/ios/support/01_launch.rb
|
121
121
|
- lib/skeleton/features/ios/support/02_pre_stop_hooks.rb
|
122
122
|
- lib/skeleton/features/support/env.rb
|