I’m looking at using Jasmine to write some unit tests for our app’s front end code. I’d like to be able to run them from a console 1) because I think that’s more convenient than running them in browser 2) for the purpose of automating the execution of the tests. What exactly do I need to do to set this up? Are there any tools out there that already do it?
Share
Well you have to still run them in a browser, but there are a few console driven tools that allow for browser testing.
Yeoman – http://yeoman.io/ – is a tool released by Google’s dev team that includes phantomjs as a part of a task to test your code. Basically, it spins up a headless browser, runs the tests, and then outputs the results to the console.
Bunyip – http://ryanseddon.github.com/bunyip/ – is an amazing tool as well. It lets you run your tests in any browser that you can connect to it (so you’re not just tied to webkit testing, as you are with yeoman/phantomjs). It has great integration with browserstack, so you can automatically run your whole test suite over dozens of browsers.
You could also write up a selenium test – http://seleniumhq.org – , and launch it through the command line.