rwebunit 0.2.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +110 -35
- data/Rakefile +6 -5
- data/lib/rwebunit/assert.rb +249 -0
- data/lib/rwebunit/driver.rb +296 -0
- data/lib/rwebunit/rspec_helper.rb +108 -0
- data/lib/rwebunit/test_context.rb +15 -10
- data/lib/rwebunit/test_utils.rb +81 -72
- data/lib/rwebunit/web_page.rb +58 -66
- data/lib/rwebunit/web_testcase.rb +20 -201
- data/lib/rwebunit/web_tester.rb +365 -399
- data/lib/rwebunit.rb +5 -0
- data/test/test_test_utils.rb +76 -73
- metadata +45 -43
data/lib/rwebunit.rb
CHANGED
@@ -6,6 +6,11 @@
|
|
6
6
|
# Extra full path to load libraries
|
7
7
|
require File.dirname(__FILE__) + "/rwebunit/test_utils"
|
8
8
|
require File.dirname(__FILE__) + "/rwebunit/web_page"
|
9
|
+
require File.dirname(__FILE__) + "/rwebunit/assert"
|
9
10
|
require File.dirname(__FILE__) + "/rwebunit/web_testcase"
|
10
11
|
require File.dirname(__FILE__) + "/rwebunit/web_tester"
|
11
12
|
require File.dirname(__FILE__) + "/rwebunit/test_context"
|
13
|
+
require File.dirname(__FILE__) + "/rwebunit/driver"
|
14
|
+
require File.dirname(__FILE__) + "/rwebunit/rspec_helper"
|
15
|
+
|
16
|
+
|
data/test/test_test_utils.rb
CHANGED
@@ -1,73 +1,76 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), "..", "lib/rwebunit")
|
2
|
-
$:.unshift File.dirname(__FILE__)
|
3
|
-
|
4
|
-
require "test_utils.rb"
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class TestWebTestCase < Test::Unit::TestCase
|
8
|
-
include RWebUnit::Utils
|
9
|
-
|
10
|
-
def setup
|
11
|
-
end
|
12
|
-
|
13
|
-
def teardown
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_getToday
|
17
|
-
today_str = sprintf("%02d/%02d/%04d", Time.now.day, Time.now.month, Time.now.year)
|
18
|
-
assert_equal(today_str, getToday)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib/rwebunit")
|
2
|
+
$:.unshift File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require "test_utils.rb"
|
5
|
+
require 'test/unit'
|
6
|
+
|
7
|
+
class TestWebTestCase < Test::Unit::TestCase
|
8
|
+
include RWebUnit::Utils
|
9
|
+
|
10
|
+
def setup
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_getToday
|
17
|
+
today_str = sprintf("%02d/%02d/%04d", Time.now.day, Time.now.month, Time.now.year)
|
18
|
+
assert_equal(today_str, getToday)
|
19
|
+
assert_equal(today_str, today)
|
20
|
+
assert_equal(sprintf("%04d-%02d-%02d", Time.now.year, Time.now.month, Time.now.day), today("blah"))
|
21
|
+
assert_equal(sprintf("%02d/%02d/%04d", Time.now.month, Time.now.day, Time.now.year), today("%m/%d/%Y"))
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_getDaysBefore
|
25
|
+
yesterday_date = Time.now - 24 * 3600 * 1
|
26
|
+
yesterday_str = sprintf("%02d/%02d/%04d", yesterday_date.day, yesterday_date.month, yesterday_date.year)
|
27
|
+
assert_equal(yesterday_str, days_before(1))
|
28
|
+
assert_equal(yesterday_str, yesterday)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_future_date
|
32
|
+
tomorrow_date = Time.now + 24 * 3600 * 1
|
33
|
+
tomorrow_str = sprintf("%02d/%02d/%04d", tomorrow_date.day, tomorrow_date.month, tomorrow_date.year)
|
34
|
+
assert_equal(tomorrow_str, days_from_now(1))
|
35
|
+
assert_equal(tomorrow_str, tomorrow)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_randomBoolean
|
39
|
+
true_count = 0
|
40
|
+
false_count = 0
|
41
|
+
100.times {
|
42
|
+
obj = random_boolean
|
43
|
+
assert(obj.instance_of?(TrueClass) || obj.instance_of?(FalseClass), "can only be true or false")
|
44
|
+
true_count += 1 if obj
|
45
|
+
false_count += 1 if !obj
|
46
|
+
}
|
47
|
+
assert(true_count > 0, "it is not random")
|
48
|
+
assert(false_count > 0, "it is not random")
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_random_number
|
52
|
+
tmp_array = []
|
53
|
+
1000.times {
|
54
|
+
num = random_number(1,10)
|
55
|
+
assert(num.instance_of?(Fixnum), "can only be number")
|
56
|
+
tmp_array << num
|
57
|
+
}
|
58
|
+
uniq_numbers = tmp_array.uniq.sort
|
59
|
+
assert_equal(10, uniq_numbers.length)
|
60
|
+
assert_equal(1, uniq_numbers[0])
|
61
|
+
assert_equal(10, uniq_numbers[9])
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_random_digit
|
65
|
+
tmp_array = []
|
66
|
+
1000.times {
|
67
|
+
dc = random_digit
|
68
|
+
tmp_array << dc
|
69
|
+
}
|
70
|
+
uniq_digits = tmp_array.uniq.sort
|
71
|
+
assert_equal(10, uniq_digits.length)
|
72
|
+
assert_equal('0', uniq_digits[0])
|
73
|
+
assert_equal('9', uniq_digits[9])
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
metadata
CHANGED
@@ -1,45 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: rwebunit
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2
|
7
|
-
date: 2006-11-28 00:00:00 +10:00
|
8
|
-
summary: An wrap of WATIR for functional testing of web applications
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: zhimin@zhimin.com
|
12
|
-
homepage: http://www.zhimin.com/software/rwebunit/
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire: rwebunit
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.7.2
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Zhimin Zhan
|
8
|
+
autorequire: rwebunit
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2007-12-31 00:00:00 +10:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: zhimin@zhimin.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
31
24
|
files:
|
32
25
|
- Rakefile
|
33
26
|
- README
|
34
27
|
- CHANGELOG
|
35
28
|
- MIT-LICENSE
|
36
29
|
- lib/rwebunit
|
37
|
-
- lib/rwebunit.rb
|
30
|
+
- lib/rwebunit/assert.rb
|
31
|
+
- lib/rwebunit/driver.rb
|
32
|
+
- lib/rwebunit/rspec_helper.rb
|
38
33
|
- lib/rwebunit/test_context.rb
|
39
34
|
- lib/rwebunit/test_utils.rb
|
40
35
|
- lib/rwebunit/web_page.rb
|
41
36
|
- lib/rwebunit/web_testcase.rb
|
42
37
|
- lib/rwebunit/web_tester.rb
|
38
|
+
- lib/rwebunit.rb
|
43
39
|
- test/test_test_utils.rb
|
44
40
|
- sample/kangxi_home_webtest.rb
|
45
41
|
- sample/kangxi_httpcaller_webtest.rb
|
@@ -52,25 +48,31 @@ files:
|
|
52
48
|
- sample/sample_watir_test.rb
|
53
49
|
- docs/html
|
54
50
|
- docs/html/index.html
|
55
|
-
|
56
|
-
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://code.google.com/p/rwebunit/
|
53
|
+
post_install_message:
|
57
54
|
rdoc_options: []
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
65
70
|
requirements:
|
66
71
|
- none
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.4.1
|
76
|
-
version:
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.0.1
|
74
|
+
signing_key:
|
75
|
+
specification_version: 2
|
76
|
+
summary: An wrap of WATIR/FireWatir for functional testing of web applications
|
77
|
+
test_files: []
|
78
|
+
|