I'm trying to set up some functional/acceptance/integration testing using Cucumber for my PHP project. I'm trying to understand the best approach to implementing these types of tests.
I understand that Selenium can test javascript, but Selenium is slow and I don't always need to test javascript. I'm looking for a "headless browser" equivalent for PHP.
Would either of these be classified as "headless browsers?"
What have you done to implement integration testing of your Zend Framework project?
If you set up Cucumber to use Webrat, you can set up Webrat to use Mechanize by default. Mechanize is essentially a headless browser. This is what my env.rb file looks like:
# RSpec
require 'rspec/expectations'
# Webrat
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
end
Also, according to this article, you can set up Cucumber to use Capybara and configure it to use Celerity (a headless browser with javascript support). It also includes instructions on how to configure Capybara to use Selenium RC (which I thought was not possible). I have not attempted this approach yet, so I don't know how well it works.
Why not use behat ( http://behat.org/ ) ?
It should have all the requirements you listed above, and it's written in php.
It has a SahiDrvier to handle "in-browser" testing, and a Simple php browser too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With