我是 Ruby 新手,目前正在开发一个 JAVA 项目,该项目的行为测试用例是用ruby(CUCUMBER BDD)
.TeamCity
"Watir::Exception::NoMatchingWindowFoundException: Unable to locate window,"
或者
"Spec::Expectations::ExpectationNotMetError:"
错误。没有对这些测试用例进行任何更改。关于我应该在哪里查看的任何建议?
这是我的 env.rb 文件。我需要在这里更改任何内容吗?
require 'watir'
require 'open-uri'
require 'spec'
require 'win32ole'
require 'rake'
require 'cucumber/rake/task'
require 'net/http'
require 'uri'
require 'mysql'
require 'active_record'
require 'features/db/mysqldb'
require 'features/db/order'
require 'features/db/listener_state'
def clear_all_mock_requests
open 'http://xxxxxx:8080/httpmockserver/soapResponse!clearAllRequests.action'
end
Mysqldb.connect("xxx", "xxx", "xx", "xxx", "xxxxx")
clear_all_mock_requests()
Watir::Browser.default = ENV['browser'] == 'firefox' ? 'firefox' : 'ie'
#Watir::Browser.default = 'firefox'
BROWSER = Watir::Browser.new
WIN32OLE.class_eval do ||
def visible?;
return false if self.style.invoke('display').downcase == 'none';
return true;
end
def type
{:text_field=>'text', :radio=>'radio', :select_list => 'select-one', :checkbox => 'checkbox'}.each do |method, name|
return name if BROWSER.method(method).call(:name, self.name).exist?
end
return nil
end
def exist?
return true
end
end
NilClass.class_eval do ||
def exist?
return false
end
end
at_exit do
BROWSER.close
end