testgen 0.5.2 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/Guardfile +1 -1
- data/Readme.md +29 -2
- data/features/testgen_with_pageobject.feature +1 -2
- data/features/with_mojawk_option.feature +38 -0
- data/lib/testgen/cli.rb +3 -1
- data/lib/testgen/generators/project.rb +3 -2
- data/lib/testgen/generators/project/Gemfile.tt +5 -1
- data/lib/testgen/generators/project/env.rb.tt +17 -1
- data/lib/testgen/version.rb +1 -1
- metadata +6 -4
data/ChangeLog
CHANGED
data/Guardfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
|
-
guard 'cucumber', :notification => true, :all_after_pass =>
|
4
|
+
guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
|
5
5
|
watch(%r{^features/.+\.feature$})
|
6
6
|
watch(%r{^features/support/.+$}) { 'features' }
|
7
7
|
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
data/Readme.md
CHANGED
@@ -7,8 +7,35 @@ Currently it only generates a cucumber project. You can do this by executing:
|
|
7
7
|
testgen project <project_name>
|
8
8
|
|
9
9
|
This command will create a project in the <em>project_name</em> directory with the files needed to begin
|
10
|
-
developing cucumber features.
|
10
|
+
developing cucumber features. There are options that can be provided to have the project configure to use different gems. Here are a few:
|
11
|
+
|
12
|
+
## Web testing
|
13
|
+
|
14
|
+
If you are testing a web application, <em>testgen</em> can setup the project to use the PageObject gem.
|
11
15
|
|
12
16
|
testgen project <project_name> --pageobject-driver=watir
|
13
17
|
|
14
|
-
Valid options for the <em>--pageobject-driver</em> option are 'watir' or 'selenium'
|
18
|
+
Valid options for the <em>--pageobject-driver</em> option are 'watir' or 'selenium'
|
19
|
+
|
20
|
+
## Android testing
|
21
|
+
|
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
|
+
## Native Windows testing
|
27
|
+
|
28
|
+
If you are testing a native windows application, <em>testgen</em> can setup the project to use the Mohawk gem.
|
29
|
+
|
30
|
+
testgen project <project_name> --with-mohawk
|
31
|
+
|
32
|
+
|
33
|
+
## Moving page-objects or screen-objects to the lib directory
|
34
|
+
|
35
|
+
There is another option available with will create the page or screen directory in a base directoy named lib. It will also setup the project so these files get loaded the same way they would if the directory was in the support directory. Here's an example of creating a project for web testing using the lib option:
|
36
|
+
|
37
|
+
testgen project <project_name> --pageobject-driver=watir --with-lib
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
@@ -10,7 +10,6 @@ Feature: Adding support for the --pageobject-driver option
|
|
10
10
|
When I run `testgen project sample --pageobject-driver=watir`
|
11
11
|
Then a file named "sample/features/support/env.rb" should exist
|
12
12
|
And the file "sample/features/support/env.rb" should contain "require 'page-object'"
|
13
|
-
And the file "sample/features/support/env.rb" should contain "require 'page-object/page_factory'"
|
14
13
|
And the file "sample/features/support/env.rb" should contain "World(PageObject::PageFactory)"
|
15
14
|
|
16
15
|
Scenario: Adding the hook file for Watir
|
@@ -28,4 +27,4 @@ Feature: Adding support for the --pageobject-driver option
|
|
28
27
|
Scenario: Creating the pages directory
|
29
28
|
When I run `testgen project sample --pageobject-driver=selenium`
|
30
29
|
Then a directory named "sample/features/support/pages" should exist
|
31
|
-
|
30
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
@focus
|
2
|
+
Feature: Adding the --with-mohawk flag
|
3
|
+
|
4
|
+
Scenario: Adding the childprocess and mohawk gems to Gemfile
|
5
|
+
When I run `testgen project sample --with-mohawk`
|
6
|
+
Then a file named "sample/Gemfile" should exist
|
7
|
+
And the file "sample/Gemfile" should contain "gem 'childprocess'"
|
8
|
+
And the file "sample/Gemfile" should contain "gem 'mohawk'"
|
9
|
+
And the file "sample/Gemfile" should contain "gem 'rake'"
|
10
|
+
|
11
|
+
Scenario: Adding mohawk to env.rb
|
12
|
+
When I run `testgen project sample --with-mohawk`
|
13
|
+
Then a file named "sample/features/support/env.rb" should exist
|
14
|
+
And the file "sample/features/support/env.rb" should contain "require 'childprocess'"
|
15
|
+
And the file "sample/features/support/env.rb" should contain "require 'mohawk'"
|
16
|
+
And the file "sample/features/support/env.rb" should contain "World(Mohawk::Navigation)"
|
17
|
+
|
18
|
+
Scenario: Creating the Driver and hooks
|
19
|
+
When I run `testgen project sample --with-mohawk`
|
20
|
+
Then a file named "sample/features/support/env.rb" should exist
|
21
|
+
And the file "sample/features/support/env.rb" should contain "@process = ChildProcess.build(PATH_TO_EXECUTABLE)"
|
22
|
+
And the file "sample/features/support/env.rb" should contain "@process.start"
|
23
|
+
And the file "sample/features/support/env.rb" should contain "RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @process.pid).present?"
|
24
|
+
And the file "sample/features/support/env.rb" should contain "@process.stop"
|
25
|
+
|
26
|
+
|
27
|
+
Scenario: Should not create the hooks file
|
28
|
+
When I run `testgen project sample --with-mohawk`
|
29
|
+
Then a file named "sample/features/support/hooks.rb" should not exist
|
30
|
+
|
31
|
+
Scenario: Creating the screens directory under support
|
32
|
+
When I run `testgen project sample --with-mohawk`
|
33
|
+
Then a directory named "sample/features/support/screens" should exist
|
34
|
+
|
35
|
+
Scenario: Creating the screens directory under lib when using --wth-lib
|
36
|
+
When I run `testgen project sample --with-mohawk --with-lib`
|
37
|
+
Then a directory named "sample/lib/screens" should exist
|
38
|
+
|
data/lib/testgen/cli.rb
CHANGED
@@ -8,11 +8,13 @@ module TestGen
|
|
8
8
|
method_option :pageobject_driver, :type => :string, :required => false, :desc => "Use the PageObject gem to drive browsers. Valid values are 'watir' and 'selenium'"
|
9
9
|
method_option :with_lib, :type => :boolean, :desc => "Place shared objects under lib directory"
|
10
10
|
method_option :with_gametel, :type => :boolean, :desc => "Add support for gametel gem"
|
11
|
+
method_option :with_mohawk, :type => :boolean, :desc => 'Adds support for mohawk gem'
|
11
12
|
def project(name)
|
12
13
|
driver = options[:pageobject_driver].nil? ? 'none' : options[:pageobject_driver]
|
13
14
|
with_lib = options[:with_lib] ? 'true' : 'false'
|
14
15
|
with_gametel = options[:with_gametel] ? 'true' : 'false'
|
15
|
-
|
16
|
+
with_mohawk = options[:with_mohawk] ? 'true' : 'false'
|
17
|
+
TestGen::Generators::Project.start([name, driver, with_lib, with_gametel, with_mohawk])
|
16
18
|
end
|
17
19
|
|
18
20
|
end
|
@@ -9,6 +9,7 @@ module TestGen
|
|
9
9
|
argument :pageobject_driver, :type => :string, :desc => 'Driver to use with PageObject'
|
10
10
|
argument :with_lib, :type => :string, :desc => 'Place all shared objects in the lib directory'
|
11
11
|
argument :with_gametel, :type => :string, :desc => 'Add support for the gametel gem'
|
12
|
+
argument :with_mohawk, :type => :string, :desc => 'Add support for the mohawk gem'
|
12
13
|
desc "Generates a project structure for testing with Cucumber"
|
13
14
|
|
14
15
|
def self.source_root
|
@@ -52,10 +53,10 @@ module TestGen
|
|
52
53
|
def create_pages_directory
|
53
54
|
if gen_lib
|
54
55
|
empty_directory("#{name}/lib/pages") unless no_driver_selected
|
55
|
-
empty_directory("#{name}/lib/screens") if with_gametel == 'true'
|
56
|
+
empty_directory("#{name}/lib/screens") if with_gametel == 'true' or with_mohawk == 'true'
|
56
57
|
else
|
57
58
|
empty_directory("#{name}/features/support/pages") unless no_driver_selected
|
58
|
-
empty_directory("#{name}/features/support/screens") if with_gametel == 'true'
|
59
|
+
empty_directory("#{name}/features/support/screens") if with_gametel == 'true' or with_mohawk == 'true'
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
@@ -5,7 +5,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
|
|
5
5
|
require 'rspec-expectations'
|
6
6
|
<% unless pageobject_driver.downcase == 'none' -%>
|
7
7
|
require 'page-object'
|
8
|
-
require 'page-object/page_factory'
|
9
8
|
<% end -%>
|
10
9
|
<% if with_lib == 'true' -%>
|
11
10
|
require 'require_all'
|
@@ -49,3 +48,20 @@ end
|
|
49
48
|
<% unless pageobject_driver.downcase == 'none' -%>
|
50
49
|
World(PageObject::PageFactory)
|
51
50
|
<% end -%>
|
51
|
+
|
52
|
+
<% if with_mohawk == 'true' -%>
|
53
|
+
require 'childprocess'
|
54
|
+
require 'mohawk'
|
55
|
+
|
56
|
+
World(Mohawk::Navigation)
|
57
|
+
|
58
|
+
Before do
|
59
|
+
@process = ChildProcess.build(PATH_TO_EXECUTABLE)
|
60
|
+
@process.start
|
61
|
+
RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @process.pid).present?}
|
62
|
+
end
|
63
|
+
|
64
|
+
After do
|
65
|
+
@process.stop
|
66
|
+
end
|
67
|
+
<% end -%>
|
data/lib/testgen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- features/testgen_with_pageobject.feature
|
115
115
|
- features/with_gametel_option.feature
|
116
116
|
- features/with_lib_option.feature
|
117
|
+
- features/with_mojawk_option.feature
|
117
118
|
- lib/testgen.rb
|
118
119
|
- lib/testgen/cli.rb
|
119
120
|
- lib/testgen/generators/project.rb
|
@@ -138,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
segments:
|
140
141
|
- 0
|
141
|
-
hash:
|
142
|
+
hash: -4519018053108254225
|
142
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
144
|
none: false
|
144
145
|
requirements:
|
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
version: '0'
|
148
149
|
segments:
|
149
150
|
- 0
|
150
|
-
hash:
|
151
|
+
hash: -4519018053108254225
|
151
152
|
requirements: []
|
152
153
|
rubyforge_project: testgen
|
153
154
|
rubygems_version: 1.8.24
|
@@ -161,3 +162,4 @@ test_files:
|
|
161
162
|
- features/testgen_with_pageobject.feature
|
162
163
|
- features/with_gametel_option.feature
|
163
164
|
- features/with_lib_option.feature
|
165
|
+
- features/with_mojawk_option.feature
|