Comments on: testing rails application https://fromdelhi.com/2006/04/26/testing-rails-application/ Sat, 06 May 2006 09:43:38 +0000 hourly 1 https://wordpress.org/?v=5.3.21 By: manik https://fromdelhi.com/2006/04/26/testing-rails-application/#comment-133 Sat, 06 May 2006 09:43:38 +0000 http://www.fromdelhi.com/2006/04/26/testing-rails-application/#comment-133 Jon,
That was not the original motivation … but a constraint… we have webrick running on that linux box and can access the app from our browser.
What I was looking for was a way to validate values on the browser screen against those in the db. To get values directly from the db, I needed to have some scripts running outside the web server, accessing the db directly. These scripts needed to be embedded in the testing tool driving the browser.

But now i realize, that in wanting to do that I was violating the DRY principle. When i already test those values in the controller’s functional test, I rather not do them again in selenium.

As confused as I may sound, I am beginning to see a separate role for these testing tools such as selenium, separate from Rails inbuilt testing framework that is. It is not actually an either-or situation.

About following TDD, we also write tests after the code. What we have found is that writing a model followed by it’s unit tests and writing a controller followed by it’s functional tests is the best way it works for us. Though some hardcore TDD guys advocate writing test cases before the actual code, we have never even given that a try till date.

Venkat, the author of Practices of an Agile Developer , has described this process in a very nice way in this blog post “Walking along the development beach” .

]]>
By: Jonathan Boutelle https://fromdelhi.com/2006/04/26/testing-rails-application/#comment-132 Mon, 01 May 2006 17:08:11 +0000 http://www.fromdelhi.com/2006/04/26/testing-rails-application/#comment-132 Cool stuff!

The original motivation (on an ssh box, can’t view local browser) was one thing I didn’t get. If that was your problem, why didn’t you just upon up port 80 and test from your browser?

Of course, just functionally testing with your browser isn’t enough. You need automated testing at every level, and that’s where tools like watir and selenium come in.

Are you having success at doing actual test-driven development? I find it’s a tradition honored more in the breach than in the observance … my tests always get written AFTER my code, no matter how much I intend to write them first!

]]>
By: manik https://fromdelhi.com/2006/04/26/testing-rails-application/#comment-131 Fri, 28 Apr 2006 07:17:17 +0000 http://www.fromdelhi.com/2006/04/26/testing-rails-application/#comment-131 Thanks Jonas, I already had “selenium on rails” delicioused.
Will definitely look into it.

]]>
By: Jonas https://fromdelhi.com/2006/04/26/testing-rails-application/#comment-130 Fri, 28 Apr 2006 06:57:09 +0000 http://www.fromdelhi.com/2006/04/26/testing-rails-application/#comment-130 If you don’t want to write your Selenium tests in HTML you can check my plugin out, Selenium on Rails, which lets you write them in a couple of formats.

http://andthennothing.net/archives/2006/02/19/new-version-of-selenium-on-rails

]]>