oats 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +15 -0
  3. data/README.txt +165 -0
  4. data/Rakefile +2 -0
  5. data/bin/agent +204 -0
  6. data/bin/oats +10 -0
  7. data/bin/occ +29 -0
  8. data/bin/results_cleanup +6 -0
  9. data/doc/COPYING +55 -0
  10. data/doc/LICENSE +55 -0
  11. data/doc/OATS_Framework.doc +0 -0
  12. data/doc/classes/ApplicationLogs.html +239 -0
  13. data/doc/classes/Campaign.html +843 -0
  14. data/doc/classes/CommandlineOptions.html +131 -0
  15. data/doc/classes/Driver.html +182 -0
  16. data/doc/classes/Hash.html +137 -0
  17. data/doc/classes/Ide.html +194 -0
  18. data/doc/classes/MapSelenium.html +197 -0
  19. data/doc/classes/Net.html +107 -0
  20. data/doc/classes/Oats/OatsFilterError.html +119 -0
  21. data/doc/classes/Oats.html +998 -0
  22. data/doc/classes/OatsAssertError.html +119 -0
  23. data/doc/classes/OatsBadInput.html +119 -0
  24. data/doc/classes/OatsData.html +290 -0
  25. data/doc/classes/OatsError.html +117 -0
  26. data/doc/classes/OatsExit.html +117 -0
  27. data/doc/classes/OatsLock.html +254 -0
  28. data/doc/classes/OatsMain.html +182 -0
  29. data/doc/classes/OatsMysqlError.html +113 -0
  30. data/doc/classes/OatsMysqlMissingInput.html +113 -0
  31. data/doc/classes/OatsReportError.html +113 -0
  32. data/doc/classes/OatsSetupError.html +119 -0
  33. data/doc/classes/OatsTestError.html +119 -0
  34. data/doc/classes/OatsTestExit.html +119 -0
  35. data/doc/classes/OatsTestLocateError.html +120 -0
  36. data/doc/classes/OatsVerifyError.html +119 -0
  37. data/doc/classes/Ragent.html +397 -0
  38. data/doc/classes/Rclient.html +236 -0
  39. data/doc/classes/Report.html +368 -0
  40. data/doc/classes/Reports.html +244 -0
  41. data/doc/classes/RestApi.html +333 -0
  42. data/doc/classes/RhttpClient.html +236 -0
  43. data/doc/classes/Rimap.html +170 -0
  44. data/doc/classes/Rmysql.html +176 -0
  45. data/doc/classes/Roptions.html +131 -0
  46. data/doc/classes/Rselenium.html +233 -0
  47. data/doc/classes/Rssh.html +138 -0
  48. data/doc/classes/Runnable.html +174 -0
  49. data/doc/classes/SFTriggers.html +206 -0
  50. data/doc/classes/Selenium/Client/Driver.html +211 -0
  51. data/doc/classes/Selenium/Client.html +107 -0
  52. data/doc/classes/Selenium.html +107 -0
  53. data/doc/classes/SystemCapture.html +304 -0
  54. data/doc/classes/TestCase.html +418 -0
  55. data/doc/classes/TestData.html +235 -0
  56. data/doc/classes/TestList.html +264 -0
  57. data/doc/classes/Tools.html +244 -0
  58. data/doc/classes/Util.html +201 -0
  59. data/doc/classes/Variation.html +206 -0
  60. data/doc/fr_class_index.html +92 -0
  61. data/doc/fr_method_index.html +465 -0
  62. data/doc/index.html +23 -0
  63. data/doc/oats_httpd.conf +32 -0
  64. data/doc/oats_user.yml +25 -0
  65. data/doc/rdoc-style.css +208 -0
  66. data/lib/deep_merge/.gitignore +2 -0
  67. data/lib/deep_merge/core.rb +195 -0
  68. data/lib/deep_merge/deep_merge.rb +1 -0
  69. data/lib/deep_merge/deep_merge_hash.rb +28 -0
  70. data/lib/deep_merge/rails_compat.rb +27 -0
  71. data/lib/oats/application_logs.rb +163 -0
  72. data/lib/oats/build_id.rb +58 -0
  73. data/lib/oats/commandline_options.rb +128 -0
  74. data/lib/oats/diff.rb +278 -0
  75. data/lib/oats/driver.rb +492 -0
  76. data/lib/oats/ide.rb +227 -0
  77. data/lib/oats/keywords.rb +67 -0
  78. data/lib/oats/log4r_init.rb +14 -0
  79. data/lib/oats/mysql.rb +97 -0
  80. data/lib/oats/oats.rb +637 -0
  81. data/lib/oats/oats_data.rb +400 -0
  82. data/lib/oats/oats_exceptions.rb +25 -0
  83. data/lib/oats/oats_lock.rb +261 -0
  84. data/lib/oats/oats_selenium_api.rb +639 -0
  85. data/lib/oats/oselenium.rb +189 -0
  86. data/lib/oats/ossh.rb +36 -0
  87. data/lib/oats/patches_for_eventmachine_12.10.rb +66 -0
  88. data/lib/oats/ragent.rb +321 -0
  89. data/lib/oats/rclient.rb +42 -0
  90. data/lib/oats/report.rb +207 -0
  91. data/lib/oats/roptions.rb +88 -0
  92. data/lib/oats/test_case.rb +510 -0
  93. data/lib/oats/test_data.rb +98 -0
  94. data/lib/oats/test_list.rb +141 -0
  95. data/lib/oats/unixdiff.rb +75 -0
  96. data/lib/oats/util.rb +125 -0
  97. data/lib/oats/version.rb +3 -0
  98. data/lib/oats.rb +36 -0
  99. data/nbproject/configs/agent.properties +0 -0
  100. data/nbproject/configs/gr.properties +0 -0
  101. data/nbproject/project.properties +10 -0
  102. data/nbproject/project.xml +17 -0
  103. data/oats.gemspec +42 -0
  104. data/oats_ini.yml +258 -0
  105. data/oats_tests/Gemfile +18 -0
  106. data/oats_tests/aut_ini.yml +30 -0
  107. data/oats_tests/bin/oats +8 -0
  108. data/oats_tests/environments/qa.yml +4 -0
  109. data/oats_tests/environments/qa_chrome.yml +4 -0
  110. data/oats_tests/examples/core/coreExamples.yml +8 -0
  111. data/oats_tests/examples/core/expectedException.rb +39 -0
  112. data/oats_tests/examples/core/ok_verify.rb +2 -0
  113. data/oats_tests/examples/core/ok_verify.rb_ok/out/myfile.txt +1 -0
  114. data/oats_tests/examples/core/ok_verify.rb_ok/out/myfile2.txt +1 -0
  115. data/oats_tests/examples/core/ok_verify.rb_ok/rats_test.log +2 -0
  116. data/oats_tests/examples/core/unexpectedException.rb +30 -0
  117. data/oats_tests/examples/examples.yml +13 -0
  118. data/oats_tests/examples/gui/guiExamples.yml +7 -0
  119. data/oats_tests/examples/gui/seleniumGoogle.rb +10 -0
  120. data/oats_tests/examples/gui/webdriverGoogle.rb +9 -0
  121. data/oats_tests/examples/keywords/SampleXlList-1.xls +0 -0
  122. data/oats_tests/examples/keywords/SampleXlList-2.xls +0 -0
  123. data/oats_tests/examples/keywords/SampleXlLists.xls +0 -0
  124. data/oats_tests/examples/keywords/keywordsDriver.rb +1 -0
  125. data/oats_tests/examples/keywords/keywordsExamples.yml +8 -0
  126. data/oats_tests/examples/keywords/keywordsTC1.yml +5 -0
  127. data/oats_tests/examples/keywords/keywordsTestlist.yml +16 -0
  128. data/oats_tests/examples/needsWork/addTestDynamically.rb +4 -0
  129. data/oats_tests/examples/needsWork/emailVerify.rb +34 -0
  130. data/oats_tests/examples/needsWork/testSql/rtest.sql +6 -0
  131. data/oats_tests/examples/needsWork/testSql/rtest.yml +11 -0
  132. data/oats_tests/examples/occTest/occTest.rb +13 -0
  133. data/oats_tests/examples/occTest/occTest_1.rb +1 -0
  134. data/oats_tests/examples/occTest/occTest_1_1.rb +1 -0
  135. data/oats_tests/examples/occTest/occTest_1_2.rb +1 -0
  136. data/oats_tests/examples/occTest/occTest_1_3.rb +1 -0
  137. data/oats_tests/examples/occTest/occTest_1_4.rb +1 -0
  138. data/oats_tests/examples/occTest/occTest_2.rb +1 -0
  139. data/oats_tests/examples/occTest/occTest_2_1.rb +1 -0
  140. data/oats_tests/examples/occTest/occTest_2_2.rb +1 -0
  141. data/oats_tests/examples/occTest/occTest_2_3.rb +1 -0
  142. data/oats_tests/examples/occTest/occTest_2_4.rb +1 -0
  143. data/oats_tests/examples/occTest/occTest_3.rb +1 -0
  144. data/oats_tests/examples/occTest/occTest_3_1.rb +1 -0
  145. data/oats_tests/examples/occTest/occTest_3_2.rb +1 -0
  146. data/oats_tests/examples/occTest/occTest_3_3.rb +1 -0
  147. data/oats_tests/examples/occTest/occTest_3_4.rb +1 -0
  148. data/oats_tests/examples/occTest/occTest_4.rb +1 -0
  149. data/oats_tests/examples/occTest/occTestlist.yml +9 -0
  150. data/oats_tests/examples/occTest/occTestlist_1.yml +9 -0
  151. data/oats_tests/examples/occTest/occTestlist_2.yml +9 -0
  152. data/oats_tests/examples/occTest/occTestlist_3.yml +9 -0
  153. data/oats_tests/examples/occTest/variation1.yml +4 -0
  154. data/oats_tests/examples/occTest/variation2.yml +4 -0
  155. data/oats_tests/examples/testFileLocationUnitTests/extn_driver.rb +4 -0
  156. data/oats_tests/examples/testFileLocationUnitTests/folder/oats.yml +3 -0
  157. data/oats_tests/examples/testFileLocationUnitTests/folder/t1.rb +2 -0
  158. data/oats_tests/examples/testFileLocationUnitTests/folder1/t1.yml +2 -0
  159. data/oats_tests/examples/testFileLocationUnitTests/folder1/t1_1.yml +3 -0
  160. data/oats_tests/examples/testFileLocationUnitTests/folder2/oats.yml +3 -0
  161. data/oats_tests/examples/testFileLocationUnitTests/folder2/t1.rb +2 -0
  162. data/oats_tests/examples/testFileLocationUnitTests/folder2/t1.yml +2 -0
  163. data/oats_tests/examples/testFileLocationUnitTests/no_yaml.rb +3 -0
  164. data/oats_tests/examples/testFileLocationUnitTests/post_yaml.rb +1 -0
  165. data/oats_tests/examples/testFileLocationUnitTests/t1.rb +4 -0
  166. data/oats_tests/examples/testFileLocationUnitTests/t1.yml +2 -0
  167. data/oats_tests/examples/testFileLocationUnitTests/t1_1.yml +3 -0
  168. data/oats_tests/examples/testFileLocationUnitTests/testDir/oats.yml +3 -0
  169. data/oats_tests/examples/testFileLocationUnitTests/testDir/t1.rb +2 -0
  170. data/oats_tests/examples/testFileLocationUnitTests/testDir/t1.yml +2 -0
  171. data/oats_tests/examples/testFileLocationUnitTests/testDir2/t1.rb +2 -0
  172. data/oats_tests/examples/testFileLocationUnitTests/testDir2/t1.yml +2 -0
  173. data/oats_tests/examples/testFileLocationUnitTests/unitTestList.yml +36 -0
  174. data/oats_tests/examples/testFileLocationUnitTests/yml_driver.rb +2 -0
  175. data/oats_tests/lib/business.rb +28 -0
  176. data/oats_tests/lib/sample_xl_lists.rb +37 -0
  177. data/test/common_test_unit_setup.rb +21 -0
  178. data/test/test_basic.rb +16 -0
  179. data/test/test_selenium.rb +16 -0
  180. data/test/test_xl_lists.rb +16 -0
  181. metadata +291 -0
data/oats_ini.yml ADDED
@@ -0,0 +1,258 @@
1
+ # OATS Initialization File
2
+ ---
3
+ # To keep maintenance to a minimum, uncomment only the parameters you need in
4
+ # your oats_user.yml or an environment.yml file. When you uncomment a parameter
5
+ # do not forget to uncomment all the parents of the parameters also in order to
6
+ # keep the YAML file valid.
7
+ # Parameters designated as:
8
+ # * R-U:rec are recommended for use in oats_user.yml
9
+ # * R-U:opt are for occasional use in oats_user.yml
10
+ # * C-L can also be over-ridden via command-line
11
+ # * E-V:recl are recommended for use in environment environment files.
12
+ # * none: are best to leave to system defaults unless required
13
+
14
+ # String values containing 'Oats.' and 'ENV[' are evaluated as Ruby
15
+ # expressions referring to the previously loaded YAML Oats.data and environment
16
+ # variables. If after an evaluation resulting value is 'previous_old_value', then
17
+ # previous value is restored.
18
+ # Examples of boolean expressions which can be used in tests:
19
+ # Oats.data['env']['type'] == 'qa'
20
+ # Oats.global['agent'] ? "oatsuserapi@gmail.com":'previous_oats_value'
21
+
22
+ # OATS recognizes the following key modifiers
23
+ # (define) # used by oats_user and environments, adds new keys w/o issuing error messages
24
+ # (default) # used by test.yml, defines default values
25
+ # Advertiser (define): Name
26
+ # Setting this at any level will prevent (define) errors, at least in all keys below
27
+ # and possibly in other branches of Oats.data. Reset it under other branches if needed.
28
+ # define_always: TRUE
29
+
30
+ # This section contains parameters controlling oats execution. All
31
+ # parameters in this section plus a few from other sections can be overridden
32
+ # from the commandline (For details, see 'oats.rb \--help'.)
33
+ # * If an input is a YAML file, it may include other test_files which are
34
+ # executed after merging in the YAML contents.
35
+ # * environments included in the any test YAML are applied to the tests listed in
36
+ # the YAML, multiplexing the test cases.
37
+
38
+ # YAML to overlay into the current YAML. Keys in the the included YAMLs are
39
+ # not verified against oats_ini.yml
40
+ # For performance and unambiguity, path should be given relative to the folder
41
+ # of the test for test yamls, or relative to test_dir.
42
+ # Otherwise it will be searched in test_dir.
43
+ # Over-rides used in user, environment, or list YAMLs are checked for consistency
44
+ # with this oats_ini.yml definitions (keys included files are not checked.)
45
+ # Any value specified in this file can be later reset to nil by setting it to NO.
46
+ # The oats_ini.yml will be supplemented by contents of <dir_tests>/aut_ini.yml, if present
47
+ include_yaml:
48
+ # Use if the included YAML entries should override the current YAML entries
49
+ include_yaml_later:
50
+
51
+ execution:
52
+
53
+ # A YAML array containing test names to be executed by OATS. Each name must
54
+ # either be a test directory, or another YAML file, file.rb, or file.txt.
55
+ # If the input is a YAML file it is treated as a test suite unless yml_handler is
56
+ # set.
57
+ # Test_files in test suite yml files will be executed after merging in their
58
+ # YAML contents.
59
+ # In test file is file.rb, it will be executed in a test directory named 'file'
60
+ # If it is file.txt, each row of the file will be included as an element of the
61
+ # test_files array, after stripping comments starting with '#'.
62
+ # Before each test is processed, testName.yml or oats.yml will be read if found
63
+ # at the same level as the test executable path.
64
+ # Any other file.extension will be handled by <extension>_handler if set as below
65
+ yml_handler: # yml_processor.rb
66
+ test_files: [ examples/occTest/occTestlist.yml ] # C-L,R-U:rec
67
+
68
+
69
+ # A YAML array listing YAML files describing environments to be executed for
70
+ # each test. This is a way of multiplexing the test cases. OATS will repeat
71
+ # the execution of each test files after merging in the oats_data from the
72
+ # each YAML. Typical use of environments is to repeat the tests for different
73
+ # environments or different parameters. You may also want to make a copy of
74
+ # the environment YAML file in dir_tests/environments into your own
75
+ # dir_environments directory and customize the E-V:rec entries for yourself.
76
+ environments: [ qa.yml ] # C-L,R-U:rec
77
+
78
+ # User's directory containing overrides for system supplied environments.
79
+ dir_environments: ENV['HOME'] + '/environments' # R-U:opt
80
+
81
+ # Execution of a test is skipped if this evaluates to true.
82
+ no_run: # C-L,R-U:opt
83
+
84
+ # List of component hosts in the env from which to pick build version and display in OCC
85
+ build_versions: (Oats.global and Oats.global['agent']) ? Array.new(1,'web'):Array.new # Avoid wasting time for dev
86
+
87
+ # Controls the amount of logs output to the log files.
88
+ log_level: DEBUG # INFO, WARN, ERROR, FATAL # R-U:opt
89
+
90
+ # Root directory for the output results
91
+ dir_results: ENV['HOME'] + '/results' # C-L,R-U:opt
92
+
93
+ # Set this to yes or the IP of the browser host to tail the application error
94
+ # logs. Typcially used from commandline.
95
+ tail_logs_ip: # {10.10.20.51 | yes} # C-L:opt
96
+
97
+ # Used to switch the root directory to search for test files. The system
98
+ # searches dir_tests for test_files or environments if they are specified as
99
+ # relative paths. If a file pattern is given, the first match is used, with
100
+ # names matching directories are given priority over matches for YAML
101
+ # files.
102
+ dir_tests: ENV['OATS_TESTS'] || ENV['OATS_HOME'] + '/oats_tests'
103
+
104
+ # Set to copy the test contents to the dir_results before executing the test
105
+ run_in_dir_results: YES
106
+
107
+ # Set to see full stacktrace on ruby tests.
108
+ full_stacktrace:
109
+
110
+ # Ruby Class methods, file names, or paths in test_dir to be executed before and after a oats test.
111
+ oload_pre: # String or array of rb file names or paths to be executed
112
+ oload_post: # in the given order
113
+
114
+ # Ruby file names or paths in test_dir to be executed before and after a test yaml.
115
+ handler_pre_test_list: # path to handler.rb be executed
116
+ handler_post_test_list: # path to handler.rb be executed
117
+
118
+ # When the test has an error and this is set, no further rtest_* files are executed
119
+ quit_on_error:
120
+
121
+ # Skip the current test if there was a previous test and that it did not pass
122
+ skip_unless_previous_test_is_ok:
123
+
124
+ # To use during initial test development. YES: Skips the comparison of ok folder contents.
125
+ # UPDATE Synchs the contents of ok with out by adding or removing files to/from ok
126
+ ok_verify: # UPDATE | YES
127
+ # out directory existence is not checked unless this is set
128
+ out_verify:
129
+
130
+ # Default time for Oats.wait_until
131
+ wait_until_timeout: 90
132
+
133
+
134
+ # Parameters used in agent mode to communicate with OCC
135
+ occ:
136
+ # For agent to contact occ. Also what occ host sees itself as, via ENV['HOSTNAME'].downcase
137
+ server_host: ENV['OATS_OCC_HOST'] || ENV['HOSTNAME'].downcase
138
+ # OCC server port for OCC to request agent to contact
139
+ server_port: ENV['OATS_OCC_PORT'] || 3000
140
+ # Agent-server host name to relay to OCC, defaults to downcased hostname if nil
141
+ agent_host: ENV['HOSTNAME'].downcase
142
+ # Oats agent/server name to display in OCC. Defaults to agent_host
143
+ agent_nickname: # mymach1
144
+ # Oats agent/server to listen and OCC to contact
145
+ agent_port: 3010
146
+ # Timeout for OCC to respond, may take a while if OCC is listing all jobs
147
+ timeout_waiting_for_occ: 15
148
+
149
+
150
+ ##############################
151
+ # Controls the behavior of selenium related execution.
152
+ selenium:
153
+
154
+ # Decides which browser to use for IDE tests. Only this selenium parameter can
155
+ # be overridden from the commandline.
156
+ browser_type: firefox # C-L,R-U:opt
157
+
158
+ #Set this to download collection on chrome and IE and make sure to empty the default download directory.
159
+ default_downloads:
160
+ # Hosts for each browser type to use webdriver in remote mode.
161
+ remote_webdriver:
162
+ oats_dir: c:/users/qatest/oats
163
+ os: Windows_NT
164
+ ie: 10.0.11.32:4445 # qa-testing # Remove the value from this entry in order to run ie locally
165
+ chrome: # Put in remote driver host to run remotely
166
+ firefox: #10.0.11.32:4445
167
+
168
+ # Additional options to pass webdriver
169
+ options:
170
+ chrome:
171
+ switches: [--start-maximized]
172
+
173
+ # For webdriver, this is a non-default profile name is defined via -profilemanager
174
+ # A non-default executable firefox_path is specified by defining an environment
175
+ # variable matching this profile name. Will use default if this profile is undefined.
176
+ firefox_profile: selenium
177
+
178
+ # Sets the firefox profile properties indicated.
179
+ firefox_profile_set:
180
+ native_events: YES
181
+ # assume_untrusted_certificate_issuer: NO
182
+
183
+ # Conditionally pause and do not close browser at the of oats test involving
184
+ # selenium. OATS execution will continue after the user presses ENTER (for rb)
185
+ # or when the user closes the IDE results page.
186
+ # Default (NIL) implies 0 if the first test is a list, 1 otherwise
187
+ pause_on_exit: # -N: always, 0:never, 1:only on failure, N: seconds to pause
188
+
189
+ # Set to YES to skip the selenium screen capture
190
+ skip_capture:
191
+
192
+ # Timeout in seconds for capture requests.
193
+ capture_timeout: 10
194
+
195
+ # Set to close the browser session only if an error is raised during execution (not verify)
196
+ keep_alive: YES
197
+
198
+ ide:
199
+ # Use this port for IDE executions.
200
+ port: 4445
201
+ # Minutes to limi tthe full IDE suite execution.
202
+ # For individual action timeout, need to use "setTimeout millisecs" in test html
203
+ suite_timeout: 5 # 30 # Default
204
+ # Applicable only to IDE tests, setting this will skip the GUI execution and
205
+ # will only regenerate the test HTML files based on the environments so that
206
+ # they can be manually debugged or executed via the IDE.
207
+ generate: # C-L,R-U:opt
208
+
209
+ # Set NO to remove *.gen* files after a test passes.
210
+ keep_generated_files: YES
211
+
212
+ # Browser to use to show IDE test results. Default inherits from firefox_executable
213
+ result_browser: explorer # iexplore
214
+
215
+ show_result:
216
+
217
+ #####################################################################
218
+ ##### PARAMETERS BELOW TYPICALLY VARIES ACROSS ENVIRONMENTS #####
219
+ #####################################################################
220
+
221
+
222
+ # Application environment information
223
+ env:
224
+ type: qa # production
225
+ web:
226
+ host: # Fully qualified host name for web host
227
+ logs: # ["/var/log/messages", "/var/log/httpd/error_log"] # E-V:opt Array of logs to search for errors
228
+ sql:
229
+ # Choose the DB to connect. When nil, Omysql will raise OatsMysqlNoConnect
230
+ # causing such tests to be classified as SKIPPED unless the callser rescues it.
231
+ connect: main
232
+ main:
233
+ host:
234
+ user:
235
+ password:
236
+ database:
237
+
238
+ # Oats::Keywords.process Processes values based on the
239
+ # <class>:
240
+ # <list>:
241
+ # keywords:
242
+ # <oats_data>
243
+ #<class>:
244
+ keywords:
245
+ class: # Class file containing methods for each keyword
246
+ list: # Optional list name under which to find the keywords and data in Oats.data
247
+
248
+
249
+ ###############
250
+
251
+ ## Used to ssh to servers via PuTTy/plink and execute scripts or access log files
252
+ ## See Oats.rssh documentation for more details
253
+ #ssh:
254
+ # # Putty connection data Login username
255
+ # username: loguser
256
+ # # Name for env host or putty session on which to execute cmd_file
257
+ # # Plink must be setup to auto-login as root_sudo_username into the host
258
+ # root_sudo_username: # LDAP username to sudo if username is 'root'.
@@ -0,0 +1,18 @@
1
+ #source "http://rubygems.org"
2
+
3
+ # OATS Framework
4
+ gem 'oats' unless defined?(OATS_GEM_IS_ALREADY_INCLUDED)
5
+ # OATS_GEM_IS_ALREADY_INCLUDED
6
+
7
+ ## List GEMs needed by the AUT goes here
8
+ ##
9
+ ## To run XL based tests
10
+ gem 'spreadsheet'
11
+ #require 'sample_xl_lists' # Include XL based classes to be used.
12
+ #
13
+ gem 'selenium-webdriver' # To run WebDriver tests
14
+ gem 'json' # To run WebDriver tests w/o ok_json to improve performance
15
+ #
16
+ #gem 'nokogiri' # http://nokogiri.org/tutorials
17
+ #gem 'rest-client'
18
+ #gem 'watir-webdriver'
@@ -0,0 +1,30 @@
1
+ # For full documentation on OATS, please refer to https://github.com/latasoy/oats
2
+
3
+ keywords:
4
+ class: # Class file containing methods for each keyword
5
+ list: # List name under which to find the keywords and data in Oats.data
6
+
7
+ SampleXlLists:
8
+ SampleXlList-1:
9
+ data1: init-value1
10
+ data2: init-value2
11
+ data3: init-value3
12
+
13
+ env:
14
+ type: qa # production
15
+ web:
16
+ host:
17
+
18
+ sql:
19
+ # Choose the DB to connect. When nil, Oats.mysql will raise OatsMysqlNoConnect
20
+ # causing such tests to be classified as SKIPPED unless the callser rescues it.
21
+ connect: main
22
+ main:
23
+ host: mysql.your-network.com
24
+ user: qauser
25
+ password: dbPasswd
26
+ database: dbName
27
+
28
+ imap:
29
+ username: testid@gmail.com
30
+ password: testpasswd
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ unless defined? Gem
3
+ require 'rubygems'
4
+ gem 'oats'
5
+ end
6
+ require 'oats'
7
+ ENV['OATS_TESTS'] ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
8
+ Oats.run
@@ -0,0 +1,4 @@
1
+ env:
2
+ type: qa # production
3
+ web:
4
+ host: https://google.com
@@ -0,0 +1,4 @@
1
+ include_yaml: environments/qa.yml
2
+
3
+ selenium:
4
+ browser_type: chrome
@@ -0,0 +1,8 @@
1
+ # Tests to demo and verify various OATS framework features.
2
+ ---
3
+ execution:
4
+ test_files:
5
+
6
+ - examples/core/expectedException # Exception usage in OATS
7
+ - examples/core/unexpectedException # Exception usage in OATS
8
+ - examples/core/ok_verify # Demonstrate automatic file output comparison features
@@ -0,0 +1,39 @@
1
+ # Raising any exceptions will quit processing the test BY designating it as FAIL.
2
+ # * OatsTestError: Use for any generic test execution exception
3
+ # * OatsVerifyError: Use for to quit processing during output verification. See
4
+ # * OatsTestExit: Use instead of exit to quit processing without error.
5
+ # DO NOT USE 'exit'.
6
+ # * Use Oats.error to register failures during execution.
7
+ # * See example/code for how to use Oats.error
8
+
9
+ #
10
+ # Demonstrate retrieving data stored by aoother test, eg. code
11
+ #
12
+ t = Oats.global['examples/code:start_time']
13
+ if t # ie not nil because previously stored
14
+ Oats.info "Test [code] was started at #{t} and #{t.usec} microseconds."
15
+ else
16
+ Oats.info "Test [code] was not previously run in this OATS session."
17
+ end
18
+
19
+ begin # Exceptions raised within this block will
20
+ # be caught by the following rescue clauses
21
+ Oats.info "Try to create ./nonexistent/subdirectory"
22
+ FileUtils.mkdir "./nonexistent/subdirectory"
23
+
24
+ rescue Errno::ENOENT # Handled here, no problem
25
+ Oats.warn "Rescued exception's message: " + $!
26
+ Oats.warn "This was expected. Here is the full stack trace:"
27
+ Oats.warn $! # Print stack strace only if warranted
28
+
29
+ rescue # All other types of exceptions
30
+ Oats.warn "Got it: " + $!
31
+ Oats.warn "If you don't know how to handle it fully, push it up the chain."
32
+ Oats.info "OATS will catch it automatically and mark the test as failed."
33
+ raise $!
34
+
35
+ ensure # If you need something that always gets executed, even after exceptions
36
+ Oats.info "Do some test cleanup right here."
37
+ end
38
+
39
+ Oats.info "We are done with the test."
@@ -0,0 +1,2 @@
1
+
2
+ Oats.filter Oats.out_file('myfile.txt', 'out_string')
@@ -0,0 +1 @@
1
+ check string
@@ -0,0 +1 @@
1
+ check string2
@@ -0,0 +1,2 @@
1
+ INFO 10-01-20 15:57:32 Processing rb file: C:/qa/oats/tests/examples/ok_verify2.rb
2
+ ERROR 10-01-20 15:57:32 Missing ok/out directory, but test.out directory exists: c:/qa/results/examples/ok_verify2/out
@@ -0,0 +1,30 @@
1
+ # Raising any exceptions will quit processing the test BY designating it as FAIL.
2
+ # * OatsTestError: Use for any generic test execution exception
3
+ # * OatsVerifyError: Use for to quit processing during output verification. See
4
+ # example/verifyException
5
+ # DO NOT USE 'exit'.
6
+ # * Use Oats.error to register failures during execution.
7
+ # * See example/basic for how to use Oats.error
8
+
9
+ begin # Exceptions raised within this block will
10
+ # be caught by the following rescue clauses
11
+ Oats.info "If something unexpected happens here, like division by zero,"
12
+ Oats.info "the second catch-all rescue will get it."
13
+ 1/0
14
+
15
+ rescue Errno::ENOENT # Handled here, no problem
16
+ Oats.warn "Rescued exception's message: " + $!
17
+ Oats.warn "This was expected. Here is the full stack trace:"
18
+ Oats.warn $! # Print stack strace only if warranted
19
+
20
+ rescue # All other types of exceptions
21
+ Oats.warn "Got it: " + $!
22
+ Oats.warn "If you don't know how to handle it fully, push it up the chain."
23
+ Oats.info "OATS will catch it automatically and mark the test as failed."
24
+ raise $!
25
+
26
+ ensure # If you need something that always gets executed, even after exceptions
27
+ Oats.info "Do some test cleanup right here."
28
+ end
29
+
30
+ Oats.info "Due to raised exception above, this will not get executed."
@@ -0,0 +1,13 @@
1
+
2
+ # Tests to demo and verify various OATS framework features.
3
+ ---
4
+ execution:
5
+ test_files:
6
+
7
+ - examples/occTest/occTestlist.yml # Basic execution
8
+
9
+ - examples/core/coreExamples.yml
10
+
11
+ - examples/gui/guiExamples.yml
12
+
13
+ - examples/gui/keywordExamples.yml
@@ -0,0 +1,7 @@
1
+ # Tests to demo and verify various OATS framework features.
2
+ ---
3
+ execution:
4
+ test_files:
5
+
6
+ - examples/webdriverGoogle.rb # Selenium webdriver code using oats apis
7
+ - examples/seleniumGoogle.rb # native webdriver code
@@ -0,0 +1,10 @@
1
+ require 'selenium-webdriver'
2
+ selenium = Oats.browser('http://google.com')
3
+ #loc = selenium.type("id=gbqfq", 'xxxx')
4
+ #selenium.click("id=gbqf")
5
+ el = selenium.find_element(:id, "gbqfq")
6
+ el.clear
7
+ el.send_keys "xxxx"
8
+ selenium.find_element(:id, "gbqfb").click
9
+
10
+
@@ -0,0 +1,9 @@
1
+ # Selenium 2Original webdriver, using original webdriver api.
2
+
3
+ Oats.data("selenium")["webdriver"] = true
4
+ Oats.browser "http://google.com"
5
+ Oats.assert_equal 'Google', selenium.title
6
+ element = selenium.find_element(:name, 'q')
7
+ element.send_keys "Hello selenium!"
8
+
9
+ selenium.quit
@@ -0,0 +1 @@
1
+ Oats::Keywords.process
@@ -0,0 +1,8 @@
1
+ # Tests to demo and verify various OATS framework features.
2
+ ---
3
+ execution:
4
+ test_files:
5
+
6
+ - examples/keywords/keywordsTestlist.yml # Using Oats data and keywords
7
+
8
+ - examples/keywords/SampleXlLists.xls # Using XL data and keywords
@@ -0,0 +1,5 @@
1
+
2
+ SampleXlLists:
3
+ SampleXlList-1:
4
+ keywords: action1
5
+ data1: test-tc1-value1
@@ -0,0 +1,16 @@
1
+ ---
2
+ execution:
3
+ yml_handler: xl/keywordsDriver.rb
4
+
5
+ test_files:
6
+ - xl/keywordsTC1.yml
7
+
8
+ keywords:
9
+ class: SampleXlLists # Class file containing methods for each keyword
10
+ list: SampleXlList-1 # List name under which to find the keywords and data in Oats.data
11
+
12
+
13
+ SampleXlLists:
14
+ SampleXlList-1:
15
+ data1: list-value1
16
+ data2: list-value2
@@ -0,0 +1,4 @@
1
+ Oats.info "Running"
2
+ 3.times do |i|
3
+ Oats.add_test "method_test", "testid_#{i}", "parameter_#{i}"
4
+ end
@@ -0,0 +1,34 @@
1
+ #messages = imap.search(["BEFORE", "1-Apr-2003", "SINCE", "1-Apr-2003"])
2
+ #messages = imap.search(["TO", "axx@oats.org"])
3
+ #messages = imap.search(["BODY", "hello"])
4
+ #messages = imap.search(["RECENT"])
5
+ #messages = imap.search(["SUBJECT",subj, "SINCE", "5-Jan-2010"])
6
+ #message_id = messages.last
7
+ #envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
8
+ #puts "#{envelope.from[0].name}: \t#{envelope.date} \t#{envelope.subject}"
9
+
10
+ # Email with string on subject
11
+ def imap_fetch_gmail(subject_string, dont_wait=nil)
12
+ Oats.assert((subject_string and subject_string != ''), 'Imap can not search for empty string')
13
+ imap_data = Oats.data['imap']
14
+ Oats.assert imap_data['username'] && imap_data['password'] ,
15
+ "Missing Oats.data imap.username or imap.password"
16
+ msg = "emails with subject containing string: " + subject_string
17
+ Oats.info "Waiting for #{msg}"
18
+ body = nil
19
+ Oats.wait_until(error_msg = "Can not find #{msg}", 300) do
20
+ imap = Net::IMAP.new('imap.gmail.com', 993, true)
21
+ imap.login(imap_data['username'], imap_data['password'] )
22
+ imap.select('INBOX')
23
+ found = imap.uid_search(["SUBJECT", subject_string])
24
+ if found.empty?
25
+ Oats.assert !dont_wait, error_msg
26
+ imap.logout
27
+ sleep 5
28
+ else
29
+ Oats.assert found.size == 1, "Too many #{msg}"
30
+ body = imap.uid_fetch(found, "BODY[TEXT]").first.attr["BODY[TEXT]"]
31
+ end
32
+ body
33
+ end
34
+ end
@@ -0,0 +1,6 @@
1
+ -- Campaign:
2
+ update BusinessUser set bu_password=password('TestCampaignPassword') where bu_email='TestCampaignUser' order by bu_email ;
3
+
4
+
5
+ -- Admin
6
+ update BusinessUser set bu_password=password('TestAdminPassword') where bu_email='TestAdminUser' order by bu_email ;
@@ -0,0 +1,11 @@
1
+ # Sets passwords of the user for the environments defined in the environments
2
+ ---
3
+ Campaign:
4
+ SignIn:
5
+ password: TestCampaignPassword
6
+ user: TestCampaignUser
7
+
8
+ Admin:
9
+ SignIn:
10
+ password: TestAdminPassword
11
+ user: TestAdminUser
@@ -0,0 +1,13 @@
1
+ Oats.info "Running #{Oats.test.name}"
2
+ file = "#{ENV['HOME']}/#{Oats.test.name}"
3
+ total = Oats.data['count'] || 1
4
+ interval = Oats.data['interval'] || 1
5
+ total.times do |i|
6
+ Oats.info "Count is #{i}, no file #{file}"
7
+ if File.exists? file
8
+ Oats.info "Found file #{file}"
9
+ File.mv file, file+'.x'
10
+ break
11
+ end
12
+ sleep interval
13
+ end
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1 @@
1
+ Oats.oload 'occTest.rb'
@@ -0,0 +1,9 @@
1
+ execution:
2
+ # yml_handler: occTest.rb
3
+ test_files:
4
+ # - variation1.yml
5
+ # - variation2.yml
6
+ - occTest_1.rb
7
+ - occTest_2.rb
8
+ - occTest_3.rb
9
+ - occTest_4.rb