John Firebaugh john.firebaugh at
Fri Sep 14 01:33:11 BST 2012

On Thu, Sep 13, 2012 at 9:18 AM, Tom Hughes <tom at> wrote:

> I would certainly like to be able to get our javascript under test - my
> concern is to find a way to do so that is compatible with my workflow.
> Reading the Konacha documentation it seems that it exists entirely outside
> the normal rails testing framework, and has to be run separately so this
> would have no affect on "rake test" right?

> That's both good, in that it doesn't break anything I do now, and bad in
> that it means I have to do something extra if I want to test the js code
> before I deploy.

That's correct. What I typically do is add the `konacha:run` rake task
(which is a fully-automated command-line runner) as a dependency of the
task used for CI. Then the JS tests run in CI, and if I want to run the
full suite locally, I can use the CI task. Otherwise I'm usually doing
iterative test/develop cycles using `konacha:serve` and a browser.

> What I absolutely don't want is anything that causes browser windows to
> start appearing when I run the tests.

`konacha:run` can be configured to use a headless Capybara driver such as
capybara-webkit, and in that configuration it won't pop up
anything. `konacha:serve` is like `rails server` -- you open the test
runner page at your own leisure.

> Also, from the Konacha documentation it sounds like it is mostly for unit
> testing of small pieces of javscript rather than testing that pages
> actually work properly and do what we want right?

That's correct. It's intended for unit-level tests, and not full-stack
integration tests. Capybara (with the rack-test or a headless driver, if
that's your preference) is a better choice for that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rails-dev mailing list