awat 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ README
2
+ Rakefile
3
+ VERSION
4
+ assets/selenium-server.jar
5
+ awat/test/gotoGoogle
6
+ awat/test/searchSeleniumhq
7
+ bin/awat
8
+ config/awat.yml
9
+ lib/awat.rb
10
+ Manifest
data/README ADDED
@@ -0,0 +1,8 @@
1
+ AWAT -- Automated Web Application Testing
2
+ ------------
3
+
4
+ Easy Automated Cross Browser Web Application Testing.
5
+
6
+ ------------
7
+ - ZhangJinzhu
8
+ - wosmvp@gmail.com
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('awat', File.read(File.join(File.dirname(__FILE__),'VERSION'))) do |p|
6
+ p.description = "Awat - Automated Web Application Testing"
7
+ p.author = "Jinzhu Zhang"
8
+ p.email = "wosmvp@gmail.com"
9
+ p.ignore_pattern = ["TODO"]
10
+ p.rubyforge_name = "awat"
11
+ end
12
+
13
+ desc "start selenium server"
14
+ task :server_start do
15
+ jarfile = File.join(File.dirname(__FILE__),'assets','selenium-server.jar')
16
+ system("nohup java -jar #{jarfile} -multiwindow > #{File.join('log','selenium.log')} &")
17
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{awat}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jinzhu Zhang"]
9
+ s.date = %q{2010-01-11}
10
+ s.default_executable = %q{awat}
11
+ s.description = %q{Awat - Automated Web Application Testing}
12
+ s.email = %q{wosmvp@gmail.com}
13
+ s.executables = ["awat"]
14
+ s.extra_rdoc_files = ["README", "bin/awat", "lib/awat.rb"]
15
+ s.files = ["README", "Rakefile", "VERSION", "assets/selenium-server.jar", "awat/test/gotoGoogle", "awat/test/searchSeleniumhq", "bin/awat", "config/awat.yml", "lib/awat.rb", "Manifest", "awat.gemspec"]
16
+ s.homepage = %q{}
17
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Awat", "--main", "README"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{awat}
20
+ s.rubygems_version = %q{1.3.5}
21
+ s.summary = %q{Awat - Automated Web Application Testing}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
@@ -0,0 +1,2 @@
1
+ @page.open '/'
2
+ assert_equal "Google", @page.title
@@ -0,0 +1,8 @@
1
+ depend('gotoGoogle')
2
+
3
+ @page.type "q", "Selenium seleniumhq"
4
+ @page.click "btnG", :wait_for => :page
5
+ assert_equal "Selenium seleniumhq - Google Search", @page.title
6
+ assert_equal "Selenium seleniumhq", @page.field("q")
7
+ assert @page.text?("seleniumhq.org")
8
+ assert @page.element?("link=Cached")
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2010.
3
+ # Author: Zhang Jinzhu -- wosmvp@gmail.com
4
+
5
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
6
+ require 'yaml'
7
+
8
+ file = File.expand_path('config/awat.yml')
9
+ AwatConfig = YAML.load(File.read(file))
10
+ require 'awat'
11
+
12
+ AwatConfig['selenium'] = AwatConfig['selenium'].inject({}) do |options, (key, value)|
13
+ options[(key.to_sym rescue key) || key] = value
14
+ options
15
+ end # symbolize_keys!
16
+
17
+ AwatConfig['selenium'].update(:browsers => AwatConfig['browsers'])
18
+
19
+ if ARGV.size > 0
20
+ ARGV.map do |x|
21
+ AwatConfig['path'] = File.expand_path(x)
22
+ Awat.generate_tests
23
+ end
24
+ else
25
+ AwatConfig['path'] = File.join(AwatConfig['directory'],'test')
26
+ Awat.generate_tests
27
+ end
@@ -0,0 +1,12 @@
1
+ selenium:
2
+ host: localhost
3
+ port: 4444
4
+ url: http://www.google.com
5
+ timeout_in_second: 10
6
+
7
+ browsers:
8
+ #- mock
9
+ #- googlechrome /usr/bin/chromium-browser
10
+ - firefox
11
+
12
+ directory: 'awat'
@@ -0,0 +1,41 @@
1
+ require 'test/unit'
2
+ require "rubygems"
3
+ gem "selenium-client", ">=1.2.17"
4
+ require "selenium/client"
5
+
6
+ class Awat < Test::Unit::TestCase
7
+
8
+ Dir.glob(File.join(AwatConfig['directory'],'lib','**/*')).select {|f| File.file?(f)}.map do |f|
9
+ require f
10
+ end
11
+
12
+ def depend(name)
13
+ eval File.read(File.join(AwatConfig['directory'],'test',name))
14
+ end
15
+
16
+ def screenshot(name,path)
17
+ puts "screenshot #TODO" #TODO
18
+ end
19
+
20
+ def self.files
21
+ path = AwatConfig['path']
22
+ File.file?(path) ? [path] : Dir.glob(File.join(path,'**/*')).select {|f| File.file?(f)}
23
+ end
24
+
25
+ def self.generate_tests
26
+ files.map do |f|
27
+ AwatConfig['browsers'].to_a.map do |b|
28
+ # browsers
29
+ method = %Q{def test__#{ (b + '__' +f).gsub(/\W/,'_')}()
30
+ @page = ::Selenium::Client::Driver.new(#{AwatConfig['selenium'].update(:browser => b.sub(/^\*?/,'*')).inspect})
31
+ @page.start_new_browser_session
32
+ #{File.read(f)}
33
+ ensure
34
+ @page.close_current_browser_session
35
+ end}
36
+
37
+ Awat.module_eval(method)
38
+ end
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: awat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jinzhu Zhang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-11 00:00:00 +08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Awat - Automated Web Application Testing
17
+ email: wosmvp@gmail.com
18
+ executables:
19
+ - awat
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - bin/awat
25
+ - lib/awat.rb
26
+ files:
27
+ - README
28
+ - Rakefile
29
+ - VERSION
30
+ - assets/selenium-server.jar
31
+ - awat/test/gotoGoogle
32
+ - awat/test/searchSeleniumhq
33
+ - bin/awat
34
+ - config/awat.yml
35
+ - lib/awat.rb
36
+ - Manifest
37
+ - awat.gemspec
38
+ has_rdoc: true
39
+ homepage: ""
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --line-numbers
45
+ - --inline-source
46
+ - --title
47
+ - Awat
48
+ - --main
49
+ - README
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "1.2"
63
+ version:
64
+ requirements: []
65
+
66
+ rubyforge_project: awat
67
+ rubygems_version: 1.3.5
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Awat - Automated Web Application Testing
71
+ test_files: []
72
+