Skip to content
Browse files

Finally fixed an issue with test:acceptance that prevented getting re…

…al results. How did that get there in the first place?

git-svn-id: https://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails@96 9274398c-e119-0410-8437-aa71ef7847aa
  • Loading branch information...
1 parent 5214d93 commit a2252e707f6965c5baa3d1914daa05d6e09e3347 eric@8thlight.com committed
Showing with 35 additions and 20 deletions.
  1. +2 −2 lib/controllers/selenium_controller.rb
  2. +8 −8 log/default.yml
  3. +25 −10 test/selenium_controller_test.rb
View
4 lib/controllers/selenium_controller.rb
@@ -55,8 +55,8 @@ def record
dir = record_table
@result = {'resultDir' => dir}
- ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime'].each_with_index do |item, index|
- @result[index] = params[index]
+ ['result', 'numTestFailures', 'numTestPasses', 'numCommandFailures', 'numCommandPasses', 'numCommandErrors', 'totalTime'].each do |item|
+ @result[item] = params[item]
end
File.open(log_path(params[:logFile] || 'default.yml'), 'w') {|f| YAML.dump(@result, f)}
View
16 log/default.yml
@@ -1,9 +1,9 @@
---
-5:
-0:
-6:
-1:
-2:
-3:
-4:
-resultDir: ./test/../test_result/default
+result: Failed
+numTestPasses: "1079"
+numTestFailures: "906"
+numCommandFailures: "1027"
+numCommandPasses: "3"
+numCommandErrors: "57"
+resultDir:
+totalTime: A long time
View
35 test/selenium_controller_test.rb
@@ -10,6 +10,15 @@ def setup
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@result_dir = File.join(File.dirname(__FILE__), "..", "test_result")
+
+ @suite = <<EOS
+<script>
+</script>
+<table>
+ <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/foo.sel">Foo</a></td></tr>
+ <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/bar.sel">Bar</a></td></tr>
+</table>
+EOS
end
def teardown
@@ -18,16 +27,8 @@ def teardown
def test_record_with_result
@controller.config.configs["result_dir"] = @result_dir
-
- suite = <<EOS
-<script>
-</script>
-<table>
- <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/foo.sel">Foo</a></td></tr>
- <tr><td bgcolor="#ccffcc"><a href="/selenium/tests/bar.sel">Bar</a></td></tr>
-</table>
-EOS
- post :record, :suite => suite, "testTable.1" => "<table></table>", "testTable.2" => "<table></table>"
+
+ post :record, :suite => @suite, "testTable.1" => "<table></table>", "testTable.2" => "<table></table>"
cur_result_dir = File.join(@result_dir, "default")
assert File.directory?(cur_result_dir)
@@ -48,4 +49,18 @@ def test_record_with_result
EOS
assert_equal expected, File.read("#{cur_result_dir}/suite.html")
end
+
+ def test_result_hash
+ post :record, :suite => @suite, "testTable.1" => "<table></table>", "testTable.2" => "<table></table>",
+ :result => 'Failed', :numTestFailures => "906", :numTestPasses => "1079", :numCommandFailures => '1027',
+ :numCommandErrors => '57', :numCommandPasses => '3', :totalTime => "A long time"
+
+ assert_equal 'Failed', assigns['result']['result']
+ assert_equal '906', assigns['result']['numTestFailures']
+ assert_equal '1079', assigns['result']['numTestPasses']
+ assert_equal '1027', assigns['result']['numCommandFailures']
+ assert_equal '57', assigns['result']['numCommandErrors']
+ assert_equal '3', assigns['result']['numCommandPasses']
+ assert_equal 'A long time', assigns['result']['totalTime']
+ end
end

0 comments on commit a2252e7

Please sign in to comment.
Something went wrong with that request. Please try again.