rwebunit 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rwebunit.rb CHANGED
@@ -9,5 +9,3 @@ require File.dirname(__FILE__) + "/rwebunit/web_page"
9
9
  require File.dirname(__FILE__) + "/rwebunit/web_testcase"
10
10
  require File.dirname(__FILE__) + "/rwebunit/web_tester"
11
11
  require File.dirname(__FILE__) + "/rwebunit/test_context"
12
-
13
-
@@ -5,9 +5,9 @@ require "rwebunit"
5
5
  $:.unshift File.dirname(__FILE__)
6
6
  require "kangxi_pages.rb"
7
7
 
8
- class TestWuning < RWebUnit::WebTestCase
8
+ class TestKangxiHome < RWebUnit::WebTestCase
9
9
 
10
- def initialize(name)
10
+ def initialize(name)
11
11
  super(name)
12
12
  end
13
13
 
@@ -23,15 +23,15 @@ class TestWuning < RWebUnit::WebTestCase
23
23
  end
24
24
 
25
25
  def test_homepage_exists()
26
- kangxi_homepage = KangxiHomePage.new(@web_tester, "Welcome")
26
+ kangxi_homepage = KangxiHomePage.new(@web_tester, "Welcome")
27
27
  end
28
28
 
29
29
  def test_all_links_exist
30
- kangxi_homepage = KangxiHomePage.new(@web_tester, "Welcome")
31
- kangxi_homepage.assertTheListLinkPresent()
32
- kangxi_homepage.assertDashboardLinkPresent
33
- kangxi_homepage.assertTestCenterLinkPresent
34
- kangxi_homepage.assertTestWebServiceLinkPresent
30
+ kangxi_homepage = KangxiHomePage.new(@web_tester, "Welcome")
31
+ kangxi_homepage.assertTheListLinkPresent()
32
+ kangxi_homepage.assertDashboardLinkPresent
33
+ kangxi_homepage.assertTestCenterLinkPresent
34
+ kangxi_homepage.assertTestWebServiceLinkPresent
35
35
  end
36
-
36
+
37
37
  end
@@ -7,7 +7,7 @@ require "kangxi_pages.rb"
7
7
 
8
8
  class TestHttpCaller < RWebUnit::WebTestCase
9
9
 
10
- def initialize(name)
10
+ def initialize(name)
11
11
  super(name)
12
12
  end
13
13
 
@@ -23,9 +23,9 @@ class TestHttpCaller < RWebUnit::WebTestCase
23
23
  end
24
24
 
25
25
  def test_can_display()
26
- kangxi_httpcaller_page = KangxiHttpCallerPage.new(@web_tester)
27
- @web_tester.assertOptionValuePresent("method", "POST")
28
- @web_tester.assertOptionValuePresent("method", "GET")
26
+ kangxi_httpcaller_page = KangxiHttpCallerPage.new(@web_tester)
27
+ @web_tester.assertOptionValuePresent("method", "POST")
28
+ @web_tester.assertOptionValuePresent("method", "GET")
29
29
 
30
30
  end
31
31
 
@@ -7,7 +7,7 @@ require "kangxi_pages.rb"
7
7
 
8
8
  class TestXmlFormatter < RWebUnit::WebTestCase
9
9
 
10
- def initialize(name)
10
+ def initialize(name)
11
11
  super(name)
12
12
  end
13
13
 
@@ -25,20 +25,20 @@ class TestXmlFormatter < RWebUnit::WebTestCase
25
25
  end
26
26
 
27
27
  def test_can_invoke_format
28
- @kangxi_xmlformatter_page.enterXml("<name><first>James</first><last>Bond</last></name>")
29
- @kangxi_xmlformatter_page.clickFormat
28
+ @kangxi_xmlformatter_page.enterXml("<name><first>James</first><last>Bond</last></name>")
29
+ @kangxi_xmlformatter_page.clickFormat
30
30
  end
31
31
 
32
32
  def test_format_sample_xml
33
- @kangxi_xmlformatter_page.clickFillExampleLink
34
- @web_tester.assertElementNotPresent("formatted_xml")
35
- @kangxi_xmlformatter_page.submit
36
- @web_tester.assertElementPresent("formatted_xml")
33
+ @kangxi_xmlformatter_page.clickFillExampleLink
34
+ @web_tester.assertElementNotPresent("formatted_xml")
35
+ @kangxi_xmlformatter_page.submit
36
+ @web_tester.assertElementPresent("formatted_xml")
37
37
  end
38
38
 
39
39
  def test_can_call_utils
40
- @kangxi_xmlformatter_page.enterXml("<date><now>" + getToday + "</now></date>")
41
- @kangxi_xmlformatter_page.clickFormat
40
+ @kangxi_xmlformatter_page.enterXml("<date><now>" + getToday + "</now></date>")
41
+ @kangxi_xmlformatter_page.clickFormat
42
42
  end
43
43
 
44
44
  end
@@ -12,4 +12,4 @@ class RWebUnitSearchExample < RWebUnit::WebTestCase
12
12
  assertTitleEquals("HttpUnit Home")
13
13
  assertLinkPresentWithText("User's Manual")
14
14
  end
15
- end
15
+ end
@@ -3,7 +3,7 @@ require 'rwebunit'
3
3
 
4
4
  class RWebUnitSearchExample < RWebUnit::WebTestCase
5
5
 
6
- def initialize(name)
6
+ def initialize(name)
7
7
  super(name)
8
8
  end
9
9
 
@@ -3,15 +3,15 @@ require 'watir'
3
3
  require 'test/unit'
4
4
 
5
5
  class WatirSearchExample < Test::Unit::TestCase
6
-
7
- def test_search
8
- ie = Watir::IE.new
9
- ie.goto("http://www.google.com")
10
- ie.text_field(:name, "q").set("httpunit")
11
- ie.button(:name, "btnG").click
12
- ie.link(:text, "HttpUnit Home").click
13
- assert_equal("HttpUnit Home", ie.document.title)
14
- assert(ie.contains_text("User's Manual"))
15
- end
16
-
17
- end
6
+
7
+ def test_search
8
+ ie = Watir::IE.new
9
+ ie.goto("http://www.google.com")
10
+ ie.text_field(:name, "q").set("httpunit")
11
+ ie.button(:name, "btnG").click
12
+ ie.link(:text, "HttpUnit Home").click
13
+ assert_equal("HttpUnit Home", ie.document.title)
14
+ assert(ie.contains_text("User's Manual"))
15
+ end
16
+
17
+ end
@@ -5,69 +5,69 @@ require "test_utils.rb"
5
5
  require 'test/unit'
6
6
 
7
7
  class TestWebTestCase < Test::Unit::TestCase
8
- include RWebUnit::Utils
8
+ include RWebUnit::Utils
9
9
 
10
- def setup
11
- end
10
+ def setup
11
+ end
12
12
 
13
- def teardown
14
- end
13
+ def teardown
14
+ end
15
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
- end
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
+ end
20
20
 
21
- def test_getDaysBefore
22
- yesterday = Time.now - 24 * 3600 * 1
23
- yesterday_str = sprintf("%02d/%02d/%04d", yesterday.day, yesterday.month, yesterday.year)
24
- assert_equal(yesterday_str, getDaysBefore(1))
25
- assert_equal(yesterday_str, getYesterday)
26
- end
27
-
28
- def test_getDaysAfter
29
- tomorrow = Time.now + 24 * 3600 * 1
30
- tomorrow_str = sprintf("%02d/%02d/%04d", tomorrow.day, tomorrow.month, tomorrow.year)
31
- assert_equal(tomorrow_str, getDaysAfter(1))
32
- assert_equal(tomorrow_str, getTomorrow)
33
- end
34
-
35
- def test_randomBoolean
36
- true_count = 0
37
- false_count = 0
38
- 100.times {
39
- obj = randomBoolean
40
- assert(obj.instance_of?(TrueClass) || obj.instance_of?(FalseClass), "can only be true or false")
41
- true_count += 1 if obj
42
- false_count += 1 if !obj
43
- }
44
- assert(true_count > 0, "it is not random")
45
- assert(false_count > 0, "it is not random")
46
- end
21
+ def test_getDaysBefore
22
+ yesterday = Time.now - 24 * 3600 * 1
23
+ yesterday_str = sprintf("%02d/%02d/%04d", yesterday.day, yesterday.month, yesterday.year)
24
+ assert_equal(yesterday_str, getDaysBefore(1))
25
+ assert_equal(yesterday_str, getYesterday)
26
+ end
47
27
 
48
- def test_randomNumber
49
- tmp_array = []
50
- 1000.times {
51
- num = randomNumber(1,10)
52
- assert(num.instance_of?(Fixnum), "can only be number")
53
- tmp_array << num
54
- }
55
- uniq_numbers = tmp_array.uniq.sort
56
- assert_equal(10, uniq_numbers.length)
57
- assert_equal(1, uniq_numbers[0])
58
- assert_equal(10, uniq_numbers[9])
59
- end
28
+ def test_getDaysAfter
29
+ tomorrow = Time.now + 24 * 3600 * 1
30
+ tomorrow_str = sprintf("%02d/%02d/%04d", tomorrow.day, tomorrow.month, tomorrow.year)
31
+ assert_equal(tomorrow_str, getDaysAfter(1))
32
+ assert_equal(tomorrow_str, getTomorrow)
33
+ end
60
34
 
61
- def test_randomDigit
62
- tmp_array = []
63
- 1000.times {
64
- dc = randomDigit()
65
- tmp_array << dc
66
- }
67
- uniq_digits = tmp_array.uniq.sort
68
- assert_equal(10, uniq_digits.length)
69
- assert_equal('0', uniq_digits[0])
70
- assert_equal('9', uniq_digits[9])
71
- end
35
+ def test_randomBoolean
36
+ true_count = 0
37
+ false_count = 0
38
+ 100.times {
39
+ obj = randomBoolean
40
+ assert(obj.instance_of?(TrueClass) || obj.instance_of?(FalseClass), "can only be true or false")
41
+ true_count += 1 if obj
42
+ false_count += 1 if !obj
43
+ }
44
+ assert(true_count > 0, "it is not random")
45
+ assert(false_count > 0, "it is not random")
46
+ end
47
+
48
+ def test_randomNumber
49
+ tmp_array = []
50
+ 1000.times {
51
+ num = randomNumber(1,10)
52
+ assert(num.instance_of?(Fixnum), "can only be number")
53
+ tmp_array << num
54
+ }
55
+ uniq_numbers = tmp_array.uniq.sort
56
+ assert_equal(10, uniq_numbers.length)
57
+ assert_equal(1, uniq_numbers[0])
58
+ assert_equal(10, uniq_numbers[9])
59
+ end
60
+
61
+ def test_randomDigit
62
+ tmp_array = []
63
+ 1000.times {
64
+ dc = randomDigit()
65
+ tmp_array << dc
66
+ }
67
+ uniq_digits = tmp_array.uniq.sort
68
+ assert_equal(10, uniq_digits.length)
69
+ assert_equal('0', uniq_digits[0])
70
+ assert_equal('9', uniq_digits[9])
71
+ end
72
72
 
73
73
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rwebunit
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2006-05-14 00:00:00 +10:00
6
+ version: 0.2.0
7
+ date: 2006-11-28 00:00:00 +10:00
8
8
  summary: An wrap of WATIR for functional testing of web applications
9
9
  require_paths:
10
10
  - lib
@@ -25,6 +25,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - Zhimin Zhan
30
31
  files:
@@ -32,23 +33,23 @@ files:
32
33
  - README
33
34
  - CHANGELOG
34
35
  - MIT-LICENSE
35
- - lib/rwebunit.rb
36
36
  - lib/rwebunit
37
+ - lib/rwebunit.rb
37
38
  - lib/rwebunit/test_context.rb
38
39
  - lib/rwebunit/test_utils.rb
39
40
  - lib/rwebunit/web_page.rb
40
41
  - lib/rwebunit/web_testcase.rb
41
42
  - lib/rwebunit/web_tester.rb
42
43
  - test/test_test_utils.rb
43
- - sample/kangxi_pages.rb
44
- - sample/sample_rwebunit_test.rb
45
- - sample/sample_rwebunit_testcase.rb
46
- - sample/sample_watir_test.rb
47
- - sample/README.txt
48
44
  - sample/kangxi_home_webtest.rb
49
45
  - sample/kangxi_httpcaller_webtest.rb
46
+ - sample/kangxi_pages.rb
50
47
  - sample/kangxi_xml_formatter_webtest.rb
48
+ - sample/README.txt
51
49
  - sample/rwebunit_home_testcase.rb
50
+ - sample/sample_rwebunit_test.rb
51
+ - sample/sample_rwebunit_testcase.rb
52
+ - sample/sample_watir_test.rb
52
53
  - docs/html
53
54
  - docs/html/index.html
54
55
  test_files: []