taza 0.5.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +33 -0
- data/Manifest.txt +39 -9
- data/README.txt +29 -7
- data/Rakefile +72 -13
- data/bin/taza +16 -3
- data/generators/flow/flow_generator.rb +57 -0
- data/generators/flow/templates/flow.rb.erb +12 -0
- data/generators/page/page_generator.rb +58 -0
- data/generators/page/templates/functional_page_spec.rb.erb +8 -0
- data/generators/page/templates/page.rb.erb +8 -0
- data/generators/site/site_generator.rb +55 -0
- data/generators/site/templates/site.rb.erb +10 -0
- data/generators/site/templates/site.yml.erb +3 -0
- data/lib/app_generators/taza/taza_generator.rb +76 -0
- data/lib/app_generators/taza/templates/config.yml.erb +3 -0
- data/lib/{taza/generators → app_generators/taza}/templates/rakefile.rb.erb +0 -0
- data/lib/app_generators/taza/templates/spec_helper.rb.erb +11 -0
- data/lib/taza.rb +44 -5
- data/lib/taza/browser.rb +40 -0
- data/lib/taza/browsers/ie_watir.rb +8 -0
- data/lib/taza/browsers/safari_watir.rb +8 -0
- data/lib/taza/flow.rb +45 -0
- data/lib/taza/page.rb +66 -19
- data/lib/taza/settings.rb +36 -0
- data/lib/taza/site.rb +122 -11
- data/lib/taza/tasks.rb +26 -34
- data/spec/browser_spec.rb +72 -0
- data/spec/flow_generator_spec.rb +70 -0
- data/spec/page_generator_spec.rb +57 -0
- data/spec/page_spec.rb +82 -0
- data/spec/platform/osx/browser_spec.rb +14 -0
- data/spec/platform/windows/browser_spec.rb +14 -0
- data/spec/project_generator_spec.rb +42 -0
- data/spec/sandbox/config.yml +3 -0
- data/spec/sandbox/config/config.yml +1 -0
- data/spec/sandbox/config/site_name.yml +5 -0
- data/spec/sandbox/flows/batman.rb +2 -0
- data/spec/sandbox/flows/robin.rb +4 -0
- data/spec/sandbox/pages/foo/bar.rb +9 -0
- data/spec/settings_spec.rb +88 -0
- data/spec/site_generator_spec.rb +53 -0
- data/spec/site_spec.rb +239 -0
- data/spec/spec_helper.rb +49 -0
- data/spec/taza_bin_spec.rb +14 -0
- data/spec/taza_spec.rb +12 -0
- data/spec/taza_tasks_spec.rb +27 -0
- data/spec/unit_helper_spec.rb +14 -0
- metadata +103 -13
- data/lib/taza/generators.rb +0 -4
- data/lib/taza/generators/base.rb +0 -33
- data/lib/taza/generators/page.rb +0 -22
- data/lib/taza/generators/project.rb +0 -18
- data/lib/taza/generators/site.rb +0 -24
- data/lib/taza/generators/templates/page.rb.erb +0 -6
- data/lib/taza/generators/templates/site.rb.erb +0 -6
data/History.txt
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
=== 0.8.0 / 2008-11-23
|
2
|
+
|
3
|
+
Taza is a web application testing framework meant to be used with browsed-based testing libraries like WATIR or Selenium
|
4
|
+
|
5
|
+
Not all web applications can be written in Ruby, unfortunately. When you aren't testing an application that was written with testing in mind Taza can provide a structured and opionated way to do browser-based testing.
|
6
|
+
|
7
|
+
* Sites have Pages
|
8
|
+
* Sites have Flows that move through Pages
|
9
|
+
* Pages have elements and filters to define simple ways of interacting with them
|
10
|
+
* Pages have tests/specs that help chip away at the dreaded 0% Coverage Beast™
|
11
|
+
|
12
|
+
* Features
|
13
|
+
* Generate a Taza project easily
|
14
|
+
* Generate Sites, Pages, and Flows using a familiar format(./script/generate)
|
15
|
+
* Automatically generate specs when generating a site to push you
|
16
|
+
* Easily switch browser and/or driver
|
17
|
+
* Automatic opening and cleanup of browser
|
18
|
+
* Included rake spec commands generated for sites and pages
|
19
|
+
* Rake spec commands will create an RSpec HTML report by default
|
20
|
+
* Easily tie-in special functionality like getting a DOM dump of each browser before it closes
|
21
|
+
|
22
|
+
* Todo
|
23
|
+
0.8.x
|
24
|
+
* Add a taza_example to easily generate a fully-functional example of how a taza project might look
|
25
|
+
* Provide more documentation
|
26
|
+
0.9
|
27
|
+
* Add more thorough Selenium support
|
28
|
+
* Easily allow overwriting of spec options for included rake tasks
|
29
|
+
* Provide better conventions around cross-site testing
|
30
|
+
1.0
|
31
|
+
* Using Selenium with WATIR syntax(Easily switch between Selenium and WATIR without having to change any Page code)
|
32
|
+
* Provide more advanced documentation
|
33
|
+
|
1
34
|
=== 0.5.0 / 2008-10-03
|
2
35
|
|
3
36
|
* 1 major enhancement
|
data/Manifest.txt
CHANGED
@@ -3,15 +3,45 @@ Manifest.txt
|
|
3
3
|
README.txt
|
4
4
|
Rakefile
|
5
5
|
bin/taza
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
generators/flow/flow_generator.rb
|
7
|
+
generators/flow/templates/flow.rb.erb
|
8
|
+
generators/page/page_generator.rb
|
9
|
+
generators/page/templates/functional_page_spec.rb.erb
|
10
|
+
generators/page/templates/page.rb.erb
|
11
|
+
generators/site/site_generator.rb
|
12
|
+
generators/site/templates/site.rb.erb
|
13
|
+
generators/site/templates/site.yml.erb
|
14
|
+
lib/app_generators/taza/taza_generator.rb
|
15
|
+
lib/app_generators/taza/templates/config.yml.erb
|
16
|
+
lib/app_generators/taza/templates/rakefile.rb.erb
|
17
|
+
lib/app_generators/taza/templates/spec_helper.rb.erb
|
18
|
+
lib/taza.rb
|
19
|
+
lib/taza/browser.rb
|
20
|
+
lib/taza/browsers/ie_watir.rb
|
21
|
+
lib/taza/browsers/safari_watir.rb
|
22
|
+
lib/taza/flow.rb
|
14
23
|
lib/taza/page.rb
|
24
|
+
lib/taza/settings.rb
|
15
25
|
lib/taza/site.rb
|
16
26
|
lib/taza/tasks.rb
|
17
|
-
|
27
|
+
spec/browser_spec.rb
|
28
|
+
spec/flow_generator_spec.rb
|
29
|
+
spec/page_generator_spec.rb
|
30
|
+
spec/page_spec.rb
|
31
|
+
spec/platform/osx/browser_spec.rb
|
32
|
+
spec/platform/windows/browser_spec.rb
|
33
|
+
spec/project_generator_spec.rb
|
34
|
+
spec/sandbox/config.yml
|
35
|
+
spec/sandbox/config/config.yml
|
36
|
+
spec/sandbox/config/site_name.yml
|
37
|
+
spec/sandbox/flows/batman.rb
|
38
|
+
spec/sandbox/flows/robin.rb
|
39
|
+
spec/sandbox/pages/foo/bar.rb
|
40
|
+
spec/settings_spec.rb
|
41
|
+
spec/site_generator_spec.rb
|
42
|
+
spec/site_spec.rb
|
43
|
+
spec/spec_helper.rb
|
44
|
+
spec/taza_bin_spec.rb
|
45
|
+
spec/taza_spec.rb
|
46
|
+
spec/taza_tasks_spec.rb
|
47
|
+
spec/unit_helper_spec.rb
|
data/README.txt
CHANGED
@@ -6,21 +6,43 @@
|
|
6
6
|
|
7
7
|
Taza is meant to make acceptance testing more sane for developers(or QA where applicable) and customers.
|
8
8
|
|
9
|
-
== FEATURES
|
9
|
+
== FEATURES:
|
10
10
|
|
11
|
-
* Generate a project for
|
11
|
+
* Generate a project for browser-based testing
|
12
12
|
* Generate pages and sites for different applications
|
13
|
+
* Create flows that move through a site
|
14
|
+
* Use filters to control which elements are accessible on a page depending on its state
|
15
|
+
* Taza automatically creates and cleans up the browser for each site just like a File block
|
13
16
|
* Manage tests by tags
|
14
17
|
* Cross-site testing
|
15
18
|
|
19
|
+
== ISSUES:
|
20
|
+
|
21
|
+
* Taza has only been used in the wild with WATIR(Safari/Firefox/IE), but Selenium support is built-in
|
22
|
+
* Taza's generators currently generate RSpec specs, Test::Unit and other test framework support is planned
|
23
|
+
|
16
24
|
== SYNOPSIS:
|
17
25
|
|
18
|
-
|
19
|
-
|
26
|
+
Taza is meant to be a refreshing way to look at browser testing. Taza provides a few ways to abstract browser-based testing into three simple ideas.
|
27
|
+
* Sites
|
28
|
+
* Pages
|
29
|
+
* Flows
|
30
|
+
|
31
|
+
Sites have Pages.
|
32
|
+
Pages have elements and filters.
|
33
|
+
Flows are common actions on a site such as logging in or performing a search.
|
34
|
+
|
35
|
+
Here's an example for starting a project around the Google sites
|
36
|
+
|
37
|
+
$ taza google
|
38
|
+
$ cd google/
|
39
|
+
$ ./script/generate site google
|
40
|
+
$ ./script/generate page home_page google
|
41
|
+
$ ./script/generate flow search google
|
42
|
+
$ rake spec:functional:google
|
43
|
+
|
44
|
+
That will generate an RSpec HTML report at artifacts/functional/google/index.html
|
20
45
|
|
21
|
-
Inside your new skeleton you'll have a few rake tasks available to help you get started
|
22
|
-
$ rake generate:site name=google
|
23
|
-
$ rake generate:page site=google name=home_page
|
24
46
|
|
25
47
|
== REQUIREMENTS:
|
26
48
|
|
data/Rakefile
CHANGED
@@ -2,65 +2,124 @@
|
|
2
2
|
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
+
require 'config/vendorized_gems'
|
5
6
|
require 'hoe'
|
6
7
|
require 'taza'
|
7
8
|
require 'rbconfig'
|
8
9
|
require 'spec/rake/spectask'
|
10
|
+
require 'spec/rake/verify_rcov'
|
11
|
+
require 'rake/rdoctask'
|
9
12
|
|
10
13
|
private
|
11
|
-
def
|
12
|
-
|
14
|
+
def spec_files
|
15
|
+
return FileList['spec/**/*_spec.rb'].exclude(/spec\/platform\/(?!osx)/) if Taza.osx?
|
16
|
+
return FileList['spec/**/*_spec.rb'].exclude(/spec\/platform\/(?!windows)/) if Taza.windows?
|
17
|
+
return FileList['spec/**/*_spec.rb'].exclude('spec/platform/*')
|
13
18
|
end
|
14
|
-
|
15
19
|
public
|
16
20
|
|
17
21
|
Hoe.new('taza', Taza::VERSION) do |p|
|
18
22
|
p.rubyforge_name = 'taza' # if different than lowercase project name
|
19
23
|
p.developer('Adam Anderson', 'adamandersonis@gmail.com')
|
20
24
|
p.remote_rdoc_dir = ''
|
25
|
+
p.extra_deps << ['taglob','>= 1.0.0']
|
26
|
+
p.extra_deps << ['rake']
|
27
|
+
p.extra_deps << ['hoe']
|
28
|
+
p.extra_deps << ['mocha','>= 0.9.0']
|
29
|
+
p.extra_deps << ['rspec']
|
30
|
+
p.extra_deps << ['rubigen']
|
31
|
+
end
|
32
|
+
|
33
|
+
Rake::RDocTask.new do |rdoc|
|
34
|
+
files = ['README.txt', 'History.txt',
|
35
|
+
'lib/**/*.rb', 'doc/**/*.rdoc']
|
36
|
+
rdoc.rdoc_files.add(files)
|
37
|
+
rdoc.main = 'README.txt'
|
38
|
+
rdoc.title = 'Taza RDoc'
|
39
|
+
rdoc.template = './vendor/gems/gems/allison-2.0.3/lib/allison.rb'
|
40
|
+
rdoc.rdoc_dir = 'doc'
|
41
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
42
|
end
|
22
43
|
|
23
44
|
Spec::Rake::SpecTask.new do |t|
|
24
45
|
t.libs << File.join(File.dirname(__FILE__), 'lib')
|
25
|
-
t.spec_files =
|
26
|
-
end
|
46
|
+
t.spec_files = spec_files
|
47
|
+
end
|
27
48
|
|
28
49
|
desc "Run all examples with RCov"
|
29
50
|
Spec::Rake::SpecTask.new('rcov') do |t|
|
30
|
-
t.spec_files =
|
51
|
+
t.spec_files = spec_files
|
52
|
+
t.libs << File.join(File.dirname(__FILE__), 'lib')
|
31
53
|
t.rcov = true
|
32
54
|
t.rcov_dir = 'artifacts'
|
33
|
-
|
34
|
-
|
55
|
+
if Taza.windows?
|
56
|
+
t.rcov_opts = ['--exclude', 'spec,lib/taza/browsers/ie_watir.rb']
|
57
|
+
elsif Taza.osx?
|
58
|
+
t.rcov_opts = ['--exclude', 'spec,lib/taza/browsers/safari_watir.rb']
|
59
|
+
else
|
60
|
+
t.rcov_opts = ['--exclude', 'spec,lib/taza/browsers']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Generate html reports for specs"
|
65
|
+
Spec::Rake::SpecTask.new(:reports) do |t|
|
66
|
+
t.spec_files=FileList['spec/**/*_spec.rb']
|
67
|
+
FileUtils.mkdir('artifacts') unless File.directory?('artifacts')
|
68
|
+
t.spec_opts=["--format html:artifacts/rspec.html"]
|
69
|
+
end
|
70
|
+
|
71
|
+
desc "Verify Code Coverage is at 99.4%"
|
72
|
+
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
73
|
+
t.threshold = 99.6
|
74
|
+
t.index_html = 'artifacts/index.html'
|
35
75
|
end
|
36
76
|
|
37
77
|
desc "Run flog against all the files in the lib"
|
38
|
-
task :flog do
|
78
|
+
task :flog do
|
39
79
|
require "flog"
|
40
80
|
flogger = Flog.new
|
41
81
|
flogger.flog_files Dir["lib/**/*.rb"]
|
82
|
+
FileUtils.mkdir('artifacts') unless File.directory?('artifacts')
|
42
83
|
File.open("artifacts/flogreport.txt","w") do |file|
|
43
84
|
flogger.report file
|
44
85
|
end
|
45
86
|
end
|
46
|
-
|
87
|
+
|
88
|
+
desc "Verify Flog Score is under threshold"
|
89
|
+
task :verify_flog => :flog do |t|
|
90
|
+
flog_score_threshold = 40.0
|
91
|
+
messages = []
|
92
|
+
File.readlines("artifacts/flogreport.txt").each do |line|
|
93
|
+
line =~ /^(.*): \((\d+\.\d+)\)/
|
94
|
+
if $2.to_f > flog_score_threshold
|
95
|
+
messages << "Flog score is too high for #{$1}(#{$2})"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
unless messages.empty?
|
99
|
+
puts messages
|
100
|
+
raise "Your Flog score is too high and you ought to think about the children who will have to maintain your code."
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
47
104
|
desc "Run saikuro cyclo complexity against the lib"
|
48
105
|
task :saikuro do
|
49
106
|
#we can specify options like ignore filters and set warning or error thresholds
|
50
107
|
system "ruby vendor/gems/gems/Saikuro-1.1.0/bin/saikuro -c -t -i lib -y 0 -o artifacts"
|
51
108
|
end
|
52
|
-
|
109
|
+
|
53
110
|
namespace :gem do
|
54
111
|
desc "install a gem into vendor/gems"
|
55
112
|
task :install do
|
56
113
|
if ENV["name"].nil?
|
57
114
|
STDERR.puts "Usage: rake gem:install name=the_gem_name"; exit 1
|
58
115
|
end
|
59
|
-
gem = windows? ? "gem.bat" : "gem"
|
116
|
+
gem = Taza.windows? ? "gem.bat" : "gem"
|
60
117
|
system "#{gem} install #{ENV['name']} --install-dir=vendor/gems --no-rdoc --no-ri -p ""http://10.8.77.100:8080"""
|
61
118
|
end
|
62
119
|
end
|
63
120
|
|
121
|
+
desc "Should you check-in?"
|
122
|
+
task :quick_build => [:verify_rcov, :verify_flog]
|
123
|
+
|
64
124
|
#define a task which uses flog
|
65
125
|
# vim: syntax=ruby
|
66
|
-
|
data/bin/taza
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
6
|
+
if %w(-v --version).include? ARGV.first
|
7
|
+
require 'taza'
|
8
|
+
puts "#{File.basename($0)} #{Taza::VERSION}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
source = RubiGen::PathSource.new(:application,
|
14
|
+
File.join(File.dirname(__FILE__), "../lib/app_generators"))
|
15
|
+
RubiGen::Base.reset_sources
|
16
|
+
RubiGen::Base.append_sources source
|
17
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'taza')
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubigen'
|
3
|
+
require 'activesupport'
|
4
|
+
|
5
|
+
class FlowGenerator < RubiGen::Base
|
6
|
+
default_options :author => nil
|
7
|
+
attr_reader :site_name,:name
|
8
|
+
|
9
|
+
def initialize(runtime_args, runtime_options = {})
|
10
|
+
super
|
11
|
+
usage if args.size != 2
|
12
|
+
@name = args.shift
|
13
|
+
@site_name=args.shift
|
14
|
+
check_if_site_exists
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def check_if_site_exists
|
19
|
+
unless File.directory?(File.join(destination_root,'lib','sites',site_name.underscore))
|
20
|
+
$stderr.puts "******No such site #{site_name} exists.******"
|
21
|
+
usage
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def manifest
|
26
|
+
record do |m|
|
27
|
+
m.template "flow.rb.erb", File.join('lib','sites', site_name.underscore, "flows", "#{name.underscore}.rb")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
def banner
|
33
|
+
<<-EOS
|
34
|
+
Creates a taza flow for a given taza site, site you are making a flow for must exist first.
|
35
|
+
|
36
|
+
USAGE: #{$0} #{spec.name} flow_name site_name
|
37
|
+
EOS
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_options!(opts)
|
41
|
+
# opts.separator ''
|
42
|
+
# opts.separator 'Options:'
|
43
|
+
# For each option below, place the default
|
44
|
+
# at the top of the file next to "default_options"
|
45
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
46
|
+
# "Some comment about this option",
|
47
|
+
# "Default: none") { |options[:author]| }
|
48
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
49
|
+
end
|
50
|
+
|
51
|
+
def extract_options
|
52
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
53
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
54
|
+
# raw instance variable value.
|
55
|
+
# @author = options[:author]
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubigen'
|
3
|
+
require 'activesupport'
|
4
|
+
|
5
|
+
class PageGenerator < RubiGen::Base
|
6
|
+
default_options :author => nil
|
7
|
+
attr_reader :site_name,:name
|
8
|
+
|
9
|
+
def initialize(runtime_args, runtime_options = {})
|
10
|
+
super
|
11
|
+
usage if args.size != 2
|
12
|
+
@name = args.shift
|
13
|
+
@site_name=args.shift
|
14
|
+
check_if_site_exists
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def check_if_site_exists
|
19
|
+
unless File.directory?(File.join(destination_root,'lib','sites',site_name.underscore))
|
20
|
+
$stderr.puts "******No such site #{site_name} exists.******"
|
21
|
+
usage
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def manifest
|
26
|
+
record do |m|
|
27
|
+
m.template "page.rb.erb", File.join('lib','sites', site_name.underscore, "pages", "#{name.underscore}_page.rb")
|
28
|
+
m.template "functional_page_spec.rb.erb", File.join('spec','functional',site_name.underscore,"#{name.underscore}_page_spec.rb")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
def banner
|
34
|
+
<<-EOS
|
35
|
+
Creates a taza page for a given taza site, site you are making a page for must exist first.
|
36
|
+
|
37
|
+
USAGE: #{$0} #{spec.name} page_name site_name
|
38
|
+
EOS
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_options!(opts)
|
42
|
+
# opts.separator ''
|
43
|
+
# opts.separator 'Options:'
|
44
|
+
# For each option below, place the default
|
45
|
+
# at the top of the file next to "default_options"
|
46
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
47
|
+
# "Some comment about this option",
|
48
|
+
# "Default: none") { |options[:author]| }
|
49
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
50
|
+
end
|
51
|
+
|
52
|
+
def extract_options
|
53
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
54
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
55
|
+
# raw instance variable value.
|
56
|
+
# @author = options[:author]
|
57
|
+
end
|
58
|
+
end
|