views:

31

answers:

2

I've been developing a Rails application and I've decided to implement a mixture of Test Driven Development and Behavioral Driven Development.

However the application I am building uses a web application user interface framework known as MochaUI which is built on top of the Mootools framework.

I have just finished writing a portion of unit tests and have moved on to testing the user interface; which is where I start to run into problems.

A lot of the things I want to test is content that is loaded via javascript, some data is loaded into iframes, some data is loaded into elements (ajax).

So I wrote a test

And I should see "Some text loaded into an iframe with javascript"

And as you guessed, it failed. I don't know where to begin to fix this problem, as I am very new to TDD and BDD but I'm working my way there, can anyone give me some pointers or possibly a solution so I can sleep at night?

Thanks!

+2  A: 

There is selenium for javascript-testing... Maybe this would be a tip?

see http://github.com/aslakhellesoy/cucumber/wiki/Setting-up-Selenium

or

http://bddcasts.com/series/tools/episodes/using-selenium-with-webrat-and-cucumber

Lichtamberg
+1  A: 

Use capybara, tagging the scenarios that require javascript with @javascript.

John