testgen 0.9 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 054b97fcb6d8a8f6ab5be85e80559db908f39278
4
- data.tar.gz: ab8b34c300385807211c0d1495e18f0e9d2b0ef1
3
+ metadata.gz: 5fa2ee1d57159536ddeb9f9fa79b1be59d3ef803
4
+ data.tar.gz: 12049b46d9f2fe0c7cccc1c64c22bc2f78bd657c
5
5
  SHA512:
6
- metadata.gz: 9c83c34d989aae426e8eb60a3d0fcc07153492a038538f1f3c9bd98209f76293b383d89cbd755178451fffe9f50aa9ab99e2772c6750f6d6a49f52ae5847738a
7
- data.tar.gz: 140d04206c43b023b26eb557037fa168254d685efb45275f042933b02ed2d45227226c74c50a595b4abd15d6e858e7ec73baa1fd35402aac99be44e233e0cde5
6
+ metadata.gz: 6116f2f5815e36d1c23e1b7f91badaa1af96f0e20d6c673ca6fc3601173a196cec96847fa1a8a1998ea820a66912de90a77abc429f5e046ecc3db4681e1e4784
7
+ data.tar.gz: 2e9003430e8c90f9eeac68b63214fa0d45f85d51166d947f4a76a397ea26ec57d11832bd5cfb1ecfe492d067c0c6c24db5923440791da1ccca2b3866bb06b754
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ === Version 1.0 / 2017-08-31
2
+ * Removed support for Gametel
3
+ * Made web and PageObject the default generation
4
+ * Added support for DataMagic in the web generator
5
+
1
6
  === Version 0.9 / 2016-12-7
2
7
  * Updated Gemfile generation to use PageObject 2.0
3
8
  * Updated hooks generation to use Watir instead of WatirWebdriver
data/Readme.md CHANGED
@@ -11,18 +11,13 @@ developing cucumber features. There are options that can be provided to have th
11
11
 
12
12
  ## Web testing
13
13
 
14
- If you are testing a web application, <em>testgen</em> can setup the project to use the PageObject gem.
14
+ If you are testing a web application, <em>testgen</em> will by default setup the project to use the PageObject gem
15
+ with Watir.
15
16
 
16
- testgen project <project_name> --pageobject-driver=watir
17
+ testgen project <project_name>
17
18
 
18
- Valid options for the <em>--pageobject-driver</em> option are 'watir' or 'selenium'
19
-
20
19
  ## Android testing
21
20
 
22
- If you are testing an android application in the emulator or on a device, <em>testgen</em> can setup the project to use the Gametel gem.
23
-
24
- testgen project <project_name> --with-gametel
25
-
26
21
  If you want to setup project to use the Appium library
27
22
 
28
23
  testgen project <project_name> --with-appium
@@ -2,29 +2,26 @@ Feature: Adding support for the --pageobject-driver option
2
2
 
3
3
 
4
4
  Scenario: Adding page-object to the Gemfile
5
- When I run `testgen project sample --pageobject-driver=watir`
5
+ When I run `testgen project sample`
6
6
  Then a file named "sample/Gemfile" should exist
7
7
  And the file "sample/Gemfile" should contain "gem 'page-object', '~> 2.0'"
8
-
8
+ And the file "sample/Gemfile" should contain "gem 'data_magic'"
9
+
9
10
  Scenario: Adding page-object to env.rb
10
- When I run `testgen project sample --pageobject-driver=watir`
11
+ When I run `testgen project sample`
11
12
  Then a file named "sample/features/support/env.rb" should exist
12
13
  And the file "sample/features/support/env.rb" should contain "require 'page-object'"
13
- And the file "sample/features/support/env.rb" should contain "World(PageObject::PageFactory)"
14
+ And the file "sample/features/support/env.rb" should contain "require 'data_magic'"
15
+ And the file "sample/features/support/env.rb" should contain "World(PageObject::PageFactory)"
14
16
 
15
17
  Scenario: Adding the hook file for Watir
16
- When I run `testgen project sample --pageobject-driver=watir`
18
+ When I run `testgen project sample`
17
19
  Then a file named "sample/features/support/hooks.rb" should exist
18
20
  And the file "sample/features/support/hooks.rb" should contain "require 'watir'"
19
21
  And the file "sample/features/support/hooks.rb" should contain "@browser = Watir::Browser.new :chrome"
20
-
21
- Scenario: Adding the hook file for Selenium
22
- When I run `testgen project sample --pageobject-driver=selenium`
23
- Then a file named "sample/features/support/hooks.rb" should exist
24
- And the file "sample/features/support/hooks.rb" should contain "require 'selenium-webdriver'"
25
- And the file "sample/features/support/hooks.rb" should contain "@browser = Selenium::WebDriver.for :chrome"
26
-
22
+ And the file "sample/features/support/hooks.rb" should contain "DataMagic.load_for_scenario(scenario)"
23
+
27
24
  Scenario: Creating the pages directory
28
- When I run `testgen project sample --pageobject-driver=selenium`
25
+ When I run `testgen project sample`
29
26
  Then a directory named "sample/features/support/pages" should exist
30
27
 
@@ -1,7 +1,7 @@
1
1
  Feature: Adding the --with-lib flag
2
2
 
3
3
  Background:
4
- When I run `testgen project sample --with-lib --pageobject-driver=watir`
4
+ When I run `testgen project sample --with-lib`
5
5
 
6
6
  Scenario: Adding the require_all gem to Gemfile
7
7
  Then a file named "sample/Gemfile" should exist
@@ -5,19 +5,15 @@ module TestGen
5
5
  class CLI < Thor
6
6
 
7
7
  desc "project <project_name>", "Create a new test project"
8
- method_option :pageobject_driver, :type => :string, :required => false, :desc => "Use the PageObject gem to drive browsers. Valid values are 'watir' and 'selenium'"
9
8
  method_option :with_lib, :type => :boolean, :desc => "Place shared objects under lib directory"
10
- method_option :with_gametel, :type => :boolean, :desc => "Add support for gametel gem"
11
9
  method_option :with_mohawk, :type => :boolean, :desc => 'Adds support for mohawk gem'
12
10
  method_option :with_appium, :type => :boolean, :desc => 'Add support for appium'
13
11
 
14
12
  def project(name)
15
- driver = options[:pageobject_driver].nil? ? 'none' : options[:pageobject_driver]
16
13
  with_lib = options[:with_lib] ? 'true' : 'false'
17
- with_gametel = options[:with_gametel] ? 'true' : 'false'
18
14
  with_mohawk = options[:with_mohawk] ? 'true' : 'false'
19
15
  with_appium = options[:with_appium] ? 'true' : 'false'
20
- TestGen::Generators::Project.start([name, driver, with_lib, with_gametel, with_mohawk, with_appium])
16
+ TestGen::Generators::Project.start([name, with_lib, with_mohawk, with_appium])
21
17
  end
22
18
 
23
19
  end
@@ -6,9 +6,7 @@ module TestGen
6
6
  include Thor::Actions
7
7
 
8
8
  argument :name, :type => :string, :desc => 'The name of the project'
9
- argument :pageobject_driver, :type => :string, :desc => 'Driver to use with PageObject'
10
9
  argument :with_lib, :type => :string, :desc => 'Place all shared objects in the lib directory'
11
- argument :with_gametel, :type => :string, :desc => 'Add support for the gametel gem'
12
10
  argument :with_mohawk, :type => :string, :desc => 'Add support for the mohawk gem'
13
11
  argument :with_appium, :type => :string, :desc => 'Add support for appium gem'
14
12
 
@@ -45,7 +43,7 @@ module TestGen
45
43
  end
46
44
 
47
45
  def copy_hooks
48
- template "hooks.rb.tt", "#{name}/features/support/hooks.rb" unless no_driver_selected
46
+ template "hooks.rb.tt", "#{name}/features/support/hooks.rb" if gen_pageobject
49
47
  end
50
48
 
51
49
  def create_lib_directory
@@ -54,18 +52,18 @@ module TestGen
54
52
 
55
53
  def create_pages_directory
56
54
  if gen_lib
57
- empty_directory("#{name}/lib/pages") unless no_driver_selected
58
- empty_directory("#{name}/lib/screens") if with_gametel == 'true'|| with_mohawk == 'true' || with_appium == 'true'
55
+ empty_directory("#{name}/lib/pages") if gen_pageobject
56
+ empty_directory("#{name}/lib/screens") unless gen_pageobject
59
57
  else
60
- empty_directory("#{name}/features/support/pages") unless no_driver_selected
61
- empty_directory("#{name}/features/support/screens") if with_gametel == 'true' || with_mohawk == 'true' || with_appium == 'true'
58
+ empty_directory("#{name}/features/support/pages") if gen_pageobject
59
+ empty_directory("#{name}/features/support/screens") unless gen_pageobject
62
60
  end
63
61
  end
64
62
 
65
63
  private
66
-
67
- def no_driver_selected
68
- pageobject_driver.downcase == 'none'
64
+
65
+ def gen_pageobject
66
+ with_mohawk == 'false' && with_appium == 'false'
69
67
  end
70
68
 
71
69
  def gen_lib
@@ -3,15 +3,13 @@ source 'https://rubygems.org'
3
3
  gem 'cucumber'
4
4
  gem 'rspec'
5
5
  gem 'rake'
6
- <% unless pageobject_driver.downcase == 'none' -%>
6
+ <% if with_appium == 'false' and with_mohawk == 'false' -%>
7
7
  gem 'page-object', '~> 2.0'
8
+ gem 'data_magic'
8
9
  <% end -%>
9
- <% if with_lib == 'true' or with_gametel == 'true' or with_appium == 'true' -%>
10
+ <% if with_lib == 'true' or with_appium == 'true' -%>
10
11
  gem 'require_all'
11
12
  <% end -%>
12
- <% if with_gametel == 'true' -%>
13
- gem 'gametel'
14
- <% end -%>
15
13
  <% if with_mohawk == 'true' -%>
16
14
  gem 'mohawk', '~> 0.1'
17
15
  gem 'ffi', '1.9.0'
@@ -3,11 +3,9 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
3
3
 
4
4
  <% end -%>
5
5
  require 'rspec'
6
- <% unless pageobject_driver.downcase == 'none' -%>
6
+ <% if with_appium == 'false' and with_mohawk == 'false' -%>
7
7
  require 'page-object'
8
- <% end -%>
9
- <% if with_gametel == 'true' -%>
10
- require 'gametel'
8
+ require 'data_magic'
11
9
  <% end -%>
12
10
  <% if with_mohawk == 'true' -%>
13
11
  require 'mohawk'
@@ -19,27 +17,6 @@ require 'require_all'
19
17
  require_all 'lib'
20
18
  <% end -%>
21
19
 
22
- <% if with_gametel == 'true' -%>
23
- World(Gametel::Navigation)
24
-
25
- keystore = {
26
- :path => File.expand_path('~/.android/debug.keystore'),
27
- :alias => 'androiddebugkey',
28
- :password => 'android',
29
- :keystore_password => 'android'
30
- }
31
-
32
- Gametel.apk_path = PATH_TO_APK
33
- Gametel.keystore = keystore
34
-
35
- Before do
36
- @driver = Gametel.start(ACTIVITY_NAME_GOES_HERE)
37
- end
38
-
39
- After do
40
- Gametel.stop
41
- end
42
- <% end -%>
43
20
  <% if with_appium == 'true' -%>
44
21
  require 'appium_lib'
45
22
 
@@ -70,7 +47,7 @@ at_exit do
70
47
  driver_quit
71
48
  end
72
49
  <% end -%>
73
- <% unless pageobject_driver.downcase == 'none' -%>
50
+ <% if with_appium == 'false' and with_mohawk == 'false' -%>
74
51
  World(PageObject::PageFactory)
75
52
  <% end -%>
76
53
  <% if with_mohawk == 'true' -%>
@@ -1,17 +1,8 @@
1
- <% if pageobject_driver.downcase == 'watir' -%>
2
1
  require 'watir'
3
- <% end %>
4
- <% if pageobject_driver.downcase == 'selenium' -%>
5
- require 'selenium-webdriver'
6
- <% end %>
7
2
 
8
- Before do
9
- <% if pageobject_driver.downcase == 'watir' -%>
3
+ Before do |scenario|
4
+ DataMagic.load_for_scenario(scenario)
10
5
  @browser = Watir::Browser.new :chrome
11
- <% end %>
12
- <% if pageobject_driver.downcase == 'selenium' -%>
13
- @browser = Selenium::WebDriver.for :chrome
14
- <% end %>
15
6
  end
16
7
 
17
8
 
@@ -1,3 +1,3 @@
1
1
  module TestGen
2
- VERSION = "0.9"
2
+ VERSION = "1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testgen
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey S. Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2017-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -102,7 +102,6 @@ files:
102
102
  - features/testgen_project.feature
103
103
  - features/testgen_with_pageobject.feature
104
104
  - features/with_appium.feature
105
- - features/with_gametel_option.feature
106
105
  - features/with_lib_option.feature
107
106
  - features/with_mohawk_option.feature
108
107
  - lib/testgen.rb
@@ -135,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
134
  version: '0'
136
135
  requirements: []
137
136
  rubyforge_project: testgen
138
- rubygems_version: 2.5.1
137
+ rubygems_version: 2.5.2
139
138
  signing_key:
140
139
  specification_version: 4
141
140
  summary: Generators for testers using Cucumber
@@ -145,6 +144,5 @@ test_files:
145
144
  - features/testgen_project.feature
146
145
  - features/testgen_with_pageobject.feature
147
146
  - features/with_appium.feature
148
- - features/with_gametel_option.feature
149
147
  - features/with_lib_option.feature
150
148
  - features/with_mohawk_option.feature
@@ -1,44 +0,0 @@
1
- Feature: Adding the --with-gametel flag
2
-
3
- Scenario: Adding the require_all and gametel gems to Gemfile
4
- When I run `testgen project sample --with-gametel`
5
- Then a file named "sample/Gemfile" should exist
6
- And the file "sample/Gemfile" should contain "gem 'require_all'"
7
- And the file "sample/Gemfile" should contain "gem 'gametel'"
8
- And the file "sample/Gemfile" should contain "gem 'rake'"
9
-
10
- Scenario: Adding gametel to env.rb
11
- When I run `testgen project sample --with-gametel`
12
- Then a file named "sample/features/support/env.rb" should exist
13
- And the file "sample/features/support/env.rb" should contain "require 'gametel'"
14
- And the file "sample/features/support/env.rb" should contain "World(Gametel::Navigation)"
15
-
16
- Scenario: Creating the keystore
17
- When I run `testgen project sample --with-gametel`
18
- Then a file named "sample/features/support/env.rb" should exist
19
- And the file "sample/features/support/env.rb" should contain "keystore = {"
20
- And the file "sample/features/support/env.rb" should contain ":path => File.expand_path('~/.android/debug.keystore')"
21
- And the file "sample/features/support/env.rb" should contain ":alias => 'androiddebugkey'"
22
- And the file "sample/features/support/env.rb" should contain ":password => 'android'"
23
- And the file "sample/features/support/env.rb" should contain ":keystore_password => 'android'"
24
-
25
- Scenario: Creating the Driver and hooks
26
- When I run `testgen project sample --with-gametel`
27
- Then a file named "sample/features/support/env.rb" should exist
28
- And the file "sample/features/support/env.rb" should contain "@driver = Gametel.start(ACTIVITY_NAME_GOES_HERE)"
29
- And the file "sample/features/support/env.rb" should contain "Gametel.stop"
30
- And the file "sample/features/support/env.rb" should contain "Gametel.apk_path = PATH_TO_APK"
31
- And the file "sample/features/support/env.rb" should contain "Gametel.keystore = keystore"
32
-
33
-
34
- Scenario: Should not create the hooks file
35
- When I run `testgen project sample --with-gametel`
36
- Then a file named "sample/features/support/hooks.rb" should not exist
37
-
38
- Scenario: Creating the screens directory under support
39
- When I run `testgen project sample --with-gametel`
40
- Then a directory named "sample/features/support/screens" should exist
41
-
42
- Scenario: Creating the screens directory under lib when using --wth-lib
43
- When I run `testgen project sample --with-gametel --with-lib`
44
- Then a directory named "sample/lib/screens" should exist