cwtestgen 0.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.
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ cwtestgen
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p392
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gem 'fuubar'
5
+ gem 'fuubar-cucumber'
6
+ gem 'rb-fsevent', '~> 0.9.1'
7
+ gem 'growl'
8
+ gem 'guard-rspec'
9
+ gem 'guard-cucumber'
10
+
11
+ # Specify your gem's dependencies in testgen.gemspec
12
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
5
+ watch(%r{^features/.+\.feature$})
6
+ watch(%r{^features/support/.+$}) { 'features' }
7
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
8
+ watch(%r{^lib/.+\.rb$}) { "features" }
9
+ watch(%r{^lib/.+\.tt$}) { "features" }
10
+ watch(%r{^cucumber.yml$}) { "features" }
11
+ end
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'cucumber'
4
+ require 'cucumber/rake/task'
5
+
6
+
7
+ Cucumber::Rake::Task.new(:features, "Run features") do |t|
8
+ t.profile = 'default'
9
+ end
10
+
11
+ task :lib do
12
+ $LOAD_PATH.unshift(File.expand_path("lib", File.dirname(__FILE__)))
13
+ end
14
+
15
+ task :default => :features
data/Readme.md ADDED
@@ -0,0 +1,12 @@
1
+ # CwTestGen
2
+
3
+ Based on cheezy's Testgen gem, but modified for specific Clockwork test setup. All thanks go to cheezy / Jeff Morgan!
4
+
5
+ A gem that contains generators that create things Clockwork testers need.
6
+
7
+ Currently it only generates a cucumber project. You can do this by executing:
8
+
9
+ testgen project <project_name>
10
+
11
+ This command will create a project in the <em>project_name</em> directory with the files needed to begin
12
+ developing cucumber features.
data/bin/cwtestgen ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cwtestgen/cli'
4
+ CwTestGen::CLI.start
data/cucumber.yml ADDED
@@ -0,0 +1,3 @@
1
+ default: --no-source --color --format pretty
2
+ focus: --no-source --color --format pretty --tags @focus
3
+
data/cwtestgen.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cwtestgen/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "cwtestgen"
7
+ s.version = CwTestGen::VERSION
8
+ s.authors = ["Jeffrey S. Morgan", "Chris Smalley"]
9
+ s.email = ["chris@clockwork.net"]
10
+ s.homepage = "http://github.com/jonsie/cwtestgen"
11
+ s.summary = %q{Generators for Clockwork testers using Cucumber}
12
+ s.description = %q{Generates the Clockwork specific Cucumber testing environment}
13
+
14
+ s.rubyforge_project = "cwtestgen"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'thor', '>=0.17.0'
22
+ s.add_dependency 'cucumber', '>=1.2.0'
23
+ s.add_dependency 'rspec', '>=2.13.0'
24
+ s.add_dependency 'require_all'
25
+
26
+ s.add_development_dependency 'aruba'
27
+ end
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'bin'))
3
+
4
+ require 'aruba/cucumber'
5
+
6
+ require 'testgen'
@@ -0,0 +1,6 @@
1
+ require 'fileutils'
2
+
3
+ After do
4
+ dir = File.join(File.dirname(__FILE__), '../../', 'tmp/aruba/sample')
5
+ FileUtils.rm_rf dir
6
+ end
@@ -0,0 +1,43 @@
1
+ Feature: Generating a project with TestGen
2
+
3
+ Background:
4
+ When I run `testgen project sample`
5
+
6
+ Scenario: Creating the top level project directory
7
+ Then a directory named "sample" should exist
8
+
9
+ Scenario: Generating the cucumber.yml file
10
+ Then a file named "sample/cucumber.yml" should exist
11
+ And the file "sample/cucumber.yml" should contain "default: --no-source --color --format pretty"
12
+
13
+ Scenario: Generating the Gemfile file
14
+ Then a file named "sample/Gemfile" should exist
15
+ And the file "sample/Gemfile" should contain "gem 'cucumber'"
16
+ And the file "sample/Gemfile" should contain "gem 'rspec'"
17
+ And the file "sample/Gemfile" should contain "source 'http://rubygems.org'"
18
+
19
+
20
+ Scenario: Generating the Rakefile file
21
+ Then a file named "sample/Rakefile" should exist
22
+ And the file "sample/Rakefile" should contain "Cucumber::Rake::Task.new(:features)"
23
+ And the file "sample/Rakefile" should contain exactly:
24
+ """
25
+ require 'rubygems'
26
+ require 'cucumber'
27
+ require 'cucumber/rake/task'
28
+
29
+ Cucumber::Rake::Task.new(:features) do |t|
30
+ t.profile = 'default'
31
+ end
32
+
33
+ task :default => :features
34
+ """
35
+ Scenario: Creating the features set of directories
36
+ Then the following directories should exist:
37
+ | sample/features |
38
+ | sample/features/support |
39
+ | sample/features/step_definitions |
40
+
41
+ Scenario: Generating the env.rb file
42
+ Then a file named "sample/features/support/env.rb" should exist
43
+ And the file "sample/features/support/env.rb" should contain "require 'rspec-expectations'"
@@ -0,0 +1,30 @@
1
+ Feature: Adding support for the --pageobject-driver option
2
+
3
+
4
+ Scenario: Adding page-object to the Gemfile
5
+ When I run `testgen project sample --pageobject-driver=watir`
6
+ Then a file named "sample/Gemfile" should exist
7
+ And the file "sample/Gemfile" should contain "gem 'page-object'"
8
+
9
+ Scenario: Adding page-object to env.rb
10
+ When I run `testgen project sample --pageobject-driver=watir`
11
+ Then a file named "sample/features/support/env.rb" should exist
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 "World(PageObject::PageFactory)"
14
+
15
+ Scenario: Adding the hook file for Watir
16
+ When I run `testgen project sample --pageobject-driver=watir`
17
+ Then a file named "sample/features/support/hooks.rb" should exist
18
+ And the file "sample/features/support/hooks.rb" should contain "require 'watir-webdriver'"
19
+ And the file "sample/features/support/hooks.rb" should contain "@browser = Watir::Browser.new :firefox"
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 :firefox"
26
+
27
+ Scenario: Creating the pages directory
28
+ When I run `testgen project sample --pageobject-driver=selenium`
29
+ Then a directory named "sample/features/support/pages" should exist
30
+
@@ -0,0 +1,43 @@
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, keystore)"
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
+
32
+
33
+ Scenario: Should not create the hooks file
34
+ When I run `testgen project sample --with-gametel`
35
+ Then a file named "sample/features/support/hooks.rb" should not exist
36
+
37
+ Scenario: Creating the screens directory under support
38
+ When I run `testgen project sample --with-gametel`
39
+ Then a directory named "sample/features/support/screens" should exist
40
+
41
+ Scenario: Creating the screens directory under lib when using --wth-lib
42
+ When I run `testgen project sample --with-gametel --with-lib`
43
+ Then a directory named "sample/lib/screens" should exist
@@ -0,0 +1,24 @@
1
+ Feature: Adding the --with-lib flag
2
+
3
+ Background:
4
+ When I run `testgen project sample --with-lib --pageobject-driver=watir`
5
+
6
+ Scenario: Adding the require_all gem to Gemfile
7
+ Then a file named "sample/Gemfile" should exist
8
+ And the file "sample/Gemfile" should contain "gem 'require_all'"
9
+
10
+ Scenario: Creating the lib directory
11
+ Then a directory named "sample/lib" should exist
12
+
13
+ Scenario: Creating the pages directory in lib
14
+ Then a directory named "sample/lib/pages" should exist
15
+
16
+ Scenario: Adding lib to loadpath in env.rb
17
+ Then a file named "sample/features/support/env.rb" should exist
18
+ And the file "sample/features/support/env.rb" should contain "$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))"
19
+
20
+ Scenario: Adding require_all stuff to the env.rb
21
+ Then a file named "sample/features/support/env.rb" should exist
22
+ And the file "sample/features/support/env.rb" should contain "require 'require_all'"
23
+ And the file "sample/features/support/env.rb" should contain "require_all 'lib'"
24
+
@@ -0,0 +1,37 @@
1
+ Feature: Adding the --with-mohawk flag
2
+
3
+ Scenario: Adding the childprocess and mohawk gems to Gemfile
4
+ When I run `testgen project sample --with-mohawk`
5
+ Then a file named "sample/Gemfile" should exist
6
+ And the file "sample/Gemfile" should contain "gem 'childprocess'"
7
+ And the file "sample/Gemfile" should contain "gem 'mohawk'"
8
+ And the file "sample/Gemfile" should contain "gem 'rake'"
9
+
10
+ Scenario: Adding mohawk to env.rb
11
+ When I run `testgen project sample --with-mohawk`
12
+ Then a file named "sample/features/support/env.rb" should exist
13
+ And the file "sample/features/support/env.rb" should contain "require 'childprocess'"
14
+ And the file "sample/features/support/env.rb" should contain "require 'mohawk'"
15
+ And the file "sample/features/support/env.rb" should contain "World(Mohawk::Navigation)"
16
+
17
+ Scenario: Creating the Driver and hooks
18
+ When I run `testgen project sample --with-mohawk`
19
+ Then a file named "sample/features/support/env.rb" should exist
20
+ And the file "sample/features/support/env.rb" should contain "@process = ChildProcess.build(PATH_TO_EXECUTABLE)"
21
+ And the file "sample/features/support/env.rb" should contain "@process.start"
22
+ And the file "sample/features/support/env.rb" should contain "RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @process.pid).present?"
23
+ And the file "sample/features/support/env.rb" should contain "@process.stop"
24
+
25
+
26
+ Scenario: Should not create the hooks file
27
+ When I run `testgen project sample --with-mohawk`
28
+ Then a file named "sample/features/support/hooks.rb" should not exist
29
+
30
+ Scenario: Creating the screens directory under support
31
+ When I run `testgen project sample --with-mohawk`
32
+ Then a directory named "sample/features/support/screens" should exist
33
+
34
+ Scenario: Creating the screens directory under lib when using --wth-lib
35
+ When I run `testgen project sample --with-mohawk --with-lib`
36
+ Then a directory named "sample/lib/screens" should exist
37
+
@@ -0,0 +1,11 @@
1
+ require 'thor'
2
+ require 'cwtestgen/generators/project'
3
+
4
+ module CwTestGen
5
+ class CLI < Thor
6
+ desc "project <project_name>", "Create a new test project"
7
+ def project(name)
8
+ CwTestGen::Generators::Project.start([name])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'cucumber'
3
+ require 'cucumber/rake/task'
4
+
5
+ Cucumber::Rake::Task.new(:features) do |t|
6
+ t.profile = 'default'
7
+ end
8
+
9
+ task :default => :features
@@ -0,0 +1 @@
1
+ default: --no-source --color --format pretty
@@ -0,0 +1,28 @@
1
+ require 'page-object'
2
+ require 'page-object/page_factory'
3
+ require 'faker'
4
+ require 'require_all'
5
+ require 'rspec-expectations'
6
+ World(PageObject::PageFactory)
7
+
8
+ # Global variables
9
+ $live_url = ""
10
+ $amm_url = ""
11
+ $default_email = ""
12
+ $default_password = ""
13
+
14
+ $log = Logger.new(File.expand_path(File.dirname(File.dirname(__FILE__)))+'/logs/log.txt', 'daily')
15
+ $log.level = Logger::DEBUG
16
+
17
+ PageObject.javascript_framework = :jquery
18
+
19
+ browser = Watir::Browser.new :ff
20
+
21
+ Before do
22
+ @browser = browser
23
+ @browser.window.resize_to(1024, 768)
24
+ end
25
+
26
+ at_exit do
27
+ browser.close
28
+ end
@@ -0,0 +1,45 @@
1
+ require 'thor/group'
2
+
3
+ module CwTestGen
4
+ module Generators
5
+ class Project < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :name, :type => :string, :desc => 'The name of the project'
9
+ desc "Generates a project structure for testing with Cucumber"
10
+
11
+ def self.source_root
12
+ File.dirname(__FILE__) + "/project"
13
+ end
14
+
15
+ def create_top_directory
16
+ empty_directory(name)
17
+ end
18
+
19
+ def copy_cucumber_yml
20
+ template "cucumber.yml.tt", "#{name}/cucumber.yml"
21
+ end
22
+
23
+ def create_cucumber_directories
24
+ empty_directory("#{name}/features")
25
+ empty_directory("#{name}/features/support")
26
+ empty_directory("#{name}/features/step_definitions")
27
+ end
28
+
29
+ def create_log_directory
30
+ empty_directory("#{name}/features/logs")
31
+ end
32
+
33
+ def copy_env
34
+ template "env.rb.tt", "#{name}/features/support/env.rb"
35
+ end
36
+
37
+ def create_pages_directory
38
+ empty_directory("#{name}/features/support/pages")
39
+ end
40
+
41
+ private
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module CwTestGen
2
+ VERSION = "0.1"
3
+ end
data/lib/cwtestgen.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "cwtestgen/version"
2
+ require 'cwtestgen/cli'
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cwtestgen
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jeffrey S. Morgan
9
+ - Chris Smalley
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-04-17 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thor
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.17.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.17.0
31
+ - !ruby/object:Gem::Dependency
32
+ name: cucumber
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 1.2.0
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.2.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.13.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 2.13.0
63
+ - !ruby/object:Gem::Dependency
64
+ name: require_all
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: aruba
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: Generates the Clockwork specific Cucumber testing environment
96
+ email:
97
+ - chris@clockwork.net
98
+ executables:
99
+ - cwtestgen
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - .DS_Store
104
+ - .gitignore
105
+ - .ruby-gemset
106
+ - .ruby-version
107
+ - Gemfile
108
+ - Guardfile
109
+ - Rakefile
110
+ - Readme.md
111
+ - bin/cwtestgen
112
+ - cucumber.yml
113
+ - cwtestgen.gemspec
114
+ - features/support/env.rb
115
+ - features/support/hooks.rb
116
+ - features/testgen_project.feature
117
+ - features/testgen_with_pageobject.feature
118
+ - features/with_gametel_option.feature
119
+ - features/with_lib_option.feature
120
+ - features/with_mojawk_option.feature
121
+ - lib/cwtestgen.rb
122
+ - lib/cwtestgen/cli.rb
123
+ - lib/cwtestgen/generators/project.rb
124
+ - lib/cwtestgen/generators/project/Rakefile
125
+ - lib/cwtestgen/generators/project/cucumber.yml.tt
126
+ - lib/cwtestgen/generators/project/env.rb.tt
127
+ - lib/cwtestgen/version.rb
128
+ homepage: http://github.com/jonsie/cwtestgen
129
+ licenses: []
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project: cwtestgen
148
+ rubygems_version: 1.8.25
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Generators for Clockwork testers using Cucumber
152
+ test_files:
153
+ - features/support/env.rb
154
+ - features/support/hooks.rb
155
+ - features/testgen_project.feature
156
+ - features/testgen_with_pageobject.feature
157
+ - features/with_gametel_option.feature
158
+ - features/with_lib_option.feature
159
+ - features/with_mojawk_option.feature