scudco-scudco-spec_ui 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +47 -0
  3. data/README.txt +79 -0
  4. data/Rakefile +125 -0
  5. data/TODO +20 -0
  6. data/spec/spec_helper.rb +49 -0
  7. metadata +103 -0
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 0.5.0 / 2008-10-03
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,47 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/taza
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
23
+ lib/taza/page.rb
24
+ lib/taza/settings.rb
25
+ lib/taza/site.rb
26
+ lib/taza/tasks.rb
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 ADDED
@@ -0,0 +1,79 @@
1
+ = taza
2
+
3
+ * http://github.com/scudco/taza/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ Taza is meant to make acceptance testing more sane for developers(or QA where applicable) and customers.
8
+
9
+ == FEATURES:
10
+
11
+ * Generate a project for browser-based testing
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
16
+ * Manage tests by tags
17
+ * Cross-site testing
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
+
24
+ == SYNOPSIS:
25
+
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
45
+
46
+
47
+ == REQUIREMENTS:
48
+
49
+ * taglob
50
+
51
+ == INSTALL:
52
+
53
+ * sudo gem install taza
54
+ * gem install taza
55
+
56
+ == LICENSE:
57
+
58
+ (The MIT License)
59
+
60
+ Copyright (c) 2008 Charley Baker
61
+
62
+ Permission is hereby granted, free of charge, to any person obtaining
63
+ a copy of this software and associated documentation files (the
64
+ 'Software'), to deal in the Software without restriction, including
65
+ without limitation the rights to use, copy, modify, merge, publish,
66
+ distribute, sublicense, and/or sell copies of the Software, and to
67
+ permit persons to whom the Software is furnished to do so, subject to
68
+ the following conditions:
69
+
70
+ The above copyright notice and this permission notice shall be
71
+ included in all copies or substantial portions of the Software.
72
+
73
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
74
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
75
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
76
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
77
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
78
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
79
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,125 @@
1
+ # -*- ruby -*-
2
+ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
3
+
4
+ require 'rubygems'
5
+ require 'config/vendorized_gems'
6
+ require 'hoe'
7
+ require 'taza'
8
+ require 'rbconfig'
9
+ require 'spec/rake/spectask'
10
+ require 'spec/rake/verify_rcov'
11
+ require 'rake/rdoctask'
12
+
13
+ private
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/*')
18
+ end
19
+ public
20
+
21
+ Hoe.new('taza', Taza::VERSION) do |p|
22
+ p.rubyforge_name = 'taza' # if different than lowercase project name
23
+ p.developer('Adam Anderson', 'adamandersonis@gmail.com')
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'
42
+ end
43
+
44
+ Spec::Rake::SpecTask.new do |t|
45
+ t.libs << File.join(File.dirname(__FILE__), 'lib')
46
+ t.spec_files = spec_files
47
+ end
48
+
49
+ desc "Run all examples with RCov"
50
+ Spec::Rake::SpecTask.new('rcov') do |t|
51
+ t.spec_files = spec_files
52
+ t.libs << File.join(File.dirname(__FILE__), 'lib')
53
+ t.rcov = true
54
+ t.rcov_dir = 'artifacts'
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'
75
+ end
76
+
77
+ desc "Run flog against all the files in the lib"
78
+ task :flog do
79
+ require "flog"
80
+ flogger = Flog.new
81
+ flogger.flog_files Dir["lib/**/*.rb"]
82
+ FileUtils.mkdir('artifacts') unless File.directory?('artifacts')
83
+ File.open("artifacts/flogreport.txt","w") do |file|
84
+ flogger.report file
85
+ end
86
+ end
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
+
104
+ desc "Run saikuro cyclo complexity against the lib"
105
+ task :saikuro do
106
+ #we can specify options like ignore filters and set warning or error thresholds
107
+ system "ruby vendor/gems/gems/Saikuro-1.1.0/bin/saikuro -c -t -i lib -y 0 -o artifacts"
108
+ end
109
+
110
+ namespace :gem do
111
+ desc "install a gem into vendor/gems"
112
+ task :install do
113
+ if ENV["name"].nil?
114
+ STDERR.puts "Usage: rake gem:install name=the_gem_name"; exit 1
115
+ end
116
+ gem = Taza.windows? ? "gem.bat" : "gem"
117
+ system "#{gem} install #{ENV['name']} --install-dir=vendor/gems --no-rdoc --no-ri -p ""http://10.8.77.100:8080"""
118
+ end
119
+ end
120
+
121
+ desc "Should you check-in?"
122
+ task :quick_build => [:verify_rcov, :verify_flog]
123
+
124
+ #define a task which uses flog
125
+ # vim: syntax=ruby
data/TODO ADDED
@@ -0,0 +1,20 @@
1
+ Already spiked:
2
+ + Tagging test's (resolution: taglob)
3
+ + sites and pages (resolution: Taza::Site)
4
+ + generators for rakefile (resolution: uhh we made one?)
5
+ + running tests by tag (resolution: ???)
6
+ + gem server (resolution: taylor spiked this out)
7
+ + build artifact of a video of a test running (resolution: we have two stories around this now)
8
+ + test framework choices - what are we going to use and why we are using the one we are (resolution: rspec)
9
+ + accessing the actual browser object (who creates it, who tears it down, etc)
10
+ + block teardown of browser if yield is given for site
11
+ + gem dependencies via hoe.(taglob,rake,rspec,mocha)
12
+ + getting settings of a site: ex ECOM.settings delgates to taza::settings.site_file(ecom)
13
+ Not yet spiked:
14
+
15
+ taza
16
+ - mocks
17
+ - url resolving
18
+ - ability to change yaml for a site
19
+ - ability to run integration tests for just a site
20
+ - clean all the config tests
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ require 'mocha'
4
+ require 'config/vendorized_gems'
5
+ lib_path = File.expand_path("#{File.dirname(__FILE__)}/../lib")
6
+ $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
7
+ TMP_ROOT = File.join(File.dirname(__FILE__),"sandbox","generated")
8
+ PROJECT_NAME = 'example'
9
+ PROJECT_FOLDER = File.join(TMP_ROOT,PROJECT_NAME)
10
+
11
+
12
+ Spec::Runner.configure do |config|
13
+ config.mock_with :mocha
14
+ end
15
+
16
+ def null_device
17
+ Taza.windows? ? 'NUL': '/dev/null'
18
+ end
19
+
20
+ def generator_sources
21
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..","lib", "app_generators")),
22
+ RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", "generators"))]
23
+ end
24
+
25
+ module Helpers
26
+ module Generator
27
+ def generate_site(site_name)
28
+ site_name = "#{site_name}#{Time.now.to_i}"
29
+ run_generator('site', [site_name], generator_sources)
30
+ site_file_path = File.join(PROJECT_FOLDER,'lib','sites',"#{site_name.underscore}.rb")
31
+ require site_file_path
32
+ "::#{site_name.camelize}::#{site_name.camelize}".constantize.any_instance.stubs(:base_path).returns(PROJECT_FOLDER)
33
+ site_name.camelize.constantize
34
+ end
35
+ end
36
+
37
+ module Taza
38
+ def stub_settings
39
+ ::Taza::Settings.stubs(:config).returns({})
40
+ end
41
+
42
+ def stub_browser
43
+ stub_browser = stub()
44
+ stub_browser.stubs(:goto)
45
+ stub_browser.stubs(:close)
46
+ ::Taza::Browser.stubs(:create).returns(stub_browser)
47
+ end
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scudco-scudco-spec_ui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.6
5
+ platform: ruby
6
+ authors:
7
+ - Aslak Hellesoy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-11 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.8
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: hoe
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.8.2
32
+ version:
33
+ description: Run RSpec with UI testing tools
34
+ email: aslak.hellesoy@gmail.com
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - History.txt
41
+ - Manifest.txt
42
+ - README.txt
43
+ - examples/selenium/README.txt
44
+ - examples/watir/README.txt
45
+ files:
46
+ - TODO
47
+ - History.txt
48
+ - Manifest.txt
49
+ - README.txt
50
+ - Rakefile
51
+ - examples/selenium/README.txt
52
+ - examples/selenium/Rakefile
53
+ - examples/selenium/spec/selenium/find_rspecs_homepage_spec.rb
54
+ - examples/selenium/spec/spec_helper.rb
55
+ - examples/watir/README.txt
56
+ - examples/watir/Rakefile
57
+ - examples/watir/spec/spec_helper.rb
58
+ - examples/watir/spec/watir/find_rspecs_homepage_spec.rb
59
+ - lib/spec/ui.rb
60
+ - lib/spec/ui/formatter.rb
61
+ - lib/spec/ui/images/rmagick_not_installed.png
62
+ - lib/spec/ui/images/win32screenshot_not_installed.png
63
+ - lib/spec/ui/images/wrong_win32screenshot.png
64
+ - lib/spec/ui/screenshot_saver.rb
65
+ - lib/spec/ui/selenium.rb
66
+ - lib/spec/ui/selenium/driver_ext.rb
67
+ - lib/spec/ui/version.rb
68
+ - lib/spec/ui/watir.rb
69
+ - lib/spec/ui/watir/browser.rb
70
+ - lib/spec/ui/watir/matchers.rb
71
+ - lib/spec/ui/watir/watir_behaviour.rb
72
+ - spec/spec.opts
73
+ - spec/spec/ui/watir/matchers_spec.rb
74
+ - spec/spec_helper.rb
75
+ has_rdoc: true
76
+ homepage: http://rspec-ext.rubyforge.org
77
+ post_install_message:
78
+ rdoc_options:
79
+ - --main
80
+ - README.txt
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ requirements: []
96
+
97
+ rubyforge_project: rspec-ext
98
+ rubygems_version: 1.2.0
99
+ signing_key:
100
+ specification_version: 2
101
+ summary: Run RSpec with UI testing tools
102
+ test_files: []
103
+