bret-watircraft 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +23 -0
- data/README.rdoc +1 -120
- data/VERSION.yml +1 -1
- data/app_generators/watircraft/templates/readme.txt +1 -1
- data/app_generators/watircraft/templates/site.rb.erb +5 -0
- data/lib/taza/site.rb +4 -0
- data/lib/watircraft/version.rb +1 -1
- data/spec/site_spec.rb +15 -19
- data/watircraft.gemspec +10 -9
- metadata +7 -7
data/History.txt
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
=== 0.4.5 / 2009-04-07
|
2
|
+
|
3
|
+
New Features
|
4
|
+
|
5
|
+
* Will now use the latest version of Rspec and Cucumber. Previously we
|
6
|
+
declared dependencies on specific versions of Rspec and Cucumber. Now we
|
7
|
+
will install and use the latest version. If you have a specific version
|
8
|
+
you want to use, you should install it first. WatirCraft will use it,
|
9
|
+
instead of installing its own.
|
10
|
+
* When you create a new project, your site.rb file will now contain a
|
11
|
+
template initialize_browser method, making it easier to see how to
|
12
|
+
customize it.
|
13
|
+
|
14
|
+
Bug Fixes
|
15
|
+
|
16
|
+
* Some "should" commands were not working in the script\console.
|
17
|
+
(e.g. "browser.text.should include('Google')"
|
18
|
+
|
19
|
+
Documentation
|
20
|
+
|
21
|
+
* Fixed incorrect reference to config file in "startup instructions".
|
22
|
+
* Moved documentation from project readme to the wiki.
|
23
|
+
|
1
24
|
=== 0.4.4 / 2009-04-02
|
2
25
|
|
3
26
|
This release provides a number of new configuration options for managing
|
data/README.rdoc
CHANGED
@@ -1,126 +1,7 @@
|
|
1
1
|
= WatirCraft
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
WatirCraft is a testing framework that builds on Watir.
|
6
|
-
It allows tests to be expressed as Rspec or Cucumber tests and provides
|
7
|
-
a library structure to support maintainable testing. It gives you
|
8
|
-
a place to put things.
|
9
|
-
|
10
|
-
* http://testobsessed.com/2008/05/31/a-place-to-put-things
|
11
|
-
|
12
|
-
== FEATURES
|
13
|
-
|
14
|
-
* Generates a directory structure for your test suite with one command.
|
15
|
-
* Provides page adapters you can customize for your application.
|
16
|
-
* Configure environment URLs and browser type (IE, Firefox) in one location.
|
17
|
-
* Supports multiple environments; specify which to test at run time.
|
18
|
-
* Uses templates to create tests and libraries.
|
19
|
-
* Automatically initializes browser for testing.
|
20
|
-
* Provides the glue to ensure your tests can find your libraries. Don't
|
21
|
-
write another "require" statement again.
|
22
|
-
|
23
|
-
== APPROACH
|
24
|
-
|
25
|
-
WatirCraft is an object-oriented testing framework that helps you create
|
26
|
-
class libraries to support the tests for your application. On their own,
|
27
|
-
many testers have created procedural libraries for testing because they
|
28
|
-
understand these and find them easier to create and understand.
|
29
|
-
|
30
|
-
Although object-oriented frameworks like WatirCraft are somewhat more difficult
|
31
|
-
to understand at first, they are easier to customize and upgrade. As we add
|
32
|
-
more features to the WatirCraft framework, your test suite will automatically
|
33
|
-
get the benefit.
|
34
|
-
|
35
|
-
== INSTALL
|
36
|
-
|
37
|
-
Run the following if you haven't already:
|
38
|
-
|
39
|
-
> gem update --system
|
40
|
-
> gem sources -a http://gems.github.com
|
41
|
-
|
42
|
-
Install the gem:
|
43
|
-
|
44
|
-
> gem install bret-watircraft
|
45
|
-
|
3
|
+
For documentation, see http://wiki.github.com/bret/watircraft
|
46
4
|
See the History.txt file for detailed notes on the contents of each release.
|
47
|
-
|
48
|
-
== GETTING STARTED
|
49
|
-
|
50
|
-
Use the +watircraft+ command to create your project. Your project will contain
|
51
|
-
your tests, your libraries, your configuration files, and all the glue code
|
52
|
-
necessary to allow it all to work together. Let's create a project for
|
53
|
-
testing Google.
|
54
|
-
|
55
|
-
> watircraft google
|
56
|
-
|
57
|
-
This will create a directory called "google" and populate it with a bunch of
|
58
|
-
directories and files.
|
59
|
-
|
60
|
-
You'll need to edit the <tt>config\environments.yml</tt> file to point to you base
|
61
|
-
url of your project.
|
62
|
-
|
63
|
-
test:
|
64
|
-
url: http://google.com
|
65
|
-
|
66
|
-
By default, your tests will run in the "test" environment, but you can specify
|
67
|
-
additional environments later. When you run your tests, you can specify which environment
|
68
|
-
to use on the command line.
|
69
|
-
|
70
|
-
Use the <tt>script\generate</tt> command to populate your project with project files.
|
71
|
-
This command must be run from the top of your project.
|
72
|
-
|
73
|
-
> cd google
|
74
|
-
|
75
|
-
Create a test. WatirCraft uses the RSpec test harness and therefore calls a
|
76
|
-
test a "spec".
|
77
|
-
|
78
|
-
> script\generate spec search
|
79
|
-
|
80
|
-
This creates a bare template for a test. Edit the file that was just created
|
81
|
-
(<tt>test/specs/search_spec.rb</tt>) and add the following
|
82
|
-
lines.
|
83
|
-
|
84
|
-
browser.text_field(:name, 'q').set 'WatirCraft'
|
85
|
-
browser.button(:name, 'btnG').click
|
86
|
-
browser.text.should include('Test automation for web applications')
|
87
|
-
|
88
|
-
The WatirCraft framework will automatically start the browser at the
|
89
|
-
configured url when you run it.
|
90
|
-
|
91
|
-
After you have added these lines to the template, the complete file will
|
92
|
-
look like this.
|
93
|
-
|
94
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) unless
|
95
|
-
$LOAD_PATH.include? File.dirname(__FILE__)
|
96
|
-
require 'spec_helper'
|
97
|
-
|
98
|
-
describe "Search" do
|
99
|
-
|
100
|
-
it "should find WatirCraft" do
|
101
|
-
browser.text_field(:name, 'q').set 'WatirCraft'
|
102
|
-
browser.button(:name, 'btnG').click
|
103
|
-
browser.text.should include('Test automation for web applications')
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
Use the +rake+ command to run the tests for your project(only one so far).
|
109
|
-
This needs to be run from the base of your project.
|
110
|
-
|
111
|
-
> rake spec
|
112
|
-
|
113
|
-
By default, your test runs with Internet Explorer, but you can also run it
|
114
|
-
with Firefox.
|
115
|
-
|
116
|
-
> rake spec BROWSER=firefox
|
117
|
-
|
118
|
-
You can also just run individual files.
|
119
|
-
|
120
|
-
> ruby test/specs/search_spec.rb
|
121
|
-
|
122
|
-
Note that many editors will do this automatically for you. For example the
|
123
|
-
Scite editor will do this when you hit "F5".
|
124
5
|
|
125
6
|
== EXAMPLE
|
126
7
|
|
data/VERSION.yml
CHANGED
@@ -3,7 +3,7 @@ How to create a WatirCraft Project
|
|
3
3
|
==================================
|
4
4
|
|
5
5
|
1. DONE - Run the WatirCraft command: watircraft projectname
|
6
|
-
2. Edit config/
|
6
|
+
2. Edit config/environments.yml to include the base url of your application.
|
7
7
|
3. CD into your new project directory. All of the following commands assume
|
8
8
|
that your current directory is the base of your project.
|
9
9
|
|
@@ -6,5 +6,10 @@ module <%= site.camelize %>
|
|
6
6
|
|
7
7
|
class <%= site.camelize %> < ::Taza::Site
|
8
8
|
|
9
|
+
# Sets @browser to be a browser initialized for testing your site.
|
10
|
+
def initialize_browser
|
11
|
+
super # configure the browser based on the configuration settings
|
12
|
+
end
|
13
|
+
|
9
14
|
end
|
10
15
|
end
|
data/lib/taza/site.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'activesupport'
|
3
3
|
require 'taza/settings'
|
4
|
+
require 'spec/matchers'
|
4
5
|
|
5
6
|
module Taza
|
6
7
|
# An abstraction of a website, but more really a container for a sites pages.
|
@@ -43,6 +44,8 @@ module Taza
|
|
43
44
|
end
|
44
45
|
|
45
46
|
end
|
47
|
+
include Spec::Matchers
|
48
|
+
|
46
49
|
|
47
50
|
@@before_browser_closes = Proc.new() {}
|
48
51
|
# Use this to do something with the browser before it closes, but note that it is a class method which
|
@@ -157,6 +160,7 @@ module Taza
|
|
157
160
|
|
158
161
|
def initialize_context!(context)
|
159
162
|
context.extend @methods_module
|
163
|
+
context.extend Spec::Matchers
|
160
164
|
context.site = @site
|
161
165
|
context.browser = @site.browser
|
162
166
|
context
|
data/lib/watircraft/version.rb
CHANGED
data/spec/site_spec.rb
CHANGED
@@ -87,6 +87,10 @@ describe do
|
|
87
87
|
it "should list the site's pages" do
|
88
88
|
@context.pages.should == ["bar_page", "partial_the_reckoning"]
|
89
89
|
end
|
90
|
+
|
91
|
+
it "should provide Spec::Matchers" do
|
92
|
+
@context.instance_eval { [1,2,3].should include(2) }
|
93
|
+
end
|
90
94
|
end
|
91
95
|
|
92
96
|
describe Taza::Site do
|
@@ -227,6 +231,17 @@ describe do
|
|
227
231
|
Taza::Settings.expects(:environment_settings).returns({:url => 'http://www.zoro.com'}).at_least_once
|
228
232
|
@site.origin.should == 'http://www.zoro.com'
|
229
233
|
end
|
234
|
+
|
235
|
+
it "should call the initialize method" do
|
236
|
+
|
237
|
+
class SubClass < Taza::Site
|
238
|
+
def initialize_browser
|
239
|
+
@browser = 'provided'
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
SubClass.new.browser.should == 'provided'
|
244
|
+
end
|
230
245
|
|
231
246
|
end
|
232
247
|
|
@@ -247,23 +262,4 @@ describe do
|
|
247
262
|
end
|
248
263
|
end
|
249
264
|
|
250
|
-
describe Taza::Site do
|
251
|
-
it_should_behave_like "an execution context"
|
252
|
-
before do
|
253
|
-
@context = @site
|
254
|
-
end
|
255
|
-
|
256
|
-
it "should call the initialize method" do
|
257
|
-
|
258
|
-
class SubClass < Taza::Site
|
259
|
-
def initialize_browser
|
260
|
-
@browser = 'provided'
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
SubClass.new.browser.should == 'provided'
|
265
|
-
end
|
266
|
-
|
267
|
-
|
268
|
-
end
|
269
265
|
end
|
data/watircraft.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{watircraft}
|
5
|
-
s.version = "0.4.
|
5
|
+
s.version = "0.4.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Bret Pettichord", "Jim Matthews", "Charley Baker", "Adam Anderson"]
|
9
|
-
s.date = %q{2009-04-
|
9
|
+
s.date = %q{2009-04-07}
|
10
10
|
s.default_executable = %q{watircraft}
|
11
11
|
s.description = %q{WatirCraft is a framework for testing web apps.}
|
12
12
|
s.email = %q{bret@pettichord.com}
|
@@ -14,9 +14,10 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.extra_rdoc_files = ["History.txt", "README.rdoc"]
|
15
15
|
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "VERSION.yml", "watircraft.gemspec", "bin/watircraft", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/extensions/watir.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "lib/watircraft", "lib/watircraft/generator_helper.rb", "lib/watircraft/table.rb", "lib/watircraft/version.rb", "lib/watircraft.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fake_table.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_spec.rb", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/environments.yml", "spec/sandbox/config/simpler.yml", "spec/sandbox/config/simpler_site.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/users.yml", "spec/sandbox/flows", "spec/sandbox/flows/batman.rb", "spec/sandbox/flows/robin.rb", "spec/sandbox/pages", "spec/sandbox/pages/foo", "spec/sandbox/pages/foo/bar_page.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/site_spec.rb", "spec/spec_generator_helper.rb", "spec/spec_generator_spec.rb", "spec/spec_helper.rb", "spec/steps_generator_spec.rb", "spec/string_spec.rb", "spec/table_spec.rb", "spec/taza_spec.rb", "spec/watircraft_bin_spec.rb", "spec/watir_spec.rb", "app_generators/watircraft", "app_generators/watircraft/templates", "app_generators/watircraft/templates/config.yml.erb", "app_generators/watircraft/templates/environments.yml.erb", "app_generators/watircraft/templates/feature_helper.rb", "app_generators/watircraft/templates/initialize.rb.erb", "app_generators/watircraft/templates/rakefile.rb", "app_generators/watircraft/templates/readme.txt", "app_generators/watircraft/templates/script", "app_generators/watircraft/templates/script/console", "app_generators/watircraft/templates/script/console.cmd", "app_generators/watircraft/templates/site.rb.erb", "app_generators/watircraft/templates/site_start.rb.erb", "app_generators/watircraft/templates/spec_helper.rb", "app_generators/watircraft/templates/spec_initialize.rb", "app_generators/watircraft/templates/world.rb", "app_generators/watircraft/USAGE", "app_generators/watircraft/watircraft_generator.rb", "watircraft_generators/page", "watircraft_generators/page/page_generator.rb", "watircraft_generators/page/templates", "watircraft_generators/page/templates/page.rb.erb", "watircraft_generators/page/USAGE", "watircraft_generators/spec", "watircraft_generators/spec/spec_generator.rb", "watircraft_generators/spec/templates", "watircraft_generators/spec/templates/spec.rb.erb", "watircraft_generators/spec/USAGE", "watircraft_generators/steps", "watircraft_generators/steps/steps_generator.rb", "watircraft_generators/steps/templates", "watircraft_generators/steps/templates/steps.rb.erb", "watircraft_generators/steps/USAGE"]
|
16
16
|
s.has_rdoc = true
|
17
|
-
s.homepage = %q{http://github.com/bret/watircraft
|
17
|
+
s.homepage = %q{http://wiki.github.com/bret/watircraft}
|
18
18
|
s.rdoc_options = ["--main", "README.rdoc"]
|
19
19
|
s.require_paths = ["lib"]
|
20
|
+
s.requirements = ["watir(ie) and/or firewatir 1.6.2 or newer"]
|
20
21
|
s.rubyforge_project = %q{watir}
|
21
22
|
s.rubygems_version = %q{1.3.1}
|
22
23
|
s.summary = %q{WatirCraft is a framework for testing web apps.}
|
@@ -30,22 +31,22 @@ Gem::Specification.new do |s|
|
|
30
31
|
s.add_runtime_dependency(%q<rake>, [">= 0.8.3"])
|
31
32
|
s.add_runtime_dependency(%q<mocha>, [">= 0.9.3"])
|
32
33
|
s.add_runtime_dependency(%q<rubigen>, [">= 1.4.0"])
|
33
|
-
s.add_runtime_dependency(%q<rspec>, ["
|
34
|
-
s.add_runtime_dependency(%q<cucumber>, ["
|
34
|
+
s.add_runtime_dependency(%q<rspec>, [">= 1.1.12"])
|
35
|
+
s.add_runtime_dependency(%q<cucumber>, [">= 0.1.16"])
|
35
36
|
else
|
36
37
|
s.add_dependency(%q<taglob>, [">= 1.1.1"])
|
37
38
|
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
38
39
|
s.add_dependency(%q<mocha>, [">= 0.9.3"])
|
39
40
|
s.add_dependency(%q<rubigen>, [">= 1.4.0"])
|
40
|
-
s.add_dependency(%q<rspec>, ["
|
41
|
-
s.add_dependency(%q<cucumber>, ["
|
41
|
+
s.add_dependency(%q<rspec>, [">= 1.1.12"])
|
42
|
+
s.add_dependency(%q<cucumber>, [">= 0.1.16"])
|
42
43
|
end
|
43
44
|
else
|
44
45
|
s.add_dependency(%q<taglob>, [">= 1.1.1"])
|
45
46
|
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
46
47
|
s.add_dependency(%q<mocha>, [">= 0.9.3"])
|
47
48
|
s.add_dependency(%q<rubigen>, [">= 1.4.0"])
|
48
|
-
s.add_dependency(%q<rspec>, ["
|
49
|
-
s.add_dependency(%q<cucumber>, ["
|
49
|
+
s.add_dependency(%q<rspec>, [">= 1.1.12"])
|
50
|
+
s.add_dependency(%q<cucumber>, [">= 0.1.16"])
|
50
51
|
end
|
51
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bret-watircraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bret Pettichord
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-04-
|
15
|
+
date: 2009-04-07 00:00:00 -07:00
|
16
16
|
default_executable: watircraft
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
version_requirement:
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 1.1.12
|
67
67
|
version:
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
version_requirement:
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 0.1.16
|
77
77
|
version:
|
@@ -186,7 +186,7 @@ files:
|
|
186
186
|
- watircraft_generators/steps/templates/steps.rb.erb
|
187
187
|
- watircraft_generators/steps/USAGE
|
188
188
|
has_rdoc: true
|
189
|
-
homepage: http://github.com/bret/watircraft
|
189
|
+
homepage: http://wiki.github.com/bret/watircraft
|
190
190
|
post_install_message:
|
191
191
|
rdoc_options:
|
192
192
|
- --main
|
@@ -205,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: "0"
|
207
207
|
version:
|
208
|
-
requirements:
|
209
|
-
|
208
|
+
requirements:
|
209
|
+
- watir(ie) and/or firewatir 1.6.2 or newer
|
210
210
|
rubyforge_project: watir
|
211
211
|
rubygems_version: 1.2.0
|
212
212
|
signing_key:
|