testnow 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENCE +20 -20
- data/README.md +213 -197
- data/Rakefile +8 -8
- data/bin/testnow +287 -287
- data/data/firebug-2.0.13.xpi +0 -0
- data/data/netExport-0.8.xpi +0 -0
- data/data/showtime/Gemfile +5 -5
- data/data/showtime/Gemfile_rspec +4 -4
- data/data/showtime/Rakefile +4 -4
- data/data/showtime/Rakefile_rspec +7 -7
- data/data/showtime/env.rb +7 -7
- data/data/showtime/github.feature +11 -11
- data/data/showtime/github_page.rb +29 -33
- data/data/showtime/github_spec.rb +17 -17
- data/data/showtime/github_steps.rb +23 -23
- data/data/showtime/hooks.rb +39 -39
- data/data/showtime/spec_helper.rb +20 -20
- data/data/showtime/watir/Gemfile +6 -6
- data/data/showtime/watir/Gemfile_rspec +6 -6
- data/data/showtime/watir/env.rb +8 -8
- data/data/showtime/watir/github_page.rb +28 -32
- data/data/showtime/watir/github_spec.rb +17 -17
- data/data/showtime/watir/github_steps.rb +23 -23
- data/data/showtime/watir/hooks.rb +39 -39
- data/data/showtime/watir/spec_helper.rb +21 -21
- data/lib/testnow.rb +78 -79
- data/lib/testnow/android_chrome.rb +26 -26
- data/lib/testnow/chrome.rb +47 -22
- data/lib/testnow/edge.rb +34 -34
- data/lib/testnow/firefox.rb +54 -54
- data/lib/testnow/firefox_gecko.rb +30 -30
- data/lib/testnow/ie.rb +45 -45
- data/lib/testnow/opera.rb +45 -41
- data/lib/testnow/version +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/testnow/testnow_spec.rb +48 -0
- metadata +22 -18
- data/lib/testnow/android.rb +0 -8
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
namespace :testnow do
|
5
|
-
RSpec::Core::RakeTask.new('unit_test') do |t|
|
6
|
-
t.pattern = "spec/testnow/*_spec.rb"
|
7
|
-
end
|
8
|
-
|
1
|
+
require 'rake'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
namespace :testnow do
|
5
|
+
RSpec::Core::RakeTask.new('unit_test') do |t|
|
6
|
+
t.pattern = "spec/testnow/*_spec.rb"
|
7
|
+
end
|
8
|
+
|
9
9
|
end
|
data/bin/testnow
CHANGED
@@ -1,288 +1,288 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
@showtime_dir = File.join(File.dirname(__FILE__) + "/../data/showtime")
|
6
|
-
|
7
|
-
def cucumber_now(framework="cucumber")
|
8
|
-
|
9
|
-
if framework == "watir"
|
10
|
-
@base = "watir_cucumber_now"
|
11
|
-
else
|
12
|
-
@base = "cucumber_now"
|
13
|
-
end
|
14
|
-
@root_dir = File.join(FileUtils.pwd, @base)
|
15
|
-
@feature_dir = File.join(@root_dir,'features')
|
16
|
-
@scenario_dir = File.join(@feature_dir, 'scenarios')
|
17
|
-
@steps_dir = File.join(@feature_dir,'step_definition')
|
18
|
-
@page_dir = File.join(@feature_dir, 'pages')
|
19
|
-
@support_dir = File.join(@feature_dir,'support')
|
20
|
-
@report_dir = File.join(@root_dir, 'reports')
|
21
|
-
|
22
|
-
if File.exist?(@root_dir)
|
23
|
-
print "There is already #{@base} directory. Either delete it or try running the command from some other directory."
|
24
|
-
exit 1
|
25
|
-
end
|
26
|
-
|
27
|
-
if framework == "watir"
|
28
|
-
puts "\n"+"*"*76
|
29
|
-
puts "* TestNow is creating a Watir-WebDriver-Ruby-Cucumber framework for you. *"
|
30
|
-
puts "*"*76
|
31
|
-
else
|
32
|
-
puts "\n"+"*"*70
|
33
|
-
puts "* TestNow is creating a WebDriver-Ruby-Cucumber framework for you. *"
|
34
|
-
puts "*"*70
|
35
|
-
end
|
36
|
-
|
37
|
-
print "Creating project directory."
|
38
|
-
FileUtils.makedirs(@root_dir)
|
39
|
-
|
40
|
-
print "Creating features directory."
|
41
|
-
FileUtils.makedirs(@feature_dir)
|
42
|
-
|
43
|
-
print "Creating the scenarios directory to contain the feature files."
|
44
|
-
FileUtils.makedirs(@scenario_dir)
|
45
|
-
|
46
|
-
print "Creating the steps directory to contain the step definition files"
|
47
|
-
FileUtils.makedirs(@steps_dir)
|
48
|
-
|
49
|
-
print "Creating the page directory just in case if you want to use page object pattern."
|
50
|
-
FileUtils.makedirs(@page_dir)
|
51
|
-
|
52
|
-
print "Creating a support directory which will contain all the configs"
|
53
|
-
FileUtils.makedirs(@support_dir)
|
54
|
-
|
55
|
-
print "Creating the reports directory where the reports will be save after execution."
|
56
|
-
FileUtils.makedirs(@report_dir)
|
57
|
-
|
58
|
-
print "Creating feature file inside scenarios directory."
|
59
|
-
FileUtils.copy(@showtime_dir+"/github.feature", @scenario_dir)
|
60
|
-
|
61
|
-
if framework == "watir"
|
62
|
-
print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
|
63
|
-
FileUtils.copy(@showtime_dir+"/watir/hooks.rb", @support_dir)
|
64
|
-
print "Creating config files -- env.rb -- used as cucumber config"
|
65
|
-
FileUtils.copy(@showtime_dir+"/watir/env.rb", @support_dir)
|
66
|
-
|
67
|
-
print "Creating step definition file inside the steps directory"
|
68
|
-
FileUtils.copy(@showtime_dir+"/watir/github_steps.rb", @steps_dir)
|
69
|
-
|
70
|
-
print "Creating page class file inside the page directory."
|
71
|
-
FileUtils.copy(@showtime_dir+"/watir/github_page.rb", @page_dir)
|
72
|
-
|
73
|
-
print "Creating Gemfile -- used to contain all required gems information."
|
74
|
-
FileUtils.copy(@showtime_dir+"/watir/Gemfile", @root_dir)
|
75
|
-
else
|
76
|
-
print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
|
77
|
-
FileUtils.copy(@showtime_dir+"/hooks.rb", @support_dir)
|
78
|
-
print "Creating config files -- env.rb -- used as cucumber config"
|
79
|
-
FileUtils.copy(@showtime_dir+"/env.rb", @support_dir)
|
80
|
-
|
81
|
-
print "Creating step definition file inside the steps directory"
|
82
|
-
FileUtils.copy(@showtime_dir+"/github_steps.rb", @steps_dir)
|
83
|
-
|
84
|
-
print "Creating page class file inside the page directory."
|
85
|
-
FileUtils.copy(@showtime_dir+"/github_page.rb", @page_dir)
|
86
|
-
|
87
|
-
print "Creating Gemfile -- used to contain all required gems information."
|
88
|
-
FileUtils.copy(@showtime_dir+"/Gemfile", @root_dir)
|
89
|
-
end
|
90
|
-
|
91
|
-
print "Creating Rakefile -- used to write automation execution tasks."
|
92
|
-
FileUtils.copy(@showtime_dir+"/Rakefile", @root_dir)
|
93
|
-
|
94
|
-
print "Creating cucumber.yml -- used to provide cucumber options"
|
95
|
-
FileUtils.copy(@showtime_dir+"/cucumber.yml", @root_dir)
|
96
|
-
|
97
|
-
puts "\n"+"*"*97
|
98
|
-
puts "* TestNow completed framework creation. A sample scenario is also created for your reference. *"
|
99
|
-
puts "*"*97
|
100
|
-
|
101
|
-
puts "\nWould you like to continue with dependency(gems) installation? (Y/n) :"
|
102
|
-
ans=gets
|
103
|
-
if ans.chomp.downcase == "y"
|
104
|
-
print "TestNow is installing gems using bundler. Please wait till process completed."
|
105
|
-
system("bundle install --gemfile=$(pwd)/#{@base}/Gemfile")
|
106
|
-
print "Dependency installation completed successfully.\n\n"
|
107
|
-
else
|
108
|
-
print "You can do this later also. Just cd into cucumber_now directory and run 'bundle install'\n\n"
|
109
|
-
exit 1
|
110
|
-
end
|
111
|
-
|
112
|
-
puts "\n"+"*"*80
|
113
|
-
if framework == "watir"
|
114
|
-
puts "* Congratulations!!! Your Watir-WebDriver-Ruby-Cucumber *"
|
115
|
-
puts "* framework is ready to use. *"
|
116
|
-
puts "* To run the sample test, please cd into watir_cucumber_now directory *"
|
117
|
-
else
|
118
|
-
puts "* Congratulations!!! Your WebDriver-Ruby-Cucumber framework is ready to use. *"
|
119
|
-
puts "* To run the sample test, please cd into cucumber_now directory *"
|
120
|
-
end
|
121
|
-
puts "* and run the command 'cucumber features' or 'rake testnow' *"
|
122
|
-
puts "* A beautiful screenshot embedded report will be created in reports directory. *"
|
123
|
-
puts "* !!! HAPPY AUTOMATION !!! *"
|
124
|
-
puts "*"*80+"\n\n\n"
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
def rspec_now(framework="cucumber")
|
130
|
-
if framework == "watir"
|
131
|
-
@base = "watir_rspec_now"
|
132
|
-
else
|
133
|
-
@base = "rspec_now"
|
134
|
-
end
|
135
|
-
@root_dir = File.join(FileUtils.pwd, @base)
|
136
|
-
@spec_dir = File.join(@root_dir, "spec")
|
137
|
-
@scenario_dir = File.join(@spec_dir, "scenarios")
|
138
|
-
@pages_dir = File.join(@root_dir, "pages")
|
139
|
-
|
140
|
-
if File.exist?(@root_dir)
|
141
|
-
print "There is already #{@base} directory. Either delete it or try running the command from some other directory."
|
142
|
-
exit 1
|
143
|
-
end
|
144
|
-
|
145
|
-
if framework == "watir"
|
146
|
-
puts "\n"+"*"*73
|
147
|
-
puts "* TestNow is creating a Watir-WebDriver-Ruby-RSpec framework for you. *"
|
148
|
-
puts "*"*73
|
149
|
-
else
|
150
|
-
puts "\n"+"*"*67
|
151
|
-
puts "* TestNow is creating a WebDriver-Ruby-RSpec framework for you. *"
|
152
|
-
puts "*"*67
|
153
|
-
end
|
154
|
-
|
155
|
-
print "Creating project directory."
|
156
|
-
FileUtils.makedirs(@root_dir)
|
157
|
-
|
158
|
-
print "Creating spec directory."
|
159
|
-
FileUtils.makedirs(@spec_dir)
|
160
|
-
|
161
|
-
print "Creating the scenarios directory to contain the spec files."
|
162
|
-
FileUtils.makedirs(@scenario_dir)
|
163
|
-
|
164
|
-
print "Creating the page directory just in case if you want to use page object pattern."
|
165
|
-
FileUtils.makedirs(@pages_dir)
|
166
|
-
|
167
|
-
if framework == "watir"
|
168
|
-
print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
|
169
|
-
FileUtils.copy(@showtime_dir+"/watir/spec_helper.rb", @spec_dir)
|
170
|
-
|
171
|
-
print "Creating Gemfile -- used to contain all required gems information."
|
172
|
-
FileUtils.copy(@showtime_dir+"/watir/Gemfile_rspec", @root_dir+"/Gemfile")
|
173
|
-
|
174
|
-
print "Creating spec file inside the scenarios directory."
|
175
|
-
FileUtils.copy(@showtime_dir+"/watir/github_spec.rb", @scenario_dir)
|
176
|
-
|
177
|
-
print "Creating page class file inside the pages directory."
|
178
|
-
FileUtils.copy(@showtime_dir+"/watir/github_page.rb", @pages_dir)
|
179
|
-
else
|
180
|
-
print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
|
181
|
-
FileUtils.copy(@showtime_dir+"/spec_helper.rb", @spec_dir)
|
182
|
-
|
183
|
-
print "Creating Gemfile -- used to contain all required gems information."
|
184
|
-
FileUtils.copy(@showtime_dir+"/Gemfile_rspec", @root_dir+"/Gemfile")
|
185
|
-
|
186
|
-
print "Creating spec file inside the scenarios directory."
|
187
|
-
FileUtils.copy(@showtime_dir+"/github_spec.rb", @scenario_dir)
|
188
|
-
|
189
|
-
print "Creating page class file inside the pages directory."
|
190
|
-
FileUtils.copy(@showtime_dir+"/github_page.rb", @pages_dir)
|
191
|
-
end
|
192
|
-
|
193
|
-
print "Creating Rakefile -- used to write automation execution tasks."
|
194
|
-
FileUtils.copy(@showtime_dir+"/Rakefile_rspec", @root_dir+"/Rakefile")
|
195
|
-
|
196
|
-
puts "\n Would you like to continue with dependency(gems) installation? (Y/n) :"
|
197
|
-
ans=gets
|
198
|
-
if ans.chomp.downcase == "y"
|
199
|
-
print "TestNow is installing gems using bundler. Please wait till process completed."
|
200
|
-
system("bundle install --gemfile=$(pwd)/#{@base}/Gemfile")
|
201
|
-
print "Dependency installation completed successfully.\n"
|
202
|
-
else
|
203
|
-
print "You can do this later. Just cd into #{@base} directory and run 'bundle install'\n\n"
|
204
|
-
exit 1
|
205
|
-
end
|
206
|
-
|
207
|
-
puts "\n"+"*"*77
|
208
|
-
if framework == "watir"
|
209
|
-
puts "* Congratulations!!! Your Watir-WebDriver-RSpec-Ruby *"
|
210
|
-
puts "* framework is ready to use. *"
|
211
|
-
puts "* To run the sample test, please cd into watir_rspec_now directory *"
|
212
|
-
else
|
213
|
-
puts "* Congratulations!!! Your WebDriver-RSpec-Ruby framework is ready to use. *"
|
214
|
-
puts "* To run the sample test, please cd into rspec_now directory *"
|
215
|
-
end
|
216
|
-
puts "* and run the command 'rake testnow'. Enjoy the show!!! *"
|
217
|
-
puts "* A beautiful descriptive report will be created in reports directory. *"
|
218
|
-
puts "* !!! HAPPY AUTOMATION !!! *"
|
219
|
-
puts "*"*77+"\n"
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
|
224
|
-
def print(msg)
|
225
|
-
puts "\n"
|
226
|
-
puts "=>=>=> " + msg
|
227
|
-
sleep 0.5
|
228
|
-
end
|
229
|
-
|
230
|
-
def print_help
|
231
|
-
puts <<MSG
|
232
|
-
|
233
|
-
Usage: testnow <command-name>
|
234
|
-
|
235
|
-
<command-name> can be one of
|
236
|
-
help
|
237
|
-
cucumber_now
|
238
|
-
rspec_now
|
239
|
-
watir_cucumber_now
|
240
|
-
watir_rspec_now
|
241
|
-
version
|
242
|
-
|
243
|
-
|
244
|
-
Command descriptions :
|
245
|
-
|
246
|
-
help : Prints help information in detail.
|
247
|
-
|
248
|
-
cucumber_now : Creates a WebDriver-Ruby-Cucumber skeleton framework for cross
|
249
|
-
browser automation testing. Also creates a sample scenario for
|
250
|
-
reference which can be used to add more features(tests).
|
251
|
-
|
252
|
-
rspec_now : Creates a WebDriver-Ruby-RSpec skeleton framework for cross
|
253
|
-
browser automation testing. Also creates a sample scenario for
|
254
|
-
reference which can be used to add more specs(tests).
|
255
|
-
|
256
|
-
watir_cucumber_now : Creates a Watir-WebDriver-Ruby-Cucumber skeleton framework for
|
257
|
-
cross browser automation testing. Also creates a sample scenario
|
258
|
-
for reference which can be used to add more features(tests).
|
259
|
-
|
260
|
-
watir_rspec_now : Creates a Watir-WebDriver-Ruby-RSpec skeleton framework for cross
|
261
|
-
browser automation testing. Also creates a sample scenario for
|
262
|
-
reference which can be used to add more specs(tests).
|
263
|
-
|
264
|
-
version : Prints the gem version
|
265
|
-
|
266
|
-
MSG
|
267
|
-
end
|
268
|
-
|
269
|
-
if ARGV.length == 0
|
270
|
-
print_help
|
271
|
-
else
|
272
|
-
cmd = ARGV.shift
|
273
|
-
if cmd == 'help'
|
274
|
-
print_help
|
275
|
-
elsif cmd == 'cucumber_now'
|
276
|
-
cucumber_now
|
277
|
-
elsif cmd == 'rspec_now'
|
278
|
-
rspec_now
|
279
|
-
elsif cmd == 'watir_cucumber_now'
|
280
|
-
cucumber_now("watir")
|
281
|
-
elsif cmd == 'watir_rspec_now'
|
282
|
-
rspec_now("watir")
|
283
|
-
elsif cmd == 'version'
|
284
|
-
puts File.read(File.expand_path("../../lib/testnow/version", __FILE__))
|
285
|
-
else
|
286
|
-
print_help
|
287
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
@showtime_dir = File.join(File.dirname(__FILE__) + "/../data/showtime")
|
6
|
+
|
7
|
+
def cucumber_now(framework="cucumber")
|
8
|
+
|
9
|
+
if framework == "watir"
|
10
|
+
@base = "watir_cucumber_now"
|
11
|
+
else
|
12
|
+
@base = "cucumber_now"
|
13
|
+
end
|
14
|
+
@root_dir = File.join(FileUtils.pwd, @base)
|
15
|
+
@feature_dir = File.join(@root_dir,'features')
|
16
|
+
@scenario_dir = File.join(@feature_dir, 'scenarios')
|
17
|
+
@steps_dir = File.join(@feature_dir,'step_definition')
|
18
|
+
@page_dir = File.join(@feature_dir, 'pages')
|
19
|
+
@support_dir = File.join(@feature_dir,'support')
|
20
|
+
@report_dir = File.join(@root_dir, 'reports')
|
21
|
+
|
22
|
+
if File.exist?(@root_dir)
|
23
|
+
print "There is already #{@base} directory. Either delete it or try running the command from some other directory."
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
|
27
|
+
if framework == "watir"
|
28
|
+
puts "\n"+"*"*76
|
29
|
+
puts "* TestNow is creating a Watir-WebDriver-Ruby-Cucumber framework for you. *"
|
30
|
+
puts "*"*76
|
31
|
+
else
|
32
|
+
puts "\n"+"*"*70
|
33
|
+
puts "* TestNow is creating a WebDriver-Ruby-Cucumber framework for you. *"
|
34
|
+
puts "*"*70
|
35
|
+
end
|
36
|
+
|
37
|
+
print "Creating project directory."
|
38
|
+
FileUtils.makedirs(@root_dir)
|
39
|
+
|
40
|
+
print "Creating features directory."
|
41
|
+
FileUtils.makedirs(@feature_dir)
|
42
|
+
|
43
|
+
print "Creating the scenarios directory to contain the feature files."
|
44
|
+
FileUtils.makedirs(@scenario_dir)
|
45
|
+
|
46
|
+
print "Creating the steps directory to contain the step definition files"
|
47
|
+
FileUtils.makedirs(@steps_dir)
|
48
|
+
|
49
|
+
print "Creating the page directory just in case if you want to use page object pattern."
|
50
|
+
FileUtils.makedirs(@page_dir)
|
51
|
+
|
52
|
+
print "Creating a support directory which will contain all the configs"
|
53
|
+
FileUtils.makedirs(@support_dir)
|
54
|
+
|
55
|
+
print "Creating the reports directory where the reports will be save after execution."
|
56
|
+
FileUtils.makedirs(@report_dir)
|
57
|
+
|
58
|
+
print "Creating feature file inside scenarios directory."
|
59
|
+
FileUtils.copy(@showtime_dir+"/github.feature", @scenario_dir)
|
60
|
+
|
61
|
+
if framework == "watir"
|
62
|
+
print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
|
63
|
+
FileUtils.copy(@showtime_dir+"/watir/hooks.rb", @support_dir)
|
64
|
+
print "Creating config files -- env.rb -- used as cucumber config"
|
65
|
+
FileUtils.copy(@showtime_dir+"/watir/env.rb", @support_dir)
|
66
|
+
|
67
|
+
print "Creating step definition file inside the steps directory"
|
68
|
+
FileUtils.copy(@showtime_dir+"/watir/github_steps.rb", @steps_dir)
|
69
|
+
|
70
|
+
print "Creating page class file inside the page directory."
|
71
|
+
FileUtils.copy(@showtime_dir+"/watir/github_page.rb", @page_dir)
|
72
|
+
|
73
|
+
print "Creating Gemfile -- used to contain all required gems information."
|
74
|
+
FileUtils.copy(@showtime_dir+"/watir/Gemfile", @root_dir)
|
75
|
+
else
|
76
|
+
print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
|
77
|
+
FileUtils.copy(@showtime_dir+"/hooks.rb", @support_dir)
|
78
|
+
print "Creating config files -- env.rb -- used as cucumber config"
|
79
|
+
FileUtils.copy(@showtime_dir+"/env.rb", @support_dir)
|
80
|
+
|
81
|
+
print "Creating step definition file inside the steps directory"
|
82
|
+
FileUtils.copy(@showtime_dir+"/github_steps.rb", @steps_dir)
|
83
|
+
|
84
|
+
print "Creating page class file inside the page directory."
|
85
|
+
FileUtils.copy(@showtime_dir+"/github_page.rb", @page_dir)
|
86
|
+
|
87
|
+
print "Creating Gemfile -- used to contain all required gems information."
|
88
|
+
FileUtils.copy(@showtime_dir+"/Gemfile", @root_dir)
|
89
|
+
end
|
90
|
+
|
91
|
+
print "Creating Rakefile -- used to write automation execution tasks."
|
92
|
+
FileUtils.copy(@showtime_dir+"/Rakefile", @root_dir)
|
93
|
+
|
94
|
+
print "Creating cucumber.yml -- used to provide cucumber options"
|
95
|
+
FileUtils.copy(@showtime_dir+"/cucumber.yml", @root_dir)
|
96
|
+
|
97
|
+
puts "\n"+"*"*97
|
98
|
+
puts "* TestNow completed framework creation. A sample scenario is also created for your reference. *"
|
99
|
+
puts "*"*97
|
100
|
+
|
101
|
+
puts "\nWould you like to continue with dependency(gems) installation? (Y/n) :"
|
102
|
+
ans=gets
|
103
|
+
if ans.chomp.downcase == "y"
|
104
|
+
print "TestNow is installing gems using bundler. Please wait till process completed."
|
105
|
+
system("bundle install --gemfile=$(pwd)/#{@base}/Gemfile")
|
106
|
+
print "Dependency installation completed successfully.\n\n"
|
107
|
+
else
|
108
|
+
print "You can do this later also. Just cd into cucumber_now directory and run 'bundle install'\n\n"
|
109
|
+
exit 1
|
110
|
+
end
|
111
|
+
|
112
|
+
puts "\n"+"*"*80
|
113
|
+
if framework == "watir"
|
114
|
+
puts "* Congratulations!!! Your Watir-WebDriver-Ruby-Cucumber *"
|
115
|
+
puts "* framework is ready to use. *"
|
116
|
+
puts "* To run the sample test, please cd into watir_cucumber_now directory *"
|
117
|
+
else
|
118
|
+
puts "* Congratulations!!! Your WebDriver-Ruby-Cucumber framework is ready to use. *"
|
119
|
+
puts "* To run the sample test, please cd into cucumber_now directory *"
|
120
|
+
end
|
121
|
+
puts "* and run the command 'cucumber features' or 'rake testnow' *"
|
122
|
+
puts "* A beautiful screenshot embedded report will be created in reports directory. *"
|
123
|
+
puts "* !!! HAPPY AUTOMATION !!! *"
|
124
|
+
puts "*"*80+"\n\n\n"
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def rspec_now(framework="cucumber")
|
130
|
+
if framework == "watir"
|
131
|
+
@base = "watir_rspec_now"
|
132
|
+
else
|
133
|
+
@base = "rspec_now"
|
134
|
+
end
|
135
|
+
@root_dir = File.join(FileUtils.pwd, @base)
|
136
|
+
@spec_dir = File.join(@root_dir, "spec")
|
137
|
+
@scenario_dir = File.join(@spec_dir, "scenarios")
|
138
|
+
@pages_dir = File.join(@root_dir, "pages")
|
139
|
+
|
140
|
+
if File.exist?(@root_dir)
|
141
|
+
print "There is already #{@base} directory. Either delete it or try running the command from some other directory."
|
142
|
+
exit 1
|
143
|
+
end
|
144
|
+
|
145
|
+
if framework == "watir"
|
146
|
+
puts "\n"+"*"*73
|
147
|
+
puts "* TestNow is creating a Watir-WebDriver-Ruby-RSpec framework for you. *"
|
148
|
+
puts "*"*73
|
149
|
+
else
|
150
|
+
puts "\n"+"*"*67
|
151
|
+
puts "* TestNow is creating a WebDriver-Ruby-RSpec framework for you. *"
|
152
|
+
puts "*"*67
|
153
|
+
end
|
154
|
+
|
155
|
+
print "Creating project directory."
|
156
|
+
FileUtils.makedirs(@root_dir)
|
157
|
+
|
158
|
+
print "Creating spec directory."
|
159
|
+
FileUtils.makedirs(@spec_dir)
|
160
|
+
|
161
|
+
print "Creating the scenarios directory to contain the spec files."
|
162
|
+
FileUtils.makedirs(@scenario_dir)
|
163
|
+
|
164
|
+
print "Creating the page directory just in case if you want to use page object pattern."
|
165
|
+
FileUtils.makedirs(@pages_dir)
|
166
|
+
|
167
|
+
if framework == "watir"
|
168
|
+
print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
|
169
|
+
FileUtils.copy(@showtime_dir+"/watir/spec_helper.rb", @spec_dir)
|
170
|
+
|
171
|
+
print "Creating Gemfile -- used to contain all required gems information."
|
172
|
+
FileUtils.copy(@showtime_dir+"/watir/Gemfile_rspec", @root_dir+"/Gemfile")
|
173
|
+
|
174
|
+
print "Creating spec file inside the scenarios directory."
|
175
|
+
FileUtils.copy(@showtime_dir+"/watir/github_spec.rb", @scenario_dir)
|
176
|
+
|
177
|
+
print "Creating page class file inside the pages directory."
|
178
|
+
FileUtils.copy(@showtime_dir+"/watir/github_page.rb", @pages_dir)
|
179
|
+
else
|
180
|
+
print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
|
181
|
+
FileUtils.copy(@showtime_dir+"/spec_helper.rb", @spec_dir)
|
182
|
+
|
183
|
+
print "Creating Gemfile -- used to contain all required gems information."
|
184
|
+
FileUtils.copy(@showtime_dir+"/Gemfile_rspec", @root_dir+"/Gemfile")
|
185
|
+
|
186
|
+
print "Creating spec file inside the scenarios directory."
|
187
|
+
FileUtils.copy(@showtime_dir+"/github_spec.rb", @scenario_dir)
|
188
|
+
|
189
|
+
print "Creating page class file inside the pages directory."
|
190
|
+
FileUtils.copy(@showtime_dir+"/github_page.rb", @pages_dir)
|
191
|
+
end
|
192
|
+
|
193
|
+
print "Creating Rakefile -- used to write automation execution tasks."
|
194
|
+
FileUtils.copy(@showtime_dir+"/Rakefile_rspec", @root_dir+"/Rakefile")
|
195
|
+
|
196
|
+
puts "\n Would you like to continue with dependency(gems) installation? (Y/n) :"
|
197
|
+
ans=gets
|
198
|
+
if ans.chomp.downcase == "y"
|
199
|
+
print "TestNow is installing gems using bundler. Please wait till process completed."
|
200
|
+
system("bundle install --gemfile=$(pwd)/#{@base}/Gemfile")
|
201
|
+
print "Dependency installation completed successfully.\n"
|
202
|
+
else
|
203
|
+
print "You can do this later. Just cd into #{@base} directory and run 'bundle install'\n\n"
|
204
|
+
exit 1
|
205
|
+
end
|
206
|
+
|
207
|
+
puts "\n"+"*"*77
|
208
|
+
if framework == "watir"
|
209
|
+
puts "* Congratulations!!! Your Watir-WebDriver-RSpec-Ruby *"
|
210
|
+
puts "* framework is ready to use. *"
|
211
|
+
puts "* To run the sample test, please cd into watir_rspec_now directory *"
|
212
|
+
else
|
213
|
+
puts "* Congratulations!!! Your WebDriver-RSpec-Ruby framework is ready to use. *"
|
214
|
+
puts "* To run the sample test, please cd into rspec_now directory *"
|
215
|
+
end
|
216
|
+
puts "* and run the command 'rake testnow'. Enjoy the show!!! *"
|
217
|
+
puts "* A beautiful descriptive report will be created in reports directory. *"
|
218
|
+
puts "* !!! HAPPY AUTOMATION !!! *"
|
219
|
+
puts "*"*77+"\n"
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
def print(msg)
|
225
|
+
puts "\n"
|
226
|
+
puts "=>=>=> " + msg
|
227
|
+
sleep 0.5
|
228
|
+
end
|
229
|
+
|
230
|
+
def print_help
|
231
|
+
puts <<MSG
|
232
|
+
|
233
|
+
Usage: testnow <command-name>
|
234
|
+
|
235
|
+
<command-name> can be one of
|
236
|
+
help
|
237
|
+
cucumber_now
|
238
|
+
rspec_now
|
239
|
+
watir_cucumber_now
|
240
|
+
watir_rspec_now
|
241
|
+
version
|
242
|
+
|
243
|
+
|
244
|
+
Command descriptions :
|
245
|
+
|
246
|
+
help : Prints help information in detail.
|
247
|
+
|
248
|
+
cucumber_now : Creates a WebDriver-Ruby-Cucumber skeleton framework for cross
|
249
|
+
browser automation testing. Also creates a sample scenario for
|
250
|
+
reference which can be used to add more features(tests).
|
251
|
+
|
252
|
+
rspec_now : Creates a WebDriver-Ruby-RSpec skeleton framework for cross
|
253
|
+
browser automation testing. Also creates a sample scenario for
|
254
|
+
reference which can be used to add more specs(tests).
|
255
|
+
|
256
|
+
watir_cucumber_now : Creates a Watir-WebDriver-Ruby-Cucumber skeleton framework for
|
257
|
+
cross browser automation testing. Also creates a sample scenario
|
258
|
+
for reference which can be used to add more features(tests).
|
259
|
+
|
260
|
+
watir_rspec_now : Creates a Watir-WebDriver-Ruby-RSpec skeleton framework for cross
|
261
|
+
browser automation testing. Also creates a sample scenario for
|
262
|
+
reference which can be used to add more specs(tests).
|
263
|
+
|
264
|
+
version : Prints the gem version
|
265
|
+
|
266
|
+
MSG
|
267
|
+
end
|
268
|
+
|
269
|
+
if ARGV.length == 0
|
270
|
+
print_help
|
271
|
+
else
|
272
|
+
cmd = ARGV.shift
|
273
|
+
if cmd == 'help'
|
274
|
+
print_help
|
275
|
+
elsif cmd == 'cucumber_now'
|
276
|
+
cucumber_now
|
277
|
+
elsif cmd == 'rspec_now'
|
278
|
+
rspec_now
|
279
|
+
elsif cmd == 'watir_cucumber_now'
|
280
|
+
cucumber_now("watir")
|
281
|
+
elsif cmd == 'watir_rspec_now'
|
282
|
+
rspec_now("watir")
|
283
|
+
elsif cmd == 'version'
|
284
|
+
puts File.read(File.expand_path("../../lib/testnow/version", __FILE__))
|
285
|
+
else
|
286
|
+
print_help
|
287
|
+
end
|
288
288
|
end
|