oats 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.
- data/.gitignore +6 -0
- data/Gemfile +15 -0
- data/README.txt +165 -0
- data/Rakefile +2 -0
- data/bin/agent +204 -0
- data/bin/oats +10 -0
- data/bin/occ +29 -0
- data/bin/results_cleanup +6 -0
- data/doc/COPYING +55 -0
- data/doc/LICENSE +55 -0
- data/doc/OATS_Framework.doc +0 -0
- data/doc/classes/ApplicationLogs.html +239 -0
- data/doc/classes/Campaign.html +843 -0
- data/doc/classes/CommandlineOptions.html +131 -0
- data/doc/classes/Driver.html +182 -0
- data/doc/classes/Hash.html +137 -0
- data/doc/classes/Ide.html +194 -0
- data/doc/classes/MapSelenium.html +197 -0
- data/doc/classes/Net.html +107 -0
- data/doc/classes/Oats/OatsFilterError.html +119 -0
- data/doc/classes/Oats.html +998 -0
- data/doc/classes/OatsAssertError.html +119 -0
- data/doc/classes/OatsBadInput.html +119 -0
- data/doc/classes/OatsData.html +290 -0
- data/doc/classes/OatsError.html +117 -0
- data/doc/classes/OatsExit.html +117 -0
- data/doc/classes/OatsLock.html +254 -0
- data/doc/classes/OatsMain.html +182 -0
- data/doc/classes/OatsMysqlError.html +113 -0
- data/doc/classes/OatsMysqlMissingInput.html +113 -0
- data/doc/classes/OatsReportError.html +113 -0
- data/doc/classes/OatsSetupError.html +119 -0
- data/doc/classes/OatsTestError.html +119 -0
- data/doc/classes/OatsTestExit.html +119 -0
- data/doc/classes/OatsTestLocateError.html +120 -0
- data/doc/classes/OatsVerifyError.html +119 -0
- data/doc/classes/Ragent.html +397 -0
- data/doc/classes/Rclient.html +236 -0
- data/doc/classes/Report.html +368 -0
- data/doc/classes/Reports.html +244 -0
- data/doc/classes/RestApi.html +333 -0
- data/doc/classes/RhttpClient.html +236 -0
- data/doc/classes/Rimap.html +170 -0
- data/doc/classes/Rmysql.html +176 -0
- data/doc/classes/Roptions.html +131 -0
- data/doc/classes/Rselenium.html +233 -0
- data/doc/classes/Rssh.html +138 -0
- data/doc/classes/Runnable.html +174 -0
- data/doc/classes/SFTriggers.html +206 -0
- data/doc/classes/Selenium/Client/Driver.html +211 -0
- data/doc/classes/Selenium/Client.html +107 -0
- data/doc/classes/Selenium.html +107 -0
- data/doc/classes/SystemCapture.html +304 -0
- data/doc/classes/TestCase.html +418 -0
- data/doc/classes/TestData.html +235 -0
- data/doc/classes/TestList.html +264 -0
- data/doc/classes/Tools.html +244 -0
- data/doc/classes/Util.html +201 -0
- data/doc/classes/Variation.html +206 -0
- data/doc/fr_class_index.html +92 -0
- data/doc/fr_method_index.html +465 -0
- data/doc/index.html +23 -0
- data/doc/oats_httpd.conf +32 -0
- data/doc/oats_user.yml +25 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/deep_merge/.gitignore +2 -0
- data/lib/deep_merge/core.rb +195 -0
- data/lib/deep_merge/deep_merge.rb +1 -0
- data/lib/deep_merge/deep_merge_hash.rb +28 -0
- data/lib/deep_merge/rails_compat.rb +27 -0
- data/lib/oats/application_logs.rb +163 -0
- data/lib/oats/build_id.rb +58 -0
- data/lib/oats/commandline_options.rb +128 -0
- data/lib/oats/diff.rb +278 -0
- data/lib/oats/driver.rb +492 -0
- data/lib/oats/ide.rb +227 -0
- data/lib/oats/keywords.rb +67 -0
- data/lib/oats/log4r_init.rb +14 -0
- data/lib/oats/mysql.rb +97 -0
- data/lib/oats/oats.rb +637 -0
- data/lib/oats/oats_data.rb +400 -0
- data/lib/oats/oats_exceptions.rb +25 -0
- data/lib/oats/oats_lock.rb +261 -0
- data/lib/oats/oats_selenium_api.rb +639 -0
- data/lib/oats/oselenium.rb +189 -0
- data/lib/oats/ossh.rb +36 -0
- data/lib/oats/patches_for_eventmachine_12.10.rb +66 -0
- data/lib/oats/ragent.rb +321 -0
- data/lib/oats/rclient.rb +42 -0
- data/lib/oats/report.rb +207 -0
- data/lib/oats/roptions.rb +88 -0
- data/lib/oats/test_case.rb +510 -0
- data/lib/oats/test_data.rb +98 -0
- data/lib/oats/test_list.rb +141 -0
- data/lib/oats/unixdiff.rb +75 -0
- data/lib/oats/util.rb +125 -0
- data/lib/oats/version.rb +3 -0
- data/lib/oats.rb +36 -0
- data/nbproject/configs/agent.properties +0 -0
- data/nbproject/configs/gr.properties +0 -0
- data/nbproject/project.properties +10 -0
- data/nbproject/project.xml +17 -0
- data/oats.gemspec +42 -0
- data/oats_ini.yml +258 -0
- data/oats_tests/Gemfile +18 -0
- data/oats_tests/aut_ini.yml +30 -0
- data/oats_tests/bin/oats +8 -0
- data/oats_tests/environments/qa.yml +4 -0
- data/oats_tests/environments/qa_chrome.yml +4 -0
- data/oats_tests/examples/core/coreExamples.yml +8 -0
- data/oats_tests/examples/core/expectedException.rb +39 -0
- data/oats_tests/examples/core/ok_verify.rb +2 -0
- data/oats_tests/examples/core/ok_verify.rb_ok/out/myfile.txt +1 -0
- data/oats_tests/examples/core/ok_verify.rb_ok/out/myfile2.txt +1 -0
- data/oats_tests/examples/core/ok_verify.rb_ok/rats_test.log +2 -0
- data/oats_tests/examples/core/unexpectedException.rb +30 -0
- data/oats_tests/examples/examples.yml +13 -0
- data/oats_tests/examples/gui/guiExamples.yml +7 -0
- data/oats_tests/examples/gui/seleniumGoogle.rb +10 -0
- data/oats_tests/examples/gui/webdriverGoogle.rb +9 -0
- data/oats_tests/examples/keywords/SampleXlList-1.xls +0 -0
- data/oats_tests/examples/keywords/SampleXlList-2.xls +0 -0
- data/oats_tests/examples/keywords/SampleXlLists.xls +0 -0
- data/oats_tests/examples/keywords/keywordsDriver.rb +1 -0
- data/oats_tests/examples/keywords/keywordsExamples.yml +8 -0
- data/oats_tests/examples/keywords/keywordsTC1.yml +5 -0
- data/oats_tests/examples/keywords/keywordsTestlist.yml +16 -0
- data/oats_tests/examples/needsWork/addTestDynamically.rb +4 -0
- data/oats_tests/examples/needsWork/emailVerify.rb +34 -0
- data/oats_tests/examples/needsWork/testSql/rtest.sql +6 -0
- data/oats_tests/examples/needsWork/testSql/rtest.yml +11 -0
- data/oats_tests/examples/occTest/occTest.rb +13 -0
- data/oats_tests/examples/occTest/occTest_1.rb +1 -0
- data/oats_tests/examples/occTest/occTest_1_1.rb +1 -0
- data/oats_tests/examples/occTest/occTest_1_2.rb +1 -0
- data/oats_tests/examples/occTest/occTest_1_3.rb +1 -0
- data/oats_tests/examples/occTest/occTest_1_4.rb +1 -0
- data/oats_tests/examples/occTest/occTest_2.rb +1 -0
- data/oats_tests/examples/occTest/occTest_2_1.rb +1 -0
- data/oats_tests/examples/occTest/occTest_2_2.rb +1 -0
- data/oats_tests/examples/occTest/occTest_2_3.rb +1 -0
- data/oats_tests/examples/occTest/occTest_2_4.rb +1 -0
- data/oats_tests/examples/occTest/occTest_3.rb +1 -0
- data/oats_tests/examples/occTest/occTest_3_1.rb +1 -0
- data/oats_tests/examples/occTest/occTest_3_2.rb +1 -0
- data/oats_tests/examples/occTest/occTest_3_3.rb +1 -0
- data/oats_tests/examples/occTest/occTest_3_4.rb +1 -0
- data/oats_tests/examples/occTest/occTest_4.rb +1 -0
- data/oats_tests/examples/occTest/occTestlist.yml +9 -0
- data/oats_tests/examples/occTest/occTestlist_1.yml +9 -0
- data/oats_tests/examples/occTest/occTestlist_2.yml +9 -0
- data/oats_tests/examples/occTest/occTestlist_3.yml +9 -0
- data/oats_tests/examples/occTest/variation1.yml +4 -0
- data/oats_tests/examples/occTest/variation2.yml +4 -0
- data/oats_tests/examples/testFileLocationUnitTests/extn_driver.rb +4 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder/oats.yml +3 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder/t1.rb +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder1/t1.yml +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder1/t1_1.yml +3 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder2/oats.yml +3 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder2/t1.rb +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/folder2/t1.yml +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/no_yaml.rb +3 -0
- data/oats_tests/examples/testFileLocationUnitTests/post_yaml.rb +1 -0
- data/oats_tests/examples/testFileLocationUnitTests/t1.rb +4 -0
- data/oats_tests/examples/testFileLocationUnitTests/t1.yml +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/t1_1.yml +3 -0
- data/oats_tests/examples/testFileLocationUnitTests/testDir/oats.yml +3 -0
- data/oats_tests/examples/testFileLocationUnitTests/testDir/t1.rb +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/testDir/t1.yml +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/testDir2/t1.rb +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/testDir2/t1.yml +2 -0
- data/oats_tests/examples/testFileLocationUnitTests/unitTestList.yml +36 -0
- data/oats_tests/examples/testFileLocationUnitTests/yml_driver.rb +2 -0
- data/oats_tests/lib/business.rb +28 -0
- data/oats_tests/lib/sample_xl_lists.rb +37 -0
- data/test/common_test_unit_setup.rb +21 -0
- data/test/test_basic.rb +16 -0
- data/test/test_selenium.rb +16 -0
- data/test/test_xl_lists.rb +16 -0
- metadata +291 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
unless defined?(OATS_GEM_IS_ALREADY_INCLUDED)
|
|
4
|
+
OATS_GEM_IS_ALREADY_INCLUDED = true
|
|
5
|
+
|
|
6
|
+
gemspec
|
|
7
|
+
# Include Gemfile from dir_tests
|
|
8
|
+
unless ENV['OATS_TESTS']
|
|
9
|
+
ENV['OATS_TESTS'] = File.expand_path('oats_tests', File.dirname(__FILE__) )
|
|
10
|
+
puts "Undefined OATS_TESTS Environment variable, assuming: " + ENV['OATS_TESTS']
|
|
11
|
+
end
|
|
12
|
+
test_gemfile = $oats_execution['options'][ "_:gemfile"] if $oats_execution and $oats_execution['options']
|
|
13
|
+
test_gemfile ||= ENV['OATS_TESTS'] + '/Gemfile'
|
|
14
|
+
eval(IO.read(test_gemfile), binding) if File.exist?(test_gemfile)
|
|
15
|
+
end
|
data/README.txt
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
== Welcome to OATS
|
|
2
|
+
|
|
3
|
+
The goal of the Automated Testing Project is to implement the tools,
|
|
4
|
+
environment, and processes that will enable a QA team to create system
|
|
5
|
+
integration regression test cases which can be executed by QA, Development
|
|
6
|
+
teams, or build scripts in a simple or automated fashion.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
== License
|
|
10
|
+
|
|
11
|
+
OATS is copyright 2012 Levent Atasoy and contributors. It is licensed under the
|
|
12
|
+
Ruby license and the GPL. See the included LICENSE file in doc folder for
|
|
13
|
+
details.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
== OATS Installation
|
|
17
|
+
|
|
18
|
+
- Install
|
|
19
|
+
- Ruby Ruby
|
|
20
|
+
- Ruby Bundler
|
|
21
|
+
- gem install oats
|
|
22
|
+
|
|
23
|
+
- On Windows_NT, some operations need handle.exe and psexec.exe to be in the
|
|
24
|
+
PATH. These are found in PsTools Suite from
|
|
25
|
+
http://technet.microsoft.com/en-us/sysinternals
|
|
26
|
+
|
|
27
|
+
- Recommended to also install Netbeans (or another IDE of your choice)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
== Configuring OATS
|
|
31
|
+
|
|
32
|
+
OATS_HOME below refers to the oats gem installation folder
|
|
33
|
+
- Set the HOME variable C:\myDirectory
|
|
34
|
+
- Set USER PATH for ..\ruby\bin; C:\myDirectory\oats\bin
|
|
35
|
+
At this point you should be able to type 'oats' in commandline and see the
|
|
36
|
+
execution of a sample test.
|
|
37
|
+
- See OATS_HOME/doc/oats_ini.yml for customizable properties.
|
|
38
|
+
- Copy sample OATS_HOME/oats_tests folder to <yourTestFolder> and start adding your
|
|
39
|
+
own tests.
|
|
40
|
+
- Copy sample OATS_HOME/doc/oats-user.yml to HOME, and set 'dir_tests' to
|
|
41
|
+
your <yourTestFolder>
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
== Using OATS with NetBeans
|
|
45
|
+
|
|
46
|
+
- Download NetBeans from http://netbeans.org/downloads
|
|
47
|
+
* NetBeans 7.1.2 or higher is not recommended, as the Ruby debugger seems
|
|
48
|
+
to have issues on it as of 05/04/2012
|
|
49
|
+
* If you install NetBeans 7/0-7.1.1, you'll need to install Ruby Plug-ins manually
|
|
50
|
+
For using only Ruby with these versions download smallest footprint of
|
|
51
|
+
NetBeans, e.g. NetBeans C/C++).
|
|
52
|
+
To install NBMs:
|
|
53
|
+
1. Download
|
|
54
|
+
http://jruby.org.s3.amazonaws.com/downloads/community-ruby/community-ruby_7_1_preview1.zip
|
|
55
|
+
2. Select Tools->Plugins from menu
|
|
56
|
+
3. Select Downloaded tab
|
|
57
|
+
4. Press Add Plugins...
|
|
58
|
+
5. Navigate to where you unzipped the nbms files
|
|
59
|
+
6. Select all files which end in .nbms (you can do this all in one selection
|
|
60
|
+
but if you include any non-nbms file it greys out the open button)
|
|
61
|
+
7. Accept and install
|
|
62
|
+
|
|
63
|
+
- Create a new Ruby project in NetBeans for OATS Framework
|
|
64
|
+
* Select "Ruby Application with Existing Sources"
|
|
65
|
+
* Use project name 'oats'.
|
|
66
|
+
* Add Folder 'lib' under the cloned 'oats' folder into 'Existing Sources'
|
|
67
|
+
* Add Folder 'oats_tests' under the cloned 'oats' folder into 'Test Folders'
|
|
68
|
+
* Add Folder <yourTestFolder> into 'Test Folders'.
|
|
69
|
+
* Select oats Project Properties -> Run
|
|
70
|
+
- Ensure your Ruby Platform is shown on the drop down list.
|
|
71
|
+
- For Main Script, select 'oats_main.rb'
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
== Additional Ruby Installation Guidance For Windows
|
|
75
|
+
|
|
76
|
+
http://rubyinstaller.org/downloads/
|
|
77
|
+
https://github.com/oneclick/rubyinstaller/wiki/development-kit
|
|
78
|
+
1. Install ruby 1.8.7
|
|
79
|
+
- 1.9.x doesn't build ruby-debug-ide19
|
|
80
|
+
- gem install --pre ruby-debug-base19x for base only
|
|
81
|
+
2. Unzip the rubydev kit and copy all bin files into ..\ruby\bin
|
|
82
|
+
3. copy the devkit directory into ...\ruby
|
|
83
|
+
4. Left double-click the self-extracting executable (SFX) downloaded and
|
|
84
|
+
choose a directory to install the DevKit artifacts into.
|
|
85
|
+
For example, C:\DevKit
|
|
86
|
+
5. cd <DEVKIT_INSTALL_DIR>
|
|
87
|
+
example: cd Devkit
|
|
88
|
+
6. ruby dk.rb init to generate the config.yml
|
|
89
|
+
7. check the config file for correct version of ruby.
|
|
90
|
+
8. finally, ruby dk.rb install to DevKit enhance your installed Rubies.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
== LibCurl Installation (Needed only if your tests would use LibCurl)
|
|
94
|
+
|
|
95
|
+
- Darwin (Mac)
|
|
96
|
+
- Install Xcode to get the headers
|
|
97
|
+
|
|
98
|
+
- Windows
|
|
99
|
+
|
|
100
|
+
http://beginrescue.blogspot.com/2010/07/installing-curb-with-ruby-191-in.html
|
|
101
|
+
http://www.gknw.de/mirror/curl/win32/old_releases/
|
|
102
|
+
|
|
103
|
+
1. gem install oauth (from command line)
|
|
104
|
+
2. download libcurl make sure to get the one for mingw32 and that you
|
|
105
|
+
get libcurl and not plain-old curl.
|
|
106
|
+
or get libcurl from \\opfiler\qa\oatsSetup (curl-7.21.1-devel-mingw32)
|
|
107
|
+
3. copy or extract files in C drive
|
|
108
|
+
4. copy bin files to ..\ruby\bin
|
|
109
|
+
5. gem install curb -- --with-curl-lib=C:\curl-7.21.1-devel-mingw32\bin \
|
|
110
|
+
--with-curl-include=C:\curl-7.21.1-devel-mingw32\include
|
|
111
|
+
6. Add '...\curl-7.21.1-devel-mingw32\bin' to USER PATH
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
== Ruby 1.9.X IDE Debug setup
|
|
116
|
+
To use IDE debugger with 1.9.X, you will need to install 'ruby-debug19' instead
|
|
117
|
+
of 'ruby-debug' gem and follow the instructions found in:
|
|
118
|
+
http://noteslog.com/post/netbeans-6-9-1-ruby-1-9-2-rails-3-0-0-debugging
|
|
119
|
+
It instructs you to apply the following patch to:
|
|
120
|
+
(Ruby folder)/lib/ruby/gems/1.9.1/gems/ruby-debug-ide19-0.4.12/bin/rdebug-ide.rb
|
|
121
|
+
# noteslog.com, 2010-09-17 -> !!!
|
|
122
|
+
# 78 Debugger::PROG_SCRIPT = ARGV.shift
|
|
123
|
+
script = ARGV.shift
|
|
124
|
+
Debugger::PROG_SCRIPT = (script =~ /script([\\\/])rails/ ? Dir.pwd + $1 : '') + script
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
== Selenium IDE
|
|
128
|
+
|
|
129
|
+
Though not required for OATS execution you need to download and install the
|
|
130
|
+
latest Selenium IDE plug- in from http://seleniumhq.org/download/, or from the
|
|
131
|
+
list of Firefox plugins in order to create and run tests via the Selenium IDE on
|
|
132
|
+
Firefox. Read the IDE documentation at http://seleniumhq.org to learn about IDE
|
|
133
|
+
usage.
|
|
134
|
+
To use Chrome with Webdriver, download and put the chromedriver applicable to
|
|
135
|
+
your machine in the PATH for OATS.
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
== MySQL Client
|
|
139
|
+
|
|
140
|
+
If your tests interact with MySQL, then you need to install a MySQL client which
|
|
141
|
+
is the default DB interface provided by OATS. Many of the OATS tests require
|
|
142
|
+
interaction with the various RL applicaton MySQL databases. In order to
|
|
143
|
+
interact with the MySQL databases on various environments, OATS expects to find
|
|
144
|
+
the MySQL client in the PATH. To verify this, open a Windows CMD window and type
|
|
145
|
+
'mysql \--help'. If you see an error message instead of MySQL help, make sure
|
|
146
|
+
MySQL is installed on your system and that the bin directory of MySQL is
|
|
147
|
+
included in the PATH.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
== Putty and Pageant (For Windows-OCC and Windows-Agent Installations)
|
|
151
|
+
|
|
152
|
+
Installation of PuTTY, Pageant, Puttygen, and Plink are necessary if your tests
|
|
153
|
+
require access to systems via ssh. For Linux systems the default methods used by
|
|
154
|
+
OATS to interrogate logs or execute scripts on remote is via Plink, using ssh.
|
|
155
|
+
Pageant is also useful to install if you are using tortoise to access SVN setup
|
|
156
|
+
with SSH.
|
|
157
|
+
|
|
158
|
+
1. Download and install PuTTY, Pageant, Puttygen, and Plink from
|
|
159
|
+
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. These are
|
|
160
|
+
standalone executables, so you can install them wherever you'd like.
|
|
161
|
+
2. Once the PUTTY is installed, append <putty-installation-dir>/PuTTY to
|
|
162
|
+
the user environment variable PATH (create it if it does not exist.)
|
|
163
|
+
3. Use PuTTYgen to Generate Public and Private Keys, and incorporate them
|
|
164
|
+
in your appropriate authorized_keys files and .ssh folders
|
|
165
|
+
|
data/Rakefile
ADDED
data/bin/agent
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# This script is used to start OATS in agent mode and communicate with OCC.
|
|
3
|
+
|
|
4
|
+
[ "$OS" ] || export OS=$(uname)
|
|
5
|
+
if [ "$OS" == "Windows_NT" ]; then
|
|
6
|
+
export PATH="$PATH:/cygdrive/c/apps/cygwin/bin"
|
|
7
|
+
[ "$HOSTNAME" ] || HOSTNAME="$COMPUTERNAME"
|
|
8
|
+
else
|
|
9
|
+
[ "$HOSTNAME" ] || HOSTNAME=`hostname`
|
|
10
|
+
fi
|
|
11
|
+
export HOSTNAME
|
|
12
|
+
[ "$OATS_AGENT_NICKNAME" ] || OATS_AGENT_NICKNAME=${HOSTNAME/.*}
|
|
13
|
+
doc="
|
|
14
|
+
Starts OATS agent to be used with OCC
|
|
15
|
+
|
|
16
|
+
USAGE: agent [-k[ill]] [-n[ickname] OATS_AGENT_NICKNAME] [ -p[ort] OATS_AGENT_PORT ]
|
|
17
|
+
[ -r[epo] OATS_REPOSITORY_VERSION ] [ -u OATS_USER]
|
|
18
|
+
|
|
19
|
+
Parameters: (also can be passed in via environment variables
|
|
20
|
+
-n OATS_AGENT_NICKNAME OCC ID of the agent.
|
|
21
|
+
-p OATS_AGENT_PORT Agent port to communicate with OCC. Default is port previously
|
|
22
|
+
used for OATS_AGENT_NICKNAME.
|
|
23
|
+
-u OATS_USER who started the agent. Used for logging purposes only.
|
|
24
|
+
-r OATS_REPOSITORY_VERSION Required to update the agent.
|
|
25
|
+
-k kill the agent, or set OATS_KILL_AGENT
|
|
26
|
+
-d DISPLAY_NUM Number of the VNC Display, for Linux only
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
/home/occadmin/oats/bin/agent -p 3011 -n occ_1 -r 403cc620c265db84dbd3fb7d7cce4d57416bff09
|
|
30
|
+
|
|
31
|
+
The agent script should be in the path so that ssh from occ can pick it up.
|
|
32
|
+
Git requires definition of OATS_GIT_REPOSITORY environment variable.
|
|
33
|
+
"
|
|
34
|
+
input_pars="$@"
|
|
35
|
+
while [ "$1" ]; do
|
|
36
|
+
case $1 in
|
|
37
|
+
-p*) shift; OATS_AGENT_PORT="$1" ;;
|
|
38
|
+
-n*) shift; OATS_AGENT_NICKNAME="$1" ;;
|
|
39
|
+
-u*) shift; OATS_USER="$1" ;;
|
|
40
|
+
-k*) OATS_KILL_AGENT='OATS_KILL_AGENT' ;;
|
|
41
|
+
-r*) shift; OATS_REPOSITORY_VERSION="$1" ;;
|
|
42
|
+
-d*) shift; DISPLAY_NUM="$1" ;;
|
|
43
|
+
*) echo "Unrecognized parameter: $1" ;
|
|
44
|
+
echo "$doc"
|
|
45
|
+
exit ;;
|
|
46
|
+
esac
|
|
47
|
+
shift
|
|
48
|
+
done
|
|
49
|
+
|
|
50
|
+
function agent_echo {
|
|
51
|
+
echo "$(date +'%m/%d/%H:%M:%S') $*"
|
|
52
|
+
}
|
|
53
|
+
function fkill {
|
|
54
|
+
agent_echo "Killing PID: $each_pid"
|
|
55
|
+
if [ "$OS" == "Windows_NT" ]; then
|
|
56
|
+
pskill $1
|
|
57
|
+
else
|
|
58
|
+
kill -9 $1
|
|
59
|
+
fi
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
{
|
|
63
|
+
agent_echo "$0 $input_pars"
|
|
64
|
+
|
|
65
|
+
if [ -n "$(echo "$GEM_HOME" | grep ruby-1.9.2)" ]; then
|
|
66
|
+
# If spawned from OCC, running 1.9.2, we need to switch to 1.8 since
|
|
67
|
+
# can't run oauth in 1.9.2. Assume RVM is installed and the system ruby is 1.8.X
|
|
68
|
+
if [ -n "$(echo "$rvm_ruby_global_gems_path" | grep ruby-1.9.2)" ] && [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
|
|
69
|
+
source "$HOME/.rvm/scripts/rvm" # Load RVM function
|
|
70
|
+
rvm system
|
|
71
|
+
fi
|
|
72
|
+
fi
|
|
73
|
+
# Need these off when called by OCC
|
|
74
|
+
unset BUNDLE_BIN_PATH BUNDLE_GEMFILE GEM_HOME GEM_PATH MY_RUBY_HOME # RAILS_ENV
|
|
75
|
+
unset RUBYOPT
|
|
76
|
+
if [ -z "$OATS_HOME" ]; then
|
|
77
|
+
cd $(dirname $(type -p $0))/..
|
|
78
|
+
OATS_HOME=$PWD
|
|
79
|
+
fi
|
|
80
|
+
[ "$OATS_GIT_REPOSITORY" ] && OATS_HOME="$HOME/results_archive/$OATS_AGENT_NICKNAME"/oats
|
|
81
|
+
export OATS_HOME
|
|
82
|
+
export OATS_AGENT_LOGFILE="$logFile"
|
|
83
|
+
oats_bin="$OATS_HOME/bin"
|
|
84
|
+
# [ "$OS" == "Windows_NT" ] && oats_bin=$(cygpath -w $oats_bin)
|
|
85
|
+
# ruby_com="$oats_bin/oats -n $OATS_AGENT_NICKNAME -p $OATS_AGENT_PORT"
|
|
86
|
+
ruby_com="oats -n $OATS_AGENT_NICKNAME -p $OATS_AGENT_PORT"
|
|
87
|
+
export PATH="$PATH:$OATS_HOME/bin:$OATS_HOME/bin/$OS"
|
|
88
|
+
if [ -e "$config_agent_file" ]; then
|
|
89
|
+
line=$(grep "^$OATS_AGENT_NICKNAME" "$config_agent_file")
|
|
90
|
+
read nickname PREV_OATS_AGENT_PORT pid display<<< $line
|
|
91
|
+
[ "$OATS_AGENT_PORT" ] || OATS_AGENT_PORT=$PREV_OATS_AGENT_PORT
|
|
92
|
+
[ "$PID" ] || PID=$pid
|
|
93
|
+
if [ -z "$DISPLAY_NUM" ]; then
|
|
94
|
+
if [ "$display" ]; then
|
|
95
|
+
DISPLAY_NUM=$(echo "$display" | sed -e 's/.*:\(.\).*/\1/')
|
|
96
|
+
[ "$DISPLAY_NUM" ] || DISPLAY_NUM="$display"
|
|
97
|
+
else
|
|
98
|
+
DISPLAY_NUM='0'
|
|
99
|
+
fi
|
|
100
|
+
fi
|
|
101
|
+
fi
|
|
102
|
+
if [ -z "$OATS_AGENT_PORT" ]; then
|
|
103
|
+
agent_echo "$0: Must specify a port, exiting..." >&2
|
|
104
|
+
exit 1
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
[ "$OATS_AGENT_PORT" == "$PREV_OATS_AGENT_PORT" ] && PREV_OATS_AGENT_PORT=''
|
|
108
|
+
for OATS_AGENT_PORT_VAR in $PREV_OATS_AGENT_PORT $OATS_AGENT_PORT; do
|
|
109
|
+
skip_port=''
|
|
110
|
+
if [ "$PID" -a "$OATS_AGENT_PORT_VAR" == "$PREV_OATS_AGENT_PORT" ]; then
|
|
111
|
+
agent_echo "Attempting to kill agent $OATS_AGENT_NICKNAME with PID: $PID"
|
|
112
|
+
fkill $PID
|
|
113
|
+
[ $? == 0 ] && skip_port=skip_port
|
|
114
|
+
fi
|
|
115
|
+
if [ -z "$skip_port" ]; then
|
|
116
|
+
# agent_echo "Attempting to kill process holding on to port $OATS_AGENT_PORT_VAR"
|
|
117
|
+
if [ "$OS" == Darwin ]; then
|
|
118
|
+
lines=$(ps -ef|grep "$ruby_com"|grep -v grep)
|
|
119
|
+
PID=$(echo $(cut -c 6-11 <<< "$lines"))
|
|
120
|
+
else
|
|
121
|
+
if [ "$OS" == Windows_NT ]; then # Killing the top level bash process doesn't cut it
|
|
122
|
+
lines=$(netstat -a -o 2>/dev/null| grep "$OATS_AGENT_PORT_VAR .* LISTEN" )
|
|
123
|
+
else
|
|
124
|
+
lines=$(netstat -n -p -l 2>/dev/null| grep "$OATS_AGENT_PORT_VAR .* LISTEN" )
|
|
125
|
+
fi
|
|
126
|
+
PID=$(echo "$line" | sed 's/.* LISTEN[^ ]* *//;s/.ruby .*//')
|
|
127
|
+
[ "$PID" -a "$PID" != "$line" ] || PID=''
|
|
128
|
+
fi
|
|
129
|
+
if [ "$PID" ]; then
|
|
130
|
+
agent_echo "PS line(s): $lines"
|
|
131
|
+
for each_pid in $PID; do
|
|
132
|
+
fkill $each_pid
|
|
133
|
+
done
|
|
134
|
+
# else
|
|
135
|
+
# agent_echo "No agent is found on port $OATS_AGENT_PORT_VAR"
|
|
136
|
+
fi
|
|
137
|
+
fi
|
|
138
|
+
done
|
|
139
|
+
[ "$OATS_KILL_AGENT" ] && return
|
|
140
|
+
|
|
141
|
+
if [ "$OATS_GIT_REPOSITORY" ]; then
|
|
142
|
+
[ -d $OATS_HOME ] || git clone $OATS_GIT_REPOSITORY $OATS_HOME
|
|
143
|
+
cd $OATS_HOME
|
|
144
|
+
origin="$OATS_GIT_REPOSITORY"
|
|
145
|
+
[ "$origin" ] || origin=origin
|
|
146
|
+
if [ "$OATS_REPOSITORY_VERSION" ]; then
|
|
147
|
+
for i in 1 2; do
|
|
148
|
+
out=$(git checkout $OATS_REPOSITORY_VERSION 2>&1) && break # may detach HEAD, but it is OK
|
|
149
|
+
if [ "$out" == "fatal: reference is not a tree: $OATS_REPOSITORY_VERSION" ]; then
|
|
150
|
+
echo -n "Need to pull requested version: $OATS_REPOSITORY_VERSION "
|
|
151
|
+
else
|
|
152
|
+
echo "$out"
|
|
153
|
+
fi
|
|
154
|
+
git pull $origin master # fast-forward master from origin
|
|
155
|
+
done
|
|
156
|
+
else
|
|
157
|
+
git pull $origin master # fast-forward master from origin
|
|
158
|
+
fi
|
|
159
|
+
OATS_CODE_VERSION=$(git rev-list HEAD -1) # last commit in checked out version
|
|
160
|
+
if [ "${OATS_CODE_VERSION##$OATS_REPOSITORY_VERSION*}" ]; then
|
|
161
|
+
agent_echo "Could not update the code version $OATS_CODE_VERSION to $OATS_REPOSITORY_VERSION" >&2
|
|
162
|
+
return 2
|
|
163
|
+
fi
|
|
164
|
+
[ "$OATS_REPOSITORY_VERSION" ] || agent_echo "Using OATS code version: $OATS_CODE_VERSION"
|
|
165
|
+
elif [ -d .svn ]; then
|
|
166
|
+
COUNTER=0
|
|
167
|
+
[ "$OATS_REPOSITORY_VERSION" ] && agent_echo "Requested OATS Version: $OATS_REPOSITORY_VERSION"
|
|
168
|
+
while [ $COUNTER -lt 5 ]; do
|
|
169
|
+
let COUNTER=COUNTER+1
|
|
170
|
+
OATS_CODE_VERSION=$(svn info $OATS_HOME | sed -n 's/Last Changed Rev: *//p')
|
|
171
|
+
[ "$OATS_REPOSITORY_VERSION" ] || break
|
|
172
|
+
[ "$OATS_CODE_VERSION" -ge "$OATS_REPOSITORY_VERSION" ] && break
|
|
173
|
+
[ $COUNTER -eq 1 ] || sleep 3
|
|
174
|
+
svn update $OATS_HOME 2>&1
|
|
175
|
+
done
|
|
176
|
+
if [ $COUNTER -eq 5 ]; then
|
|
177
|
+
agent_echo "Could not update the code version $OATS_CODE_VERSION to $OATS_REPOSITORY_VERSION" >&2
|
|
178
|
+
return 2
|
|
179
|
+
fi
|
|
180
|
+
agent_echo "Current OATS code version: $OATS_CODE_VERSION"
|
|
181
|
+
else
|
|
182
|
+
OATS_CODE_VERSION=$OATS_REPOSITORY_VERSION
|
|
183
|
+
[ "$OATS_CODE_VERSION" ] && agent_echo "Setting OATS code version to the requested version: $OATS_CODE_VERSION]" # This is not set for development/debug
|
|
184
|
+
fi
|
|
185
|
+
export OATS_CODE_VERSION
|
|
186
|
+
# echo "$OATS_AGENT_NICKNAME $OATS_AGENT_PORT" >| $config_agent_file
|
|
187
|
+
if [ "$OS" == "Linux" ]; then # Do this with VNC displays
|
|
188
|
+
# Allocate 2x as display. VNC takes 592x, vino takes next available from 59++
|
|
189
|
+
# vnc_num="2$(echo $OATS_AGENT_PORT | cut -c 4)"
|
|
190
|
+
vnc_num="$DISPLAY_NUM"
|
|
191
|
+
[ "$vnc_num" ] || vnc_num="1"
|
|
192
|
+
pgrep -fl "Xvnc4 :$vnc_num" >/dev/null || vncserver :$vnc_num -SecurityTypes=None -geometry 1900x1060
|
|
193
|
+
export DISPLAY=":$vnc_num.0"
|
|
194
|
+
agent_echo "Setting DISPLAY to $DISPLAY"
|
|
195
|
+
fi
|
|
196
|
+
cd $OATS_HOME # Needed for bundler
|
|
197
|
+
agent_echo "Starting agent $OATS_AGENT_NICKNAME on port $OATS_AGENT_PORT"
|
|
198
|
+
$ruby_com
|
|
199
|
+
} >> $LOGFILE 2>&1 &
|
|
200
|
+
|
|
201
|
+
PID=$(jobs -p)
|
|
202
|
+
echo "Initiated PID: $PID" >> $LOGFILE
|
|
203
|
+
echo "$PID"
|
|
204
|
+
echo "$OATS_AGENT_NICKNAME $OATS_AGENT_PORT $PID $DISPLAY_NUM" >| $CONFIG_FILE
|
data/bin/oats
ADDED
data/bin/occ
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This script is used to start OCC
|
|
4
|
+
|
|
5
|
+
#[ "$RAILS_ENV" ] || export RAILS_ENV="production"
|
|
6
|
+
occ_home = ENV['OATS_OCC_HOME']
|
|
7
|
+
unless occ_home
|
|
8
|
+
pwd = Dir.pwd
|
|
9
|
+
occ_home = pwd if File.basename(pwd) == 'occ'
|
|
10
|
+
end
|
|
11
|
+
occ_home = ENV['HOME'] + '/occ' unless occ_home
|
|
12
|
+
occ_home = ENV['HOME'] + '/NetBeansProjects/occ' unless File.directory?(occ_home)
|
|
13
|
+
|
|
14
|
+
raise "Must define OCC_HOME or be in occ directory to run this command." unless occ_home
|
|
15
|
+
|
|
16
|
+
Dir.chdir(occ_home)
|
|
17
|
+
exec 'ruby script/rails server mongrel' # -p 4000
|
|
18
|
+
|
|
19
|
+
# By pass the following unless using distributed agents
|
|
20
|
+
# if [ "$OS" != "Windows_NT" ]; then
|
|
21
|
+
# if [ -z "$SSH_AGENT_PID" ] || ! ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null ; then
|
|
22
|
+
# echo "Should start_agent for SSH first"
|
|
23
|
+
# # exit 1
|
|
24
|
+
# fi
|
|
25
|
+
# ssh-add -l || echo "*** WARNING *** Please add your ssh keys ssh-add"
|
|
26
|
+
# fi
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
#mongrel_rails start -e production -p 3000 --log log\production.log
|
data/bin/results_cleanup
ADDED
data/doc/COPYING
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Open Automated Testing System (OATS) is copyrighted free software by Levent Atasoy
|
|
2
|
+
<Levent.Atasoy at gmail dot com> and contributors. You can redistribute it
|
|
3
|
+
and/or modify it under either the terms of the GPL or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a) place your modifications in the Public Domain or otherwise make them
|
|
13
|
+
Freely Available, such as by posting said modifications to Usenet or an
|
|
14
|
+
equivalent medium, or by allowing the author to include your
|
|
15
|
+
modifications in the software.
|
|
16
|
+
|
|
17
|
+
b) use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c) rename any non-standard executables so the names do not conflict with
|
|
21
|
+
standard executables, which must also be provided.
|
|
22
|
+
|
|
23
|
+
d) make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or executable
|
|
26
|
+
form, provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a) distribute the executables and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent) on where
|
|
30
|
+
to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b) accompany the distribution with the machine-readable source of the
|
|
33
|
+
software.
|
|
34
|
+
|
|
35
|
+
c) give non-standard executables non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d) make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under this terms.
|
|
43
|
+
|
|
44
|
+
5. The scripts and library files supplied as input to or produced as
|
|
45
|
+
output from the software do not automatically fall under the
|
|
46
|
+
copyright of the software, but belong to whomever generated them,
|
|
47
|
+
and may be sold commercially, and may be aggregated with this
|
|
48
|
+
software.
|
|
49
|
+
|
|
50
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
51
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
52
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
53
|
+
PURPOSE.
|
|
54
|
+
|
|
55
|
+
|
data/doc/LICENSE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Open Automated Testing System (OATS) is copyrighted free software by Levent Atasoy
|
|
2
|
+
<Levent.Atasoy at gmail dot com> and contributors. You can redistribute it
|
|
3
|
+
and/or modify it under either the terms of the GPL or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a) place your modifications in the Public Domain or otherwise make them
|
|
13
|
+
Freely Available, such as by posting said modifications to Usenet or an
|
|
14
|
+
equivalent medium, or by allowing the author to include your
|
|
15
|
+
modifications in the software.
|
|
16
|
+
|
|
17
|
+
b) use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c) rename any non-standard executables so the names do not conflict with
|
|
21
|
+
standard executables, which must also be provided.
|
|
22
|
+
|
|
23
|
+
d) make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or executable
|
|
26
|
+
form, provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a) distribute the executables and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent) on where
|
|
30
|
+
to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b) accompany the distribution with the machine-readable source of the
|
|
33
|
+
software.
|
|
34
|
+
|
|
35
|
+
c) give non-standard executables non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d) make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under this terms.
|
|
43
|
+
|
|
44
|
+
5. The scripts and library files supplied as input to or produced as
|
|
45
|
+
output from the software do not automatically fall under the
|
|
46
|
+
copyright of the software, but belong to whomever generated them,
|
|
47
|
+
and may be sold commercially, and may be aggregated with this
|
|
48
|
+
software.
|
|
49
|
+
|
|
50
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
51
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
52
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
53
|
+
PURPOSE.
|
|
54
|
+
|
|
55
|
+
|
|
Binary file
|