Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Are there any approaches and tools for driving the development of JavaScript with BDD. I know that I can do this through the UI with tools like Selenium, but is there any tool that can allow this to happen at the unit testing level?

I would ideally like to write scenarios for the JavaScript behaviors and use unit tests to prove that the JavaScript works.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Jasmine is a BDD tool for JavaScript.

share|improve this answer
add comment

In the company I'm currently working on, we tested out some testing frameworks out there, and we finally decided to go with Jasmine. This is what we found:

  • JsUnit: This is one of the oldest unit testing framework, that was later being maintained by Pivotal Labs. But even they are using Jasmine now :P.
  • JSpec: This is an RSpec like BDD unit testing framework. We didn't like some of the ways things are done with it, as well as the magic strings in "expect(cart).to(receive, 'addProduct', 'twice')"
  • Jasmine: This is RSpec like as well and was the one that we found was more complete and easy to use and implement. You definitely have to try it out. The easiness of running it's web server (with just rake jasmine), along it's easy extensiveness (implementing matchers is really easy) made it our preferred option.

To complement this, I would also suggest you take a look at these exquisite libraries:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.