rtest 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README +37 -0
- data/Rakefile +134 -0
- data/bin/rtest +3 -0
- data/lib/constants.rb +14 -0
- data/lib/selenium_driver.rb +21 -0
- data/test/new_spec.rb +30 -0
- data/vendor/selenium-server.jar +0 -0
- metadata +104 -0
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009 Davíð Halldór Lúðvíksson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009 Davíð Halldór Lúðvíksson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
23
|
+
#############################################################################
|
24
|
+
|
25
|
+
This project runs a Selenium RC server for running commands on a Webserver
|
26
|
+
|
27
|
+
To run the whole acceptance rspec test with xml reports
|
28
|
+
Usage: rake ci:setup:testunit acceptance
|
29
|
+
|
30
|
+
To run the accepance test without xml reports
|
31
|
+
Usage: rake acceptance for running Accepance test
|
32
|
+
|
33
|
+
To run Rdoc
|
34
|
+
Usage: rake rdoc
|
35
|
+
|
36
|
+
To list the rake commands
|
37
|
+
Usage: rake -R
|
data/Rakefile
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# Author: Davíð Halldór Lúðvíksson
|
2
|
+
|
3
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
require 'rubygems/specification'
|
6
|
+
require 'date'
|
7
|
+
gem 'ci_reporter'
|
8
|
+
gem "rspec", "=1.2.8"
|
9
|
+
gem "selenium-client", "=1.2.17"
|
10
|
+
gem "syntax"
|
11
|
+
require 'ci/reporter/rake/rspec'
|
12
|
+
require 'rake/rdoctask'
|
13
|
+
require 'rake/testtask'
|
14
|
+
require 'selenium/rake/tasks'
|
15
|
+
require 'spec/rake/spectask'
|
16
|
+
|
17
|
+
GEM = "rtest"
|
18
|
+
VERSION = "0.0.3"
|
19
|
+
AUTHOR = "Davíð Halldór Lúðvíksson"
|
20
|
+
EMAIL = "davidhalldor@gmail.com"
|
21
|
+
HOMEPAGE = "http://github.com/davidhalldor/rtest"
|
22
|
+
SUMMARY = "A gem that provides Ruby Selenium test skeleton project"
|
23
|
+
|
24
|
+
# Rake build to make rdoc, start Selenium server, stop Selenium server,
|
25
|
+
# run unit tests, run rspec tests, run failing rspec tests,
|
26
|
+
# make Selenium, ci reports and run Selenium acceptance tests
|
27
|
+
|
28
|
+
desc 'Create rdoc'
|
29
|
+
Rake::RDocTask.new('rdoc') do |rdoc|
|
30
|
+
rdoc.title = GEM
|
31
|
+
rdoc.main = 'README'
|
32
|
+
rdoc.options << '-c utf-8'
|
33
|
+
rdoc.rdoc_files.include 'test/*.rb', 'README', 'LICENSE'
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Start the Selenium server'
|
37
|
+
Selenium::Rake::RemoteControlStartTask.new('start') do |rc|
|
38
|
+
if not File.directory?("selenium")
|
39
|
+
mkdir 'selenium'
|
40
|
+
end
|
41
|
+
rc.port = 4444
|
42
|
+
rc.timeout_in_seconds = 3 * 60
|
43
|
+
rc.background = true
|
44
|
+
rc.wait_until_up_and_running = true
|
45
|
+
rc.jar_file = "vendor/selenium-server.jar"
|
46
|
+
rc.additional_args << "-singleWindow"
|
47
|
+
rc.log_to = "selenium/server.log"
|
48
|
+
if ENV['FIREFOX_PROFILE']
|
49
|
+
rc.additional_args << "-firefoxProfileTemplate #{ENV['FIREFOX_PROFILE']}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Run all specs tests for web application'
|
54
|
+
Spec::Rake::SpecTask.new('spec') do |task|
|
55
|
+
task.fail_on_error = false
|
56
|
+
task.spec_files = FileList['test/*_spec.rb']
|
57
|
+
task.spec_opts << '--color'
|
58
|
+
task.spec_opts << "--require 'rubygems,selenium/rspec/reporting/selenium_test_report_formatter'"
|
59
|
+
task.spec_opts << "--format=Selenium::RSpec::SeleniumTestReportFormatter:./tmp/acceptance_tests_report.html"
|
60
|
+
task.spec_opts << "--format=progress"
|
61
|
+
task.verbose = true
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'Run all failing examples'
|
65
|
+
Spec::Rake::SpecTask.new('failed') do |task|
|
66
|
+
task.spec_files = FileList['test/*_spec.rb']
|
67
|
+
task.spec_opts << '--loadby' << 'mtime' <<
|
68
|
+
'--backtrace' <<
|
69
|
+
'--format' << 'progress' <<
|
70
|
+
'--format' << 'failing_examples:failed' <<
|
71
|
+
'--example' << 'failed'
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Stop the selenium server'
|
75
|
+
Selenium::Rake::RemoteControlStopTask.new('stop') do |rc|
|
76
|
+
rc.host = "localhost"
|
77
|
+
rc.port = 4444
|
78
|
+
rc.timeout_in_seconds = 3 * 60
|
79
|
+
end
|
80
|
+
|
81
|
+
desc 'Clean temporary directories and files'
|
82
|
+
task 'clobber' do
|
83
|
+
rm_rf 'tmp'
|
84
|
+
rm_rf 'selenium'
|
85
|
+
rm_f 'failed'
|
86
|
+
end
|
87
|
+
|
88
|
+
# Gemspec specific tasks
|
89
|
+
|
90
|
+
spec = Gem::Specification.new do |s|
|
91
|
+
s.name = GEM
|
92
|
+
s.version = VERSION
|
93
|
+
s.author = AUTHOR
|
94
|
+
s.email = EMAIL
|
95
|
+
s.homepage = HOMEPAGE
|
96
|
+
s.description = s.summary = SUMMARY
|
97
|
+
|
98
|
+
s.platform = Gem::Platform::RUBY
|
99
|
+
s.has_rdoc = true
|
100
|
+
s.extra_rdoc_files = ["README", "LICENSE"]
|
101
|
+
|
102
|
+
s.bindir = "bin"
|
103
|
+
s.executables = "rtest"
|
104
|
+
|
105
|
+
s.add_dependency "ci_reporter"
|
106
|
+
s.add_dependency "rspec", "=1.2.8"
|
107
|
+
s.add_dependency "selenium-client", "=1.2.17"
|
108
|
+
s.add_dependency "syntax"
|
109
|
+
|
110
|
+
s.require_path = 'lib'
|
111
|
+
s.autorequire = GEM
|
112
|
+
s.files = %w(LICENSE README Rakefile) + Dir.glob("{lib,test,vendor,bin}/**/*")
|
113
|
+
end
|
114
|
+
|
115
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
116
|
+
pkg.gem_spec = spec
|
117
|
+
end
|
118
|
+
|
119
|
+
desc "install the gem locally"
|
120
|
+
task :install => [:package] do
|
121
|
+
sh %{sudo gem install pkg/#{GEM}-#{VERSION}}
|
122
|
+
end
|
123
|
+
|
124
|
+
desc "create a gemspec file"
|
125
|
+
task :make_spec do
|
126
|
+
File.open("#{GEM}.gemspec", "w") do |file|
|
127
|
+
file.puts spec.to_ruby
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
task :default => :spec
|
132
|
+
|
133
|
+
desc 'Run the acceptance test'
|
134
|
+
task :acceptance => [:start, :spec, :stop]
|
data/bin/rtest
ADDED
data/lib/constants.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Author: Davíð Halldór Lúðvíksson
|
2
|
+
|
3
|
+
# Task passes argument run the custom browser
|
4
|
+
if ENV['browser']
|
5
|
+
p "arg is #{ENV['browser']}"
|
6
|
+
BROWSER = ENV['browser']
|
7
|
+
else
|
8
|
+
puts "Browser is default *firefox"
|
9
|
+
BROWSER = '*firefox'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Constants for site under test and the Selenium RC host
|
13
|
+
SITE = ""
|
14
|
+
HOST = ""
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Author: Davíð Halldór Lúðvíksson
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
gem "rspec", "=1.2.8"
|
5
|
+
gem "selenium-client", "=1.2.17"
|
6
|
+
require "selenium/client"
|
7
|
+
require "selenium/rspec/spec_helper"
|
8
|
+
require "lib/constants"
|
9
|
+
|
10
|
+
# Class for making instance of the Selenium driver for every testsuite
|
11
|
+
class SeleniumDriver
|
12
|
+
def create_selenium_driver
|
13
|
+
driver = Selenium::Client::Driver.new \
|
14
|
+
:host => HOST,
|
15
|
+
:port => 4444,
|
16
|
+
:browser => BROWSER,
|
17
|
+
:url => "http://#{SITE}",
|
18
|
+
:timeout_in_second => 60
|
19
|
+
return driver
|
20
|
+
end
|
21
|
+
end
|
data/test/new_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Author: Davíð Halldór Lúðvíksson - * -
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
gem "rspec", "=1.2.8"
|
5
|
+
gem "selenium-client", "=1.2.17"
|
6
|
+
require "selenium/client"
|
7
|
+
require "selenium/rspec/spec_helper"
|
8
|
+
require "lib/constants"
|
9
|
+
require "lib/selenium_driver"
|
10
|
+
|
11
|
+
describe "New spec" do
|
12
|
+
attr_reader :selenium_driver
|
13
|
+
|
14
|
+
before(:all) do
|
15
|
+
driver = SeleniumDriver.new
|
16
|
+
@selenium_driver = driver.create_selenium_driver
|
17
|
+
@selenium_driver.start_new_browser_session
|
18
|
+
end
|
19
|
+
|
20
|
+
before(:each) do
|
21
|
+
@selenium_driver.open "/"
|
22
|
+
end
|
23
|
+
|
24
|
+
after(:all) do
|
25
|
+
@selenium_driver.close_current_browser_session
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should put new test spec here" do
|
29
|
+
end
|
30
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rtest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- !binary |
|
8
|
+
RGF2w63DsCBIYWxsZMOzciBMw7rDsHbDrWtzc29u
|
9
|
+
|
10
|
+
autorequire: rtest
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2009-11-11 00:00:00 +00:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: ci_reporter
|
19
|
+
type: :runtime
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "0"
|
26
|
+
version:
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
type: :runtime
|
30
|
+
version_requirement:
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.2.8
|
36
|
+
version:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: selenium-client
|
39
|
+
type: :runtime
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.17
|
46
|
+
version:
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: syntax
|
49
|
+
type: :runtime
|
50
|
+
version_requirement:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
description: A gem that provides Ruby Selenium test skeleton project
|
58
|
+
email: davidhalldor@gmail.com
|
59
|
+
executables:
|
60
|
+
- rtest
|
61
|
+
extensions: []
|
62
|
+
|
63
|
+
extra_rdoc_files:
|
64
|
+
- README
|
65
|
+
- LICENSE
|
66
|
+
files:
|
67
|
+
- LICENSE
|
68
|
+
- README
|
69
|
+
- Rakefile
|
70
|
+
- lib/constants.rb
|
71
|
+
- lib/selenium_driver.rb
|
72
|
+
- test/new_spec.rb
|
73
|
+
- vendor/selenium-server.jar
|
74
|
+
- bin/rtest
|
75
|
+
has_rdoc: true
|
76
|
+
homepage: http://github.com/davidhalldor/rtest
|
77
|
+
licenses: []
|
78
|
+
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.5
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: A gem that provides Ruby Selenium test skeleton project
|
103
|
+
test_files: []
|
104
|
+
|