When comparing Jasmine vs CasperJS, the Slant community recommends Jasmine for most people. In the question“What are the best JavaScript unit testing tools?” Jasmine is ranked 2nd while CasperJS is ranked 3rd. The most important reason people chose Jasmine is:
If you prefer your test cases and applications to be developed from the perspective of your stake holders, Jasmine is the framework for you.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Behaviour Driven Development focused
If you prefer your test cases and applications to be developed from the perspective of your stake holders, Jasmine is the framework for you.
Pro Easy to find Jasmine tutorials for most MV* frameworks,
whilst Mocha is still considered the new kid on the block.
Pro Has a very readable and user-friendly syntax
Code readability is an important factor, if the application development involves multiple teams; if the testing team is unable to read your test cases then they won't be able to test it. Jasmine resolves this issue by providing developers with an extremely simple and "human-friendly" syntax.
Pro Allows both DOM-less as well as asynchronous testing
If you have some test cases that do not involve testing of DOM elements or events, those are exactly the ones where you want to use Jasmine. It'll provide smooth, simple and easy DOM-less testing of those test cases.
Pro Integrates very well with Ruby on Rails
The jasmine-rails gem allows you to run Jasmine specs in a browser (powered by Rails engine mounted into your application).
Pro Allows screenshots (either the full page or parts of it) if performing UI testing
There are times where you don't want to open up a browser for screencaps, that is where CasperJS comes to use, it can render the page using its own rendering engine and take and save a screenshot for you, all via the commandline
Pro Easy to understand
Pro Written in JavaScript
Since all webdevs know JS, the start-up time of learning the framework will be reduced to zero, as your team can be productive from day one.
Pro Easily integrates with other applications
Due to the simplicity of the framework, not only other libraries can be built with it, but it can be integrated with any web application as well.
Pro Can run javascript code inside pages being tested
Can execute arbitrary javascript or load external JS into the page being tested. This feature is possible due to the presence of a rendering engine, and helps you see the effects of any client side scripting during your tests.
Cons
Con Maintainers are not very responsive to pull requests
Pivotal aren't responsive to pull requests, though they have made repo changes within < 3 months
Con Not for unit testing but rather UI testing
These are two extremely different concepts. CasperJS should be removed from this list
Con Cannot guarantee 100% accurate Webkit-based browser screenshots
QtWebKit is the rendering engine used by CasperJS. Keep in mind this is NOT the same rendering engine as Chrome; hence, if you want to be 100% sure of the results, you must run a Webkit browser (such as Chrome) yourself.