qa_robusta 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/.autotest +23 -0
  2. data/.gemtest +0 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +101 -0
  5. data/README.txt +48 -0
  6. data/Rakefile +18 -0
  7. data/bin/qa_robusta +14 -0
  8. data/common/Rakefile +95 -0
  9. data/common/conf/monkey_patch.yaml +8 -0
  10. data/common/conf/monkey_patch.yaml.ex +10 -0
  11. data/common/lib/array.rb +9 -0
  12. data/common/lib/cache.rb +12 -0
  13. data/common/lib/constants.rb +35 -0
  14. data/common/lib/error_defns.rb +13 -0
  15. data/common/lib/format_html_tmp.html +34 -0
  16. data/common/lib/formatters.rb +18 -0
  17. data/common/lib/gem_helpers.rb +29 -0
  18. data/common/lib/gems/.svn/entries +43 -0
  19. data/common/lib/gems/cache/.svn/entries +28 -0
  20. data/common/lib/gems/doc/.svn/entries +28 -0
  21. data/common/lib/gems/gems/.svn/entries +28 -0
  22. data/common/lib/gems/installed/.svn/entries +40 -0
  23. data/common/lib/gems/installed/cache/.svn/entries +28 -0
  24. data/common/lib/gems/installed/doc/.svn/entries +28 -0
  25. data/common/lib/gems/installed/gems/.svn/entries +28 -0
  26. data/common/lib/gems/installed/specifications/.svn/entries +28 -0
  27. data/common/lib/gems/specifications/.svn/entries +28 -0
  28. data/common/lib/gen_suite_doc.rb +52 -0
  29. data/common/lib/load_test_data.rb +18 -0
  30. data/common/lib/monkey_patch.rb +149 -0
  31. data/common/lib/navigate_mech.rb +79 -0
  32. data/common/lib/update_element.rb +12 -0
  33. data/common/monkey_patches/mechanize.rb +589 -0
  34. data/common/monkey_patches/table.rb +363 -0
  35. data/common/monkey_patches/telnet.rb +420 -0
  36. data/common/monkey_patches/unit.rb +538 -0
  37. data/demo/demo_site.rb +38 -0
  38. data/demo/public/javascripts/jquery-1.6.2.min.js +18 -0
  39. data/demo/views/index.erb +35 -0
  40. data/lib/monkey_patch.rb +26 -0
  41. data/lib/qa_robusta.rb +3 -0
  42. data/mechanize_interface/conf/app.yaml +10 -0
  43. data/mechanize_interface/lib/agent.rb +18 -0
  44. data/mechanize_interface/lib/app_require.rb +19 -0
  45. data/mechanize_interface/lib/get_page.rb +20 -0
  46. data/mechanize_interface/lib/login.rb +30 -0
  47. data/mechanize_interface/lib/navigation_paths.rb +12 -0
  48. data/mechanize_interface/test/lib/mech_unit_test.rb +19 -0
  49. data/qa_observer/conf/dev_users.yaml +9 -0
  50. data/qa_observer/conf/development.yaml +3 -0
  51. data/qa_observer/conf/qa_observer_links.yaml +10 -0
  52. data/qa_observer/generators/site/site_generator.rb +61 -0
  53. data/qa_observer/generators/site/templates/base_urls.yaml.erb +6 -0
  54. data/qa_observer/generators/site/templates/create_flow.rb.erb +54 -0
  55. data/qa_observer/generators/site/templates/elements.rb.erb +61 -0
  56. data/qa_observer/generators/site/templates/html_elements.yaml +22 -0
  57. data/qa_observer/generators/site/templates/navigate.rb +32 -0
  58. data/qa_observer/generators/site/templates/reports.rb +7 -0
  59. data/qa_observer/generators/site/templates/users_list.yaml +21 -0
  60. data/qa_observer/generators/test_case/templates/test_case.rb.erb +62 -0
  61. data/qa_observer/generators/test_case/test_case_generator.rb +29 -0
  62. data/qa_observer/lib/doc.rb +103 -0
  63. data/qa_observer/lib/env_details.rb +2 -0
  64. data/qa_observer/lib/error_defns.rb +3 -0
  65. data/qa_observer/lib/form_helpers.rb +52 -0
  66. data/qa_observer/lib/reports.rb +7 -0
  67. data/qa_observer/lib/requires.rb +23 -0
  68. data/qa_observer/lib/system_test.rb +146 -0
  69. data/qa_observer/lib/test_extention.rb +29 -0
  70. data/qa_observer/lib/update_element.rb +12 -0
  71. data/qa_observer/lib/watir.rb +42 -0
  72. data/qa_observer/script/destroy +14 -0
  73. data/qa_observer/script/generate +14 -0
  74. data/qa_observer/sites/demo/conf/base_urls.yaml +6 -0
  75. data/qa_observer/sites/demo/conf/html_elements.yaml +22 -0
  76. data/qa_observer/sites/demo/conf/remote_machine.yaml +12 -0
  77. data/qa_observer/sites/demo/conf/users_list.yaml +21 -0
  78. data/qa_observer/sites/demo/elements/demo_elements.rb +9 -0
  79. data/qa_observer/sites/demo/flows/demo_flows.rb +37 -0
  80. data/qa_observer/sites/demo/helpers/.placeholder +0 -0
  81. data/qa_observer/sites/demo/lib/navigate.rb +32 -0
  82. data/qa_observer/sites/demo/lib/reports.rb +7 -0
  83. data/qa_observer/sites/demo/results/.placeholder +0 -0
  84. data/qa_observer/sites/demo/results/images/.placeholder +0 -0
  85. data/qa_observer/sites/demo/test_cases/home_page.rb +106 -0
  86. data/qa_observer/suites/demo_lg_chrome/lg.yaml +11 -0
  87. data/qa_observer/suites/demo_md_chrome/md.yaml +11 -0
  88. data/qa_observer/suites/demo_sm_chrome/sm.yaml +11 -0
  89. data/qa_observer/suites/init.rb +41 -0
  90. data/qa_observer/test_runner.rb +125 -0
  91. data/remote_unix/helpers/constants.rb +8 -0
  92. data/remote_unix/helpers/out_xforms.rb +48 -0
  93. data/remote_unix/lib/common.rb +52 -0
  94. data/remote_unix/lib/error_defn.rb +4 -0
  95. data/remote_unix/lib/general_unix.rb +308 -0
  96. data/remote_unix/lib/network_commands.rb +41 -0
  97. data/remote_unix/lib/network_info.rb +98 -0
  98. data/remote_unix/lib/postfix_commands.rb +87 -0
  99. data/remote_unix/lib/postfix_info.rb +30 -0
  100. data/remote_unix/lib/requires.rb +25 -0
  101. data/remote_unix/lib/scp.rb +22 -0
  102. data/remote_unix/lib/ssh.rb +46 -0
  103. data/test/test_qa_robusta.rb +8 -0
  104. metadata +219 -0
@@ -0,0 +1,22 @@
1
+ ---
2
+ :some_page:
3
+ :page_element1:
4
+ :type: text_field
5
+ :what: "watir's what parameter"
6
+ :what: "watir's how parameter"
7
+ :page_element2:
8
+ :type: text_field
9
+ :what: "watir's what parameter"
10
+ :what: "watir's how parameter"
11
+ :another_page:
12
+ :page_element1:
13
+ :type: text_field
14
+ :what: "watir's what parameter"
15
+ :what: "watir's how parameter"
16
+ :page_element2:
17
+ :type: text_field
18
+ :what: "watir's what parameter"
19
+ :what: "watir's how parameter"
20
+
21
+
22
+
@@ -0,0 +1,32 @@
1
+ class Navigate
2
+ attr_reader :browser
3
+ def initialize(browser)
4
+ @browser = browser
5
+ end
6
+ def go(nav_path=[])
7
+ raise ArgumentError if nav_path.class != Array || nav_path.nitems < 1
8
+ nav_path.each { |item|
9
+ case item[:type]
10
+ when 'link'
11
+ exec = "@browser.link(#{item[:how]}, #{item[:what]}).#{item[:action]}"
12
+ eval exec
13
+ when 'text_field'
14
+ if item.has_key?(:value)
15
+ # escape ' in item[:value] as it's used for quoted string in the set
16
+ #item[:value].gsub(/'/, /\'/)
17
+ exec = "@browser.text_field(#{item[:how]}, #{item[:what]}).#{item[:action]}('#{item[:value]}')"
18
+ eval exec
19
+ end
20
+ when 'check_box'
21
+ # escape ' in item[:value] as it's used for quoted string in the set
22
+ #item[:value].gsub(/'/, /\'/)
23
+ exec = "@browser.checkbox(#{item[:how]}, #{item[:what]}).#{item[:action]}"
24
+ eval exec
25
+ when 'submit'
26
+ exec = "@browser.button(#{item[:how]}, #{item[:what]}).#{item[:action]}"
27
+ eval exec
28
+
29
+ end
30
+ }
31
+ end
32
+ end
@@ -0,0 +1,7 @@
1
+ require 'pdf/writer'
2
+
3
+ module BuildReport
4
+ def pdf(report)
5
+
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ :development:
2
+ :manager:
3
+ :user: 'user1'
4
+ :password: 'user1_password'
5
+ :employee:
6
+ :user: 'user2'
7
+ :password: 'user2_password'
8
+ :test:
9
+ :manager:
10
+ :user: 'user1'
11
+ :password: 'user1_password'
12
+ :employee:
13
+ :user: 'user2'
14
+ :password: 'user2_password'
15
+ :production:
16
+ :manager:
17
+ :user: 'user1'
18
+ :password: 'user1_password'
19
+ :employee:
20
+ :user: 'user2'
21
+ :password: 'user2_password'
@@ -0,0 +1,62 @@
1
+ base = File.expand_path(File.dirname(__FILE__))
2
+
3
+ # If the user is executing the test case stand alone
4
+ # without an agent we need to set a reference to
5
+ # for where to find the qa_observer_client as well as let
6
+ # the qa_observer_client know where the test case directory is
7
+ # URGENT: DO NOT MODIFY
8
+ unless $qa_observer_client
9
+ TEST_CASE_DIR = "#{base}"
10
+ $qa_observer_client = File.expand_path("#{base}/../../..")
11
+ end
12
+ # END OF DO NOT MODIFY
13
+
14
+ require "#{$qa_observer_client}/lib/system_test"
15
+ require "#{$qa_observer_client}/lib/env_details.rb"
16
+
17
+ class <%= class_name.camelize %> < SystemTest
18
+ def setup
19
+ # if the user hasn't provided the environment as an input
20
+ # parameter to the interpreter default to :test
21
+ $test_environment ||= :test
22
+ super
23
+
24
+ @<%= app_name %>_flows = <%= app_name.camelize %>Flows.new
25
+ end
26
+
27
+ def teardown
28
+ # NOTE: Place all items you wish to do at after each test method
29
+ # in the unless @skip section before the $browser.close. DO NOT
30
+ # remove this section as it's critical if the test class is executed
31
+ # by an agent.
32
+ unless @skip
33
+ begin
34
+ $browser.close
35
+ rescue => e
36
+ end
37
+ end
38
+
39
+ super
40
+ end
41
+
42
+ # TODO: add test methods
43
+ # don't forget to update the documentation associated with each test method,
44
+ # by placing an rdoc style comment in plain text. The documentation will be
45
+ # included in the report for each execution.
46
+
47
+ =begin rdoc
48
+ Test Purpose
49
+ After the user arrives on the home page verify the following links exists:
50
+ * some link 1
51
+ * some link 2
52
+ * some link 3
53
+ =end
54
+ def test_home_links
55
+ @<%= app_name %>_flows.home
56
+ # TODO add asserts for testing home page links
57
+ end
58
+
59
+ end
60
+
61
+
62
+
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'rubigen'
3
+
4
+ class TestCaseGenerator < RubiGen::Base
5
+ attr_reader :app_test_dir, :app_name, :qa_observer_client, :class_name
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ super
9
+ usage if args.size != 2
10
+ @app_test_dir = 'sites'
11
+ @qa_observer_client = File.expand_path("#{File.dirname(__FILE__)}/../../")
12
+ @app_name=args.shift
13
+ @class_name=args.shift
14
+ end
15
+
16
+ def manifest
17
+ record do |m|
18
+ m.template "test_case.rb.erb", "#{@app_test_dir}/#{@app_name}/test_cases/#{@class_name.downcase}.rb"
19
+ end
20
+ end
21
+
22
+ protected
23
+ def banner
24
+ <<-EOS
25
+ USAGE: #{$0} #{spec.name} app_name test_class_name
26
+ EOS
27
+ end
28
+
29
+ end
@@ -0,0 +1,103 @@
1
+ base = File.expand_path(File.dirname(__FILE__))
2
+ require "#{base}/../../common/lib/formatters"
3
+
4
+ module TCDoc
5
+ def self.build_html(report, save_to)
6
+ html = '<html><head><head><body>'
7
+ report.each_pair { |klass, r|
8
+ next unless r.kind_of?(Array)
9
+ r.each { |test|
10
+ html += "<h1>Report for #{klass}::#{test[:method]}</h1>"
11
+ html += "Num Assertions: #{test[:num_asserts]}<br>"
12
+ html += "Pass: #{test[:passed]}<br>"
13
+ html += "Failed: #{test[:failed]}<br><br>"
14
+ html += "#{test[:documentation]}<br><br>" if test[:documentation]
15
+ test[:images].each { |i|
16
+ image = "#{$test_case_dir}/../results/images/#{File.basename(i)}"
17
+ FileUtils.mv i, "#{$test_case_dir}/../results/images"
18
+ html += "<img src = '#{image}'><br><br>"
19
+ }
20
+ }
21
+ }
22
+ html += "</body></html>"
23
+ fd = File.open(save_to, 'w+')
24
+ fd.puts html
25
+ fd.close
26
+ end
27
+
28
+ def self.class_names_from_file(file_content)
29
+ class_names = file_content.grep(/class .* <.*SystemTest/)
30
+ class_names.each_with_index { |name, ct|
31
+ class_names[ct] = name.gsub!(/\n|class| |<|SystemTest/, '')
32
+ }
33
+ class_names
34
+ end
35
+
36
+ def self.method_names_from_file(file_content)
37
+ methods = []
38
+ file_content.grep(/def .*/).each { |method|
39
+ methods << method.grep(/def .*/).first.strip.gsub("def ", '')
40
+ }
41
+ methods
42
+ end
43
+
44
+ # return
45
+ # {:method_name => test documenation, :some_other_method => 'of course it's doc'}
46
+ def self.test_documentation(current_test_class, test_methods=[], format='txt')
47
+ execution_file=nil
48
+ methods_doc = {}
49
+ rdoc_dir = "#{$test_case_dir}/../tmp_doc".gsub(/c:/i, '')
50
+
51
+ # remove all previously generated rdoc
52
+ FileUtils.rm_rf rdoc_dir if File.directory?(rdoc_dir)
53
+
54
+ Dir.entries("#{$test_case_dir}/").each { |i|
55
+ next if File.directory?(i) || i !~ /.rb$/
56
+ content = File.read("#{$test_case_dir}/#{i}")
57
+ klass = class_names_from_file(content).first
58
+ if klass == current_test_class
59
+ execution_file = "#{$test_case_dir}/#{i}".gsub(/c:/i, '')
60
+ end
61
+ }
62
+
63
+ html=''
64
+ `#{$test_case_dir}/../../../../common/gems/installed/gems/rdoc-3.9.4/bin/rdoc -o #{rdoc_dir} #{execution_file}`
65
+ current_test_class.gsub!(/\r/, '')
66
+ rdoc_content = File.read("#{rdoc_dir}/#{current_test_class}.html")
67
+ doc=Hpricot(rdoc_content)
68
+
69
+ test_methods.each { |method|
70
+ html = doc.search("/html/body/div[2]/div[2]/div/div[@id='#{method}-method']/div[2]").inner_html
71
+
72
+ if format == 'txt'
73
+ gen_doc = Format::HTML.to_txt(html)
74
+ elsif format == 'html'
75
+ gen_doc = html
76
+ end
77
+
78
+ methods_doc[method] = gen_doc
79
+ }
80
+ FileUtils.rm_rf rdoc_dir if File.directory?(rdoc_dir)
81
+ methods_doc
82
+ end
83
+
84
+ def self.test_methods_from_class(class_content)
85
+ test_methods = []
86
+ class_content.grep(/def .*/).each { |meth| test_methods << meth.gsub(/ |def|\n/, '') }
87
+ test_methods - ['setup', 'teardown']
88
+ end
89
+
90
+ # assumes absolute path
91
+ # assumes all test classes < from SystemTest
92
+ def self.process_test_class_file(file)
93
+ text_doc = {}
94
+ content = File.readlines(file).to_s
95
+ test_methods = test_methods_from_class(content)
96
+ class_names = class_names_from_file(content)
97
+
98
+ raise ArgumentError, "Expecting one test class per file" unless class_names.nitems == 1
99
+
100
+ test_documentation(class_names.first, test_methods)
101
+ end
102
+
103
+ end
@@ -0,0 +1,2 @@
1
+ $environment = :test
2
+ $run_on_browser = 'chrome'
@@ -0,0 +1,3 @@
1
+ class ElementError < StandardError ; end
2
+ class LinuxIscsiActiveMachineMismatch < StandardError ; end
3
+ class WindowsIscsiActiveMachineMismatch < StandardError ; end
@@ -0,0 +1,52 @@
1
+ module FormHelpers
2
+ # params is an array of hashes for ordering. has structure is described
3
+ # in the usage msg
4
+ def self.auto_form(params=[], objs=[])
5
+ msg =<<EOF
6
+ params should contain keys for commands to execute. Where
7
+ each command key should begin with ':command_' and end with 'element_name'
8
+ which maps to a valid element definition. objs should be an array
9
+ of element objects. We will dynamically see which object the associated
10
+ command maps to.
11
+ EOF
12
+
13
+ raise ArgumentError, msg unless params.nitems > 0 && objs.nitems > 0
14
+
15
+ checkbox_state=[true, false]
16
+ params.each { |i|
17
+
18
+ objs.each {|o|
19
+ key = i.keys.first
20
+ value = i.values.first
21
+ next unless key.to_s =~ /^command_/
22
+
23
+ object_class=''
24
+ current=''
25
+ element = key.to_s.split('command_').last
26
+ if o.respond_to?(element)
27
+ eval "object_class = o.#{element}.class.to_s"
28
+ if object_class =~ /checkbox/i
29
+ raise ArgumentError unless checkbox_state.include?(value)
30
+ eval "current = o.#{element}.checked?"
31
+ o.send(element).set(value)
32
+ if object_class =~ /radio/i
33
+ if value
34
+ o.send(element).check
35
+ else
36
+ o.send(element).uncheck
37
+ end
38
+ end
39
+ elsif object_class =~ /selectlist/i
40
+ o.send(element).select(value)
41
+ elsif object_class =~ /textfield/i
42
+ # skip if key supplied but empty string or nil
43
+ o.send(element).set(value) #unless value != ''
44
+ elsif object_class =~ /button|link|image/i
45
+ eval "o.#{element}.#{value}"
46
+ end
47
+
48
+ end
49
+ }
50
+ }
51
+ end
52
+ end
@@ -0,0 +1,7 @@
1
+ require 'pdf/writer'
2
+
3
+ module BuildReport
4
+ def pdf(report)
5
+
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ module Requires
2
+ def self.run
3
+ begin
4
+ Dir.entries("#{TEST_CASE_DIR}/../elements").each { |i|
5
+ next if i =~ /^\./ || i !~ /_elements\.rb$/
6
+ puts "loading: #{i}"
7
+ require "#{TEST_CASE_DIR}/../elements/#{i}"
8
+ }
9
+ Dir.entries("#{TEST_CASE_DIR}/../flows").each { |i|
10
+ next if i =~ /^\./ || i !~ /.rb$/
11
+ puts "loading: #{i}"
12
+ require "#{TEST_CASE_DIR}/../flows/#{i}"
13
+ }
14
+ Dir.entries("#{TEST_CASE_DIR}/../helpers").each { |i|
15
+ next if i =~ /^\./ || i !~ /.rb$/
16
+ puts "loading: #{i}"
17
+ require "#{TEST_CASE_DIR}/../helpers/#{i}"
18
+ }
19
+ rescue NameError => e
20
+ raise e unless e.inspect =~ /TEST_CASE_DIR/
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,146 @@
1
+ base_dir = File.expand_path(File.dirname(__FILE__))
2
+ require 'yaml'
3
+ require 'pstore'
4
+ require "#{base_dir}/doc"
5
+ require "#{$qa_observer_client}/../common/lib/gem_helpers"
6
+ GemHelpers.update_gem_path "#{$qa_observer_client}/../common/gems/installed"
7
+ require 'platform_helpers'
8
+ require 'capture_io'
9
+ require 'wait_for'
10
+ require "#{$qa_observer_client}/lib/test_extention"
11
+ require "#{$qa_observer_client}/lib/requires"
12
+ require "#{$qa_observer_client}/../common/lib/formatters"
13
+ require "#{$qa_observer_client}/../common/lib/load_test_data"
14
+ require "#{$qa_observer_client}/../common/lib/constants"
15
+ require "#{$qa_observer_client}/lib/error_defns"
16
+ require "#{$qa_observer_client}/lib/form_helpers"
17
+ require "#{$qa_observer_client}/../remote_unix/lib/requires"
18
+
19
+ require 'watir-webdriver'
20
+ require "#{$qa_observer_client}/lib/watir"
21
+ $environment ||= :test
22
+ $test_case_dir = TEST_CASE_DIR
23
+ require 'minitest/unit'
24
+ require 'fileutils'
25
+ require 'faker'
26
+ require 'hpricot'
27
+ require 'RMagick'
28
+ require 'getoptions'
29
+ require 'timeout'
30
+ #require 'ruby-debug'
31
+
32
+
33
+ $report = {}
34
+ class SystemTest < MiniTest::Unit::TestCase
35
+ TestExtention.require_for_platform
36
+ def element(name, &blk)
37
+ define_me(name, &blk)
38
+ end
39
+
40
+ # if $junit_format
41
+ # MiniTest::Unit.autorun junit_xml=true
42
+ # else
43
+ MiniTest::Unit.autorun
44
+ # end
45
+
46
+ def setup
47
+ raise ArgumentError unless $run_on_browser
48
+
49
+ # FIXME: add self.name for ruby 1.9.2 under platform_helpers
50
+ if RUBY_VERSION =~ /^1\.9/
51
+ $current_test_method = self.__name__
52
+ else
53
+ $current_test_method = self.name
54
+ end
55
+ $current_test_class = self.class.name
56
+
57
+ if $job
58
+ unless $job[:methods].include?($current_test_method)
59
+ @skip = true
60
+ #skip_msg = "skipping '#{$current_test_method}' as it is only supported under windows but RUBY_PLATFORM is: #{RUBY_PLATFORM}"
61
+ skip ''
62
+ end
63
+ end
64
+
65
+ #@images = []
66
+ # inject required code into TestExtention
67
+ TestExtention.module_eval { @images = [] }
68
+
69
+ @capture_io = CaptureIO.new
70
+ @capture_io.start
71
+ super
72
+
73
+ LoadTestConfig.stuff("#{TEST_CASE_DIR}/../conf")
74
+
75
+ # there are some items that need to be required before items in the
76
+ # list below this if File.exists? block. Conflict of libs, etc..
77
+ if File.exists?("#{TEST_CASE_DIR}/../conf/preload.yaml")
78
+ YAML::load_file("#{TEST_CASE_DIR}/../conf/preload.yaml").each { |rb|
79
+ puts "PRELOADING: #{TEST_CASE_DIR}#{rb}"
80
+ require "#{TEST_CASE_DIR}#{rb}"
81
+ }
82
+ end
83
+
84
+ @skip = false
85
+ @tmp_image_path = "#{$qa_observer_client}/tmp/images"
86
+
87
+
88
+ # cleanup images from previous test case
89
+ #FileUtils.rm_rf @tmp_image_path if File.directory?(@tmp_image_path)
90
+ FileUtils.mkdir_p @tmp_image_path unless File.directory?(@tmp_image_path)
91
+
92
+ # check to see if the platform executing on matches desired results
93
+ if @windows_only && RUBY_PLATFORM !~ /win32/i
94
+ skip_msg = "skipping '#{$current_test_method}' as it is only supported under windows but RUBY_PLATFORM is: #{RUBY_PLATFORM}"
95
+ skip skip_msg
96
+ end
97
+
98
+ if $cfg.kind_of?(Hash)
99
+ $cfg = $cfg.merge(:base_url => $test_data[:base_urls][$environment][:root])
100
+ else
101
+ $cfg = $cfg = { :base_url => $test_data[:base_urls][$environment][:root] }
102
+ end
103
+
104
+ $sequence = 0
105
+ unless @no_browser
106
+ if Constants::SUPPORTED_BROWSERS.include?($run_on_browser)
107
+ $browser = Watir::Browser.new $run_on_browser.to_sym
108
+ else
109
+ raise ArgumentError, "Unsuppored browser provided: #{$run_on_browser}"
110
+ end
111
+ end
112
+ end
113
+
114
+ def teardown
115
+ unless @skip
116
+ io = @capture_io.stop
117
+ file_base = "#{$current_test_class}_#{Time.now}.html"
118
+ $html_file = "#{TEST_CASE_DIR}/../results/" + file_base.gsub(/[ :]/, '_')
119
+ #images = Images::Results.new(@tmp_image_path).result_images
120
+ begin
121
+ doc = TCDoc.test_documentation($current_test_class, [$current_test_method], 'html')
122
+ doc = doc[$current_test_method] + "\n\n#{io[:stdout].pp}"
123
+ if $report.has_key?($current_test_class)
124
+ $report[$current_test_class] << {:num_asserts => @_assertions, :passed => @passed, :images => TestExtention.get_images,
125
+ :documentation => doc, :method => $current_test_method}
126
+ else
127
+ $report.merge!($current_test_class => [{:num_asserts => @_assertions, :passed => @passed, :images => TestExtention.get_images,
128
+ :documentation => doc, :method => $current_test_method}])
129
+ end
130
+
131
+ rescue => e
132
+ puts "EEE: generating result doc\n#{e.inspect}"
133
+ ensure
134
+ #FileUtils.rm_rf @tmp_image_path
135
+ begin
136
+ $browser.close if $browser
137
+ rescue => e
138
+ end
139
+ end
140
+ end
141
+ end
142
+
143
+ MiniTest::Unit.after_tests { TCDoc.build_html($report, $html_file) }
144
+
145
+ end
146
+ Requires.run