Cucumber,webrat在MAMP上对php/drupal应用程序进行机械化测试,身份验证问题

Cucumber,webrat在MAMP上对php/drupal应用程序进行机械化测试,身份验证问题,php,cucumber,mechanize,mamp,webrat,Php,Cucumber,Mechanize,Mamp,Webrat,我让cucumber通过以下测试来测试我的drupal应用程序: Given /^I am authenticated as a "([^"]*)" user$/ do |role| visit('/user') fill_in "name", :with => "user_#{role.downcase}" fill_in "pass", :with => "password" click_button visit('/') #gets around a 302

我让cucumber通过以下测试来测试我的drupal应用程序:

Given /^I am authenticated as a "([^"]*)" user$/ do |role|
  visit('/user')
  fill_in "name", :with => "user_#{role.downcase}"
  fill_in "pass", :with => "password"
  click_button
  visit('/') #gets around a 302 redirect issue
  response_body.should contain("Log out")
end
require 'rspec/expectations'
require 'webrat'
require 'test/unit/assertions'

World(Test::Unit::Assertions)

Webrat.configure do |config|
  config.mode = :mechanize
end

World do
  session = Webrat::Session.new
  session.extend(Webrat::Methods)
  session.extend(Webrat::Matchers)
  session.visit('http://localhost')
  session
end
我的env.rb是这样的:

Given /^I am authenticated as a "([^"]*)" user$/ do |role|
  visit('/user')
  fill_in "name", :with => "user_#{role.downcase}"
  fill_in "pass", :with => "password"
  click_button
  visit('/') #gets around a 302 redirect issue
  response_body.should contain("Log out")
end
require 'rspec/expectations'
require 'webrat'
require 'test/unit/assertions'

World(Test::Unit::Assertions)

Webrat.configure do |config|
  config.mode = :mechanize
end

World do
  session = Webrat::Session.new
  session.extend(Webrat::Methods)
  session.extend(Webrat::Matchers)
  session.visit('http://localhost')
  session
end
当MAMP上的虚拟主机是默认的本地主机时,这一切都很顺利。但是,当我使用相同的文档创建另一个虚拟主机(并更新session.visit以使用新的根目录)时,此测试失败。会议似乎失败了

有人知道如何调试这个吗?我查看了html输出,它将内容显示为未经验证的用户,这就是我认为会话正在重置的原因

编辑

我检查了虚拟主机,它们完全相同。测试失败的那个往往要慢一个数量级。

我最终搬到了水豚岛。有一些版本的mechanize在发布表单数据等方面存在一些错误。Capybara的效果要好得多