rformspec 0.4-x86-mingw32 → 0.5.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +57 -49
- data/MIT-LICENSE +21 -21
- data/README +24 -24
- data/Rakefile +63 -63
- data/docs/index.html +183 -183
- data/lib/ext/rspec_rformunit.rb +46 -46
- data/lib/rformspec.rb +41 -41
- data/lib/rformspec/control.rb +160 -153
- data/lib/rformspec/driver.rb +120 -72
- data/lib/rformspec/form_testcase.rb +40 -40
- data/lib/rformspec/keyboard.rb +24 -24
- data/lib/rformspec/mouse.rb +55 -55
- data/lib/rformspec/open_file_dialog.rb +19 -19
- data/lib/rformspec/process.rb +27 -27
- data/lib/rformspec/saveas_file_dialog.rb +18 -18
- data/lib/rformspec/testwise_plugin.rb +92 -0
- data/lib/rformspec/window.rb +130 -114
- data/sample/form_calculator/calc_helper.rb +68 -68
- data/sample/form_calculator/calc_spec.rb +33 -33
- data/sample/form_calculator/calculator.tpr +27 -27
- data/sample/form_calculator/calculator.tws +13 -13
- data/sample/mouse.rb +19 -19
- data/sample/notepad.rb +19 -19
- data/sample/notepad1.rb +14 -14
- data/sample/test_calc.rb +33 -33
- metadata +9 -7
data/CHANGELOG
CHANGED
@@ -1,49 +1,57 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
=========
|
3
|
-
|
4
|
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
|
8
|
-
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
== 0.1.
|
1
|
+
CHANGELOG
|
2
|
+
=========
|
3
|
+
0.5 (2012-7)
|
4
|
+
- TestWise IDE support
|
5
|
+
- add RWebSpec utils methods such as try_until
|
6
|
+
- wait_and focus_window is optmized
|
7
|
+
|
8
|
+
0.4.1 (2012-6)
|
9
|
+
|
10
|
+
- add get_class() to find class by name, useful for identify control + instance
|
11
|
+
|
12
|
+
0.4 (2011-10)
|
13
|
+
- Change Window class: not wait for active by default
|
14
|
+
- using global variable reference to AutoIt3 OLE
|
15
|
+
- New AutoIt class
|
16
|
+
- Examples update
|
17
|
+
|
18
|
+
0.3.2
|
19
|
+
|
20
|
+
Add option in Window class to wait to focus window (default)
|
21
|
+
|
22
|
+
0.3.1 (2010-08)
|
23
|
+
=====
|
24
|
+
Activate window not currently in focus
|
25
|
+
|
26
|
+
== 0.3 (2009-10-27)
|
27
|
+
|
28
|
+
Renamed to RFormSpec
|
29
|
+
|
30
|
+
== 0.2.0 (2007-12-18)
|
31
|
+
- add convenient methods in Driver
|
32
|
+
- add a commonly used dialog class: open file dialog, save as file dialog
|
33
|
+
- add filtered key to support 'Alt+', 'Ctrl+'
|
34
|
+
|
35
|
+
== 0.1.3 (2007-04-18)
|
36
|
+
|
37
|
+
New features:
|
38
|
+
- Support window with various titles depends on invoking conditions
|
39
|
+
|
40
|
+
== 0.1.2 (2007-02-26)
|
41
|
+
|
42
|
+
New features:
|
43
|
+
- Add ListView support
|
44
|
+
- Add Label support
|
45
|
+
|
46
|
+
Others:
|
47
|
+
- code reformating
|
48
|
+
|
49
|
+
== 0.1.1 (2006-11-29)
|
50
|
+
|
51
|
+
New features:
|
52
|
+
- replace keyboard.* with RFormUnit::Keyboard.*
|
53
|
+
- replace mouse.* with RFormUnit::Mouse.*
|
54
|
+
- replace process.* with RFormUnit::Process.*
|
55
|
+
|
56
|
+
|
57
|
+
== 0.1.0 (2006-11-28) initial release
|
data/MIT-LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
Copyright (c) 2006 Zhimin Zhan, zhimin@zhimin.com
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
1
|
+
Copyright (c) 2006 Zhimin Zhan, zhimin@zhimin.com
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
RFormSpec
|
2
|
-
=========
|
3
|
-
|
4
|
-
RFormSpec is a simple framework for automated testing Windows Form applications.
|
5
|
-
It wraps AutoItX COM API to provide an alternative way to write an easy to use,
|
6
|
-
readable automated functional tests.
|
7
|
-
|
8
|
-
Dependencies
|
9
|
-
------------
|
10
|
-
* Ruby - http://rubyinstaller.rubyforge.org/wiki/wiki.pl (Version verified: ruby185-21.exe)
|
11
|
-
* AutoIt3 - http://www.autoitscript.com/autoit3/ (Version verified v3.2.2.0)
|
12
|
-
|
13
|
-
Platform: MS Windows (of course)
|
14
|
-
|
15
|
-
Quick Start: Download iTest2 IDE, open samples\form_calculator.tpr project, run it.
|
16
|
-
|
17
|
-
|
18
|
-
Copyrights
|
19
|
-
----------
|
20
|
-
Free to use for any purposes. The software provided AS IS without any warranty whatsoever.
|
21
|
-
|
22
|
-
Contact
|
23
|
-
-------
|
24
|
-
Zhimin Zhan, Agileway Pty Ltd.
|
1
|
+
RFormSpec
|
2
|
+
=========
|
3
|
+
|
4
|
+
RFormSpec is a simple framework for automated testing Windows Form applications.
|
5
|
+
It wraps AutoItX COM API to provide an alternative way to write an easy to use,
|
6
|
+
readable automated functional tests.
|
7
|
+
|
8
|
+
Dependencies
|
9
|
+
------------
|
10
|
+
* Ruby - http://rubyinstaller.rubyforge.org/wiki/wiki.pl (Version verified: ruby185-21.exe)
|
11
|
+
* AutoIt3 - http://www.autoitscript.com/autoit3/ (Version verified v3.2.2.0)
|
12
|
+
|
13
|
+
Platform: MS Windows (of course)
|
14
|
+
|
15
|
+
Quick Start: Download iTest2 IDE, open samples\form_calculator.tpr project, run it.
|
16
|
+
|
17
|
+
|
18
|
+
Copyrights
|
19
|
+
----------
|
20
|
+
Free to use for any purposes. The software provided AS IS without any warranty whatsoever.
|
21
|
+
|
22
|
+
Contact
|
23
|
+
-------
|
24
|
+
Zhimin Zhan, Agileway Pty Ltd.
|
data/Rakefile
CHANGED
@@ -1,63 +1,63 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
|
6
|
-
$:.unshift(File.dirname(__FILE__) + "/lib")
|
7
|
-
require 'rformspec'
|
8
|
-
|
9
|
-
desc "Default task"
|
10
|
-
task :default => [ :clean, :test , :gem]
|
11
|
-
|
12
|
-
desc "Clean generated files"
|
13
|
-
task :clean do
|
14
|
-
rm_rf 'pkg'
|
15
|
-
rm_rf 'docs/rdoc'
|
16
|
-
end
|
17
|
-
|
18
|
-
# run the unit tests
|
19
|
-
Rake::TestTask.new("test") { |t|
|
20
|
-
t.test_files = FileList['test/test*.rb']
|
21
|
-
t.verbose= true
|
22
|
-
}
|
23
|
-
|
24
|
-
# Generate the RDoc documentation
|
25
|
-
Rake::RDocTask.new { |rdoc|
|
26
|
-
rdoc.rdoc_dir = 'docs/rdoc'
|
27
|
-
rdoc.title = 'rformspec'
|
28
|
-
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
29
|
-
rdoc.rdoc_files.include('README')
|
30
|
-
rdoc.rdoc_files.include('lib/rformspec.rb')
|
31
|
-
rdoc.rdoc_files.include('lib/rformspec/*.rb')
|
32
|
-
}
|
33
|
-
|
34
|
-
spec = Gem::Specification.new do |s|
|
35
|
-
s.platform= Gem::Platform::CURRENT
|
36
|
-
s.name = "rformspec"
|
37
|
-
s.version = "0.
|
38
|
-
s.summary = "An wrap of AUTOIT3 for functional testing of Windows form applications"
|
39
|
-
# s.description = ""
|
40
|
-
|
41
|
-
s.author = "Zhimin Zhan"
|
42
|
-
s.email = "zhimin@agileway.com.au"
|
43
|
-
s.homepage= "http://github.com/zhimin/rformspec"
|
44
|
-
# s.rubyforge_project = ""
|
45
|
-
|
46
|
-
s.has_rdoc = true
|
47
|
-
s.requirements << 'none'
|
48
|
-
s.require_path = "lib"
|
49
|
-
s.autorequire = "rformspec"
|
50
|
-
|
51
|
-
s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
|
52
|
-
# s.files = s.files + Dir.glob( "bin/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
53
|
-
s.files = s.files + Dir.glob( "ext/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
54
|
-
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
55
|
-
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
56
|
-
s.files = s.files + Dir.glob( "sample/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
57
|
-
s.files = s.files + Dir.glob( "docs/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
62
|
-
pkg.need_zip = true
|
63
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
|
6
|
+
$:.unshift(File.dirname(__FILE__) + "/lib")
|
7
|
+
require 'rformspec'
|
8
|
+
|
9
|
+
desc "Default task"
|
10
|
+
task :default => [ :clean, :test , :gem]
|
11
|
+
|
12
|
+
desc "Clean generated files"
|
13
|
+
task :clean do
|
14
|
+
rm_rf 'pkg'
|
15
|
+
rm_rf 'docs/rdoc'
|
16
|
+
end
|
17
|
+
|
18
|
+
# run the unit tests
|
19
|
+
Rake::TestTask.new("test") { |t|
|
20
|
+
t.test_files = FileList['test/test*.rb']
|
21
|
+
t.verbose= true
|
22
|
+
}
|
23
|
+
|
24
|
+
# Generate the RDoc documentation
|
25
|
+
Rake::RDocTask.new { |rdoc|
|
26
|
+
rdoc.rdoc_dir = 'docs/rdoc'
|
27
|
+
rdoc.title = 'rformspec'
|
28
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
29
|
+
rdoc.rdoc_files.include('README')
|
30
|
+
rdoc.rdoc_files.include('lib/rformspec.rb')
|
31
|
+
rdoc.rdoc_files.include('lib/rformspec/*.rb')
|
32
|
+
}
|
33
|
+
|
34
|
+
spec = Gem::Specification.new do |s|
|
35
|
+
s.platform= Gem::Platform::CURRENT
|
36
|
+
s.name = "rformspec"
|
37
|
+
s.version = "0.5.1"
|
38
|
+
s.summary = "An wrap of AUTOIT3 for functional testing of Windows form applications"
|
39
|
+
# s.description = ""
|
40
|
+
|
41
|
+
s.author = "Zhimin Zhan"
|
42
|
+
s.email = "zhimin@agileway.com.au"
|
43
|
+
s.homepage= "http://github.com/zhimin/rformspec"
|
44
|
+
# s.rubyforge_project = ""
|
45
|
+
|
46
|
+
s.has_rdoc = true
|
47
|
+
s.requirements << 'none'
|
48
|
+
s.require_path = "lib"
|
49
|
+
s.autorequire = "rformspec"
|
50
|
+
|
51
|
+
s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
|
52
|
+
# s.files = s.files + Dir.glob( "bin/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
53
|
+
s.files = s.files + Dir.glob( "ext/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
54
|
+
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
55
|
+
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
56
|
+
s.files = s.files + Dir.glob( "sample/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
57
|
+
s.files = s.files + Dir.glob( "docs/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
62
|
+
pkg.need_zip = true
|
63
|
+
end
|
data/docs/index.html
CHANGED
@@ -1,184 +1,184 @@
|
|
1
|
-
<html
|
2
|
-
<head>
|
3
|
-
<title>rFormUnit </title>
|
4
|
-
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
5
|
-
<link href="../../stylesheets/zhimin.css" media="screen" rel="Stylesheet" type="text/css" />
|
6
|
-
<link href="../../stylesheets/local.css" media="screen" rel="Stylesheet" type="text/css" />
|
7
|
-
|
8
|
-
<style type="text/css" media="screen">
|
9
|
-
BODY
|
10
|
-
{
|
11
|
-
BACKGROUND-COLOR: #fffff0;
|
12
|
-
COLOR: #000000;
|
13
|
-
FONT-FAMILY: "Times New Roman", Times, serif
|
14
|
-
}
|
15
|
-
|
16
|
-
.green {
|
17
|
-
background-color: #ECF3E1;
|
18
|
-
border:1px solid #C5DEA1;
|
19
|
-
}
|
20
|
-
|
21
|
-
.orange{
|
22
|
-
border:1px solid #E8A400;
|
23
|
-
background-color: #FFF4D8;
|
24
|
-
|
25
|
-
</style>
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
|
30
|
-
<h3>What is rFormUnit?</h3>
|
31
|
-
<p>rFormUnit is a simple framework for automated testing <b>Windows Form</b> applications. It wraps <a href="http://www.autoitscript.com/autoit3/">AutoItX</a> COM API to provide an alternative way to write an easy to use, readable automated functional tests.
|
32
|
-
</p>
|
33
|
-
|
34
|
-
<p>Current release: 0.1.1<br/>
|
35
|
-
<a href="releases/rformunit-0.1.1-mswin32.gem">rformunit-0.1.1-mswin32.gem</a> or from <a href="http://rubyforge.org/projects/rformunit/">rubyforge.org</a>,
|
36
|
-
|
37
|
-
<!-- <a href="releases/changelog.txt">Change logs</a> <br/> -->
|
38
|
-
Documentation: <a href="rdoc/index.html">RDoc</a>, and Quick start guide below.
|
39
|
-
</p>
|
40
|
-
|
41
|
-
<h3>Installation</h3>
|
42
|
-
|
43
|
-
<p><b>Dependecies</b><br/>
|
44
|
-
Install <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl">Ruby for windows</a><br/>
|
45
|
-
Install <a href="http://www.autoitscript.com/autoit3/">AutoIt3</a></p>
|
46
|
-
|
47
|
-
<p>Using RubyGems:
|
48
|
-
<pre class="green">$ gem install rformunit</pre>
|
49
|
-
or download and install locally:
|
50
|
-
<pre class="green">$ gem install rformunit-0.1.0-mswin32.gem</pre>
|
51
|
-
</p>
|
52
|
-
|
53
|
-
<h3>Quick start guide through examples</h3>
|
54
|
-
<ul>
|
55
|
-
<li><a href="#script">Run as automation scripts</a></li>
|
56
|
-
<li><a href="#test">Run as xUnit test cases</a></li>
|
57
|
-
<li><a href="#rspec">Run as RSpecs</a></li>
|
58
|
-
</ul>
|
59
|
-
<p>Check sample/*.rb for more examples.</p>
|
60
|
-
<a name="script"></a><h4>Run as automation scripts</h4>
|
61
|
-
<table width="100%" cellspacing="0" cellpadding="0">
|
62
|
-
<tr bgcolor="#33CC33">
|
63
|
-
<th align="left" width="50%">AutoIt3 Script</th>
|
64
|
-
<th align="left" width="50%">rFormUnit Script</th>
|
65
|
-
</tr>
|
66
|
-
<tr>
|
67
|
-
<td valign="top" nowrap="nowrap" class="orange" width="50%">
|
68
|
-
<pre>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
Run("notepad.exe")
|
73
|
-
WinWaitActive("Untitled - Notepad")
|
74
|
-
|
75
|
-
Send("Hello from Notepad.{ENTER}1 2 3{ENTER}")
|
76
|
-
Sleep(500)
|
77
|
-
Send("+{UP 2}")
|
78
|
-
Sleep(500)
|
79
|
-
|
80
|
-
Send("!f")
|
81
|
-
Send("x")
|
82
|
-
|
83
|
-
WinWaitActive("Notepad", "No")
|
84
|
-
Send("n")
|
85
|
-
|
86
|
-
</pre>
|
87
|
-
</td>
|
88
|
-
|
89
|
-
<td valign="top" nowrap="nowrap" class="green">
|
90
|
-
<pre>require 'rformunit'
|
91
|
-
|
92
|
-
include RFormUnit::Driver
|
93
|
-
|
94
|
-
RFormUnit::Process.run("NOTEPAD.EXE")
|
95
|
-
notepad_win = RFormUnit::Window.new('Untitled - Notepad')
|
96
|
-
RFormUnit::Keyboard.type("Hello from Notepad, {ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")
|
97
|
-
sleep(0.5)
|
98
|
-
RFormUnit::Keyboard.press("+{UP 2}")
|
99
|
-
sleep(0.5)
|
100
|
-
notepad_win.close
|
101
|
-
|
102
|
-
notepad_confirm_dialog = RFormUnit::Window.new('Notepad', 'No')
|
103
|
-
notepad_confirm_dialog.click_button('&No')</pre>
|
104
|
-
</td>
|
105
|
-
</tr>
|
106
|
-
</table>
|
107
|
-
|
108
|
-
<a name="test"></a>
|
109
|
-
<div id="rformunit_test">
|
110
|
-
<h4>rFormUnit Testcase</h4>
|
111
|
-
<pre class="green">require 'rformunit'
|
112
|
-
|
113
|
-
class CalcTest < RFormUnit::FormTestCase
|
114
|
-
def setup
|
115
|
-
RFormUnit::Process.run("calc.exe")
|
116
|
-
@calc_win = RFormUnit::Window.new('Calculator')
|
117
|
-
end
|
118
|
-
|
119
|
-
def teardown
|
120
|
-
@calc_win.close
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_multiple
|
124
|
-
@calc_win.click_button('127') #3
|
125
|
-
@calc_win.click_button('91') #*
|
126
|
-
@calc_win.click_button('131') #7
|
127
|
-
@calc_win.click_button('112') #=
|
128
|
-
assert_equal "21. ", @calc_win.get_control_text('403')
|
129
|
-
end
|
130
|
-
|
131
|
-
end</pre>
|
132
|
-
</div>
|
133
|
-
|
134
|
-
<a name="rspec"></a><div id='rformunit_rspec'>
|
135
|
-
<h4>rFormUnit <a href="http://rspec.rubyforge.org/">RSpec</a></h4>
|
136
|
-
<p><b>rspec_calc</b>: a spec runner to run rformunit based rspecs</p>
|
137
|
-
<pre class="green">
|
138
|
-
require File.dirname(__FILE__) + '/calc'
|
139
|
-
|
140
|
-
class RSpecCalc
|
141
|
-
include Calc
|
142
|
-
|
143
|
-
def setup
|
144
|
-
init # initialize
|
145
|
-
@calc_win = find_existing_calc_win
|
146
|
-
if @calc_win.nil?
|
147
|
-
@calc_win = start_calc
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
module Spec
|
153
|
-
module Runner
|
154
|
-
class Context
|
155
|
-
def before_context_eval
|
156
|
-
inherit RSpecCalc
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end</pre>
|
161
|
-
|
162
|
-
<p><b>calc_spec</b>: a rspec</p>
|
163
|
-
<pre class="green">
|
164
|
-
require File.dirname(__FILE__) + '/rspec_calc'
|
165
|
-
|
166
|
-
context "Calculator" do
|
167
|
-
|
168
|
-
setup do
|
169
|
-
end
|
170
|
-
|
171
|
-
specify "Multiple shall work" do
|
172
|
-
@calc_win.click_button('127') #3
|
173
|
-
@calc_win.click_button('91') #*
|
174
|
-
@calc_win.click_button('131') #7
|
175
|
-
@calc_win.click_button('112') #=
|
176
|
-
@calc_win.get_control_text('403').should == '21. '
|
177
|
-
end
|
178
|
-
|
179
|
-
end</pre>
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
</body>
|
1
|
+
<html
|
2
|
+
<head>
|
3
|
+
<title>rFormUnit </title>
|
4
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
5
|
+
<link href="../../stylesheets/zhimin.css" media="screen" rel="Stylesheet" type="text/css" />
|
6
|
+
<link href="../../stylesheets/local.css" media="screen" rel="Stylesheet" type="text/css" />
|
7
|
+
|
8
|
+
<style type="text/css" media="screen">
|
9
|
+
BODY
|
10
|
+
{
|
11
|
+
BACKGROUND-COLOR: #fffff0;
|
12
|
+
COLOR: #000000;
|
13
|
+
FONT-FAMILY: "Times New Roman", Times, serif
|
14
|
+
}
|
15
|
+
|
16
|
+
.green {
|
17
|
+
background-color: #ECF3E1;
|
18
|
+
border:1px solid #C5DEA1;
|
19
|
+
}
|
20
|
+
|
21
|
+
.orange{
|
22
|
+
border:1px solid #E8A400;
|
23
|
+
background-color: #FFF4D8;
|
24
|
+
|
25
|
+
</style>
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
|
30
|
+
<h3>What is rFormUnit?</h3>
|
31
|
+
<p>rFormUnit is a simple framework for automated testing <b>Windows Form</b> applications. It wraps <a href="http://www.autoitscript.com/autoit3/">AutoItX</a> COM API to provide an alternative way to write an easy to use, readable automated functional tests.
|
32
|
+
</p>
|
33
|
+
|
34
|
+
<p>Current release: 0.1.1<br/>
|
35
|
+
<a href="releases/rformunit-0.1.1-mswin32.gem">rformunit-0.1.1-mswin32.gem</a> or from <a href="http://rubyforge.org/projects/rformunit/">rubyforge.org</a>,
|
36
|
+
|
37
|
+
<!-- <a href="releases/changelog.txt">Change logs</a> <br/> -->
|
38
|
+
Documentation: <a href="rdoc/index.html">RDoc</a>, and Quick start guide below.
|
39
|
+
</p>
|
40
|
+
|
41
|
+
<h3>Installation</h3>
|
42
|
+
|
43
|
+
<p><b>Dependecies</b><br/>
|
44
|
+
Install <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl">Ruby for windows</a><br/>
|
45
|
+
Install <a href="http://www.autoitscript.com/autoit3/">AutoIt3</a></p>
|
46
|
+
|
47
|
+
<p>Using RubyGems:
|
48
|
+
<pre class="green">$ gem install rformunit</pre>
|
49
|
+
or download and install locally:
|
50
|
+
<pre class="green">$ gem install rformunit-0.1.0-mswin32.gem</pre>
|
51
|
+
</p>
|
52
|
+
|
53
|
+
<h3>Quick start guide through examples</h3>
|
54
|
+
<ul>
|
55
|
+
<li><a href="#script">Run as automation scripts</a></li>
|
56
|
+
<li><a href="#test">Run as xUnit test cases</a></li>
|
57
|
+
<li><a href="#rspec">Run as RSpecs</a></li>
|
58
|
+
</ul>
|
59
|
+
<p>Check sample/*.rb for more examples.</p>
|
60
|
+
<a name="script"></a><h4>Run as automation scripts</h4>
|
61
|
+
<table width="100%" cellspacing="0" cellpadding="0">
|
62
|
+
<tr bgcolor="#33CC33">
|
63
|
+
<th align="left" width="50%">AutoIt3 Script</th>
|
64
|
+
<th align="left" width="50%">rFormUnit Script</th>
|
65
|
+
</tr>
|
66
|
+
<tr>
|
67
|
+
<td valign="top" nowrap="nowrap" class="orange" width="50%">
|
68
|
+
<pre>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
Run("notepad.exe")
|
73
|
+
WinWaitActive("Untitled - Notepad")
|
74
|
+
|
75
|
+
Send("Hello from Notepad.{ENTER}1 2 3{ENTER}")
|
76
|
+
Sleep(500)
|
77
|
+
Send("+{UP 2}")
|
78
|
+
Sleep(500)
|
79
|
+
|
80
|
+
Send("!f")
|
81
|
+
Send("x")
|
82
|
+
|
83
|
+
WinWaitActive("Notepad", "No")
|
84
|
+
Send("n")
|
85
|
+
|
86
|
+
</pre>
|
87
|
+
</td>
|
88
|
+
|
89
|
+
<td valign="top" nowrap="nowrap" class="green">
|
90
|
+
<pre>require 'rformunit'
|
91
|
+
|
92
|
+
include RFormUnit::Driver
|
93
|
+
|
94
|
+
RFormUnit::Process.run("NOTEPAD.EXE")
|
95
|
+
notepad_win = RFormUnit::Window.new('Untitled - Notepad')
|
96
|
+
RFormUnit::Keyboard.type("Hello from Notepad, {ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")
|
97
|
+
sleep(0.5)
|
98
|
+
RFormUnit::Keyboard.press("+{UP 2}")
|
99
|
+
sleep(0.5)
|
100
|
+
notepad_win.close
|
101
|
+
|
102
|
+
notepad_confirm_dialog = RFormUnit::Window.new('Notepad', 'No')
|
103
|
+
notepad_confirm_dialog.click_button('&No')</pre>
|
104
|
+
</td>
|
105
|
+
</tr>
|
106
|
+
</table>
|
107
|
+
|
108
|
+
<a name="test"></a>
|
109
|
+
<div id="rformunit_test">
|
110
|
+
<h4>rFormUnit Testcase</h4>
|
111
|
+
<pre class="green">require 'rformunit'
|
112
|
+
|
113
|
+
class CalcTest < RFormUnit::FormTestCase
|
114
|
+
def setup
|
115
|
+
RFormUnit::Process.run("calc.exe")
|
116
|
+
@calc_win = RFormUnit::Window.new('Calculator')
|
117
|
+
end
|
118
|
+
|
119
|
+
def teardown
|
120
|
+
@calc_win.close
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_multiple
|
124
|
+
@calc_win.click_button('127') #3
|
125
|
+
@calc_win.click_button('91') #*
|
126
|
+
@calc_win.click_button('131') #7
|
127
|
+
@calc_win.click_button('112') #=
|
128
|
+
assert_equal "21. ", @calc_win.get_control_text('403')
|
129
|
+
end
|
130
|
+
|
131
|
+
end</pre>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<a name="rspec"></a><div id='rformunit_rspec'>
|
135
|
+
<h4>rFormUnit <a href="http://rspec.rubyforge.org/">RSpec</a></h4>
|
136
|
+
<p><b>rspec_calc</b>: a spec runner to run rformunit based rspecs</p>
|
137
|
+
<pre class="green">
|
138
|
+
require File.dirname(__FILE__) + '/calc'
|
139
|
+
|
140
|
+
class RSpecCalc
|
141
|
+
include Calc
|
142
|
+
|
143
|
+
def setup
|
144
|
+
init # initialize
|
145
|
+
@calc_win = find_existing_calc_win
|
146
|
+
if @calc_win.nil?
|
147
|
+
@calc_win = start_calc
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
module Spec
|
153
|
+
module Runner
|
154
|
+
class Context
|
155
|
+
def before_context_eval
|
156
|
+
inherit RSpecCalc
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end</pre>
|
161
|
+
|
162
|
+
<p><b>calc_spec</b>: a rspec</p>
|
163
|
+
<pre class="green">
|
164
|
+
require File.dirname(__FILE__) + '/rspec_calc'
|
165
|
+
|
166
|
+
context "Calculator" do
|
167
|
+
|
168
|
+
setup do
|
169
|
+
end
|
170
|
+
|
171
|
+
specify "Multiple shall work" do
|
172
|
+
@calc_win.click_button('127') #3
|
173
|
+
@calc_win.click_button('91') #*
|
174
|
+
@calc_win.click_button('131') #7
|
175
|
+
@calc_win.click_button('112') #=
|
176
|
+
@calc_win.get_control_text('403').should == '21. '
|
177
|
+
end
|
178
|
+
|
179
|
+
end</pre>
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
</body>
|
184
184
|
</html>
|