Using Cucumber to test non-Rails application

827 views
Skip to first unread message

ToddH

unread,
Oct 12, 2010, 12:47:14 AM10/12/10
to Cukes
I'm interested in using Cucumber and Capybara to test non-rails (and
non-rack based) web applications. However, I'm still not clear on how
to generate the project structure for testing an external web
application. Is there a generator somewhere that I'm overlooking or
should I be creating the project files and structure by hand?

Thanks!

Raveendran P

unread,
Oct 12, 2010, 3:18:31 AM10/12/10
to cu...@googlegroups.com
Hi,

We can use Watircraft framework to test nonRails application.

For more details about WatirCraft -- http://bit.ly/boLD2p

Thanks
http://raveendran.wordpress.com



--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.




--
Regards,
P.Raveendran
http://raveendran.wordpress.com

Matt Wynne

unread,
Oct 12, 2010, 6:47:42 AM10/12/10
to cu...@googlegroups.com
Hi Todd,

There isn't a generator I know of, but it's pretty simple to do by hand. In your project's root directory:

mkdir features
mkdir features/support
mkdir features/step_definitions

Then create a file features/support/env.rb which looks something like this:

require 'capybara'
require 'capybara/dsl'

Capybara.default_driver = :selenium
Capybara.app_host = 'http://hostname-of-your-test-server.com'

World(Capybara)

Then just start creating features and follow Cucumber's snippets to create your step definitions. You should find Capybara's DSL methods are available to you in the step definitions (that's what the #World method does).

Good luck.

cheers,
Matt

http://blog.mattwynne.net
+44(0)7974 430184

Boeboe

unread,
Oct 12, 2010, 6:25:41 PM10/12/10
to Cukes
Hi Todd,

We are also using Capybara/Cucumber in a none rails env. We used a
similar approach as Matt mentions. At some point we wanted to divert
from this expected directory structure, since we had several projects
sharing some common Capybara, other steps and some extra defined ruby
modules. You can add a cucumber.yml file into the folder you'd like to
use to start your features with cucumber (google for details).
Basically you extend your cucumber require-path by chaining them "-r /
env_folder -r /feature_folder -r /step_folder ..." in the yaml file.

BR,
Bart

Jonas Nicklas

unread,
Oct 13, 2010, 3:40:20 AM10/13/10
to cu...@googlegroups.com
I suggest also doing

require 'capybara/cucumber'

that will include Capybara in the World for you and also set up some
useful tags (@javascript, etc..)

/Jonas

ToddH

unread,
Oct 26, 2010, 4:52:47 PM10/26/10
to Cukes
Thanks for all the tips and suggestions! I've put together a
standalone cucumber starter project on Github to hopefully help other
people that want to do the same thing:

http://github.com/thuss/standalone-cucumber

-Todd
Reply all
Reply to author
Forward
0 new messages