2

I'm trying to set up Cucumber to test a PHP-based web app. The app has a lot of dynamic JavaScript-based functionality. From my Googling, it appears that this means I should go with Celerity/Culerity or Capybara for my web-browsing gem. However, I can't seem to find any good examples of how to test a non-Rails app with either of those systems. All of their documentation assumes I'm using a Rails or Rack app.

Long story short: Am I barking up the wrong tree? Are either of these practical to use without Rails? If so, can you point me to some resources and/or examples for how to do it?

abeger
  • 6,766
  • 7
  • 41
  • 58

2 Answers2

5

It's absolutely practical, we are using it to test a JS heavy, legacy .NET web app using Capybara on Windows. The best resource I can think of is The Cucumber Book.

Generally Capybara is easy to set up for a non-Rack app, you just have to configure the app_host to point at the URL of your deployed PHP site.

You also won't have access to the model classes inside your app, which is an advantage when dealing with Rails apps, so you can't easily inject a User into the database using the same models. We ended up creating ActiveRecord models just for manipulating and asserting against data for tests, which was an unfortunate bit of duplication. If your app exposes an API which can be used instead, this would probably be a better solution than that! It greatly depends on the specifics of how your app works and how you want to test it.

Jon M
  • 11,669
  • 3
  • 41
  • 47
0

I am testing a website built using Perl. I am using Cucumber with Watir-webdriver. There's some great tutorials on using it. The easiest one I found to follow was from Alister Scott on his Watirmelon Blog. Like Jon M said, The Cucumber Book is awesome. It walks you through everything, and is useful even if you're not using Rails. I am also using Rubymine, an IDE which supports Cucumber. It provides Syntax highlighting and even helps stub out code (mainly good to save some copy/pasting). Plus it integrates into my source control system, which is nice for seeing which files I've touched since my last commit without jumping out to look at the files with Tortoise.

FWIW, I'm developing on Win7.

Doug Noel
  • 684
  • 4
  • 19