我在单元框架内运行所有测试。我自己使用测试单元,但您也可以使用rspec。这也使您能够向代码中添加断言,然后由单元框架将其报告。如果一个测试失败或错误,则可以继续进行下一个测试。
我的rakefile的简化版本如下所示
require 'rake/testtask'#this will run all tests in directory with no dependencies Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList['FAL*.rb'] t.verbose = trueend#or you could run individual files like thistask :FAL001 do ruby "FAL001.rb"end
每个测试用例看起来像这样
require "test-unit"gem "test-unit"require "selenium-webdriver"class FAL001 < Test::Unit::TestCase def testFAL001 #methods that begin with test are automatically run #selenium pre goes here assert_true(1 == 1) end def test002 #another test goes here endend



