Software Development and QA Tips By QASource Experts

The Differences Between Jasmine, Mocha and Cucumber Testing Framework

Written by Timothy Joseph | Jan 11, 2021 5:00:00 PM

Cucumber JS, Jasmine, and Mocha are the most commonly used frameworks used in JavaScript. Below is the comparison of all these frameworks w.r.t features:

Feature Cucumber JS Jasmine Mocha
Assertion library
Need to be integrated with Cucumber-assert
Inbuilt
Need to be integrated with different assertion libraries: Chai, should.js, expect.js, better-assert
Gerkin Language support
Inbuilt
Need to be integrated with Karma or Cucumber
Need to be integrated with Mocha-Cakes or mocha-gerkin
Grouping/tagging of test
Yes
Yes
Yes
Test Runner
Command line
Command line
Command line
Reporting
Intuitive reports using cucumber-html-reporter and multiple-cucumber-html-reporter libraries
Either cucumber reports can be generated or karma-jasmine-html-reporter or jasmine-pretty-html-reporter can be used, but these reports are less intuitive than Cucumber
Mocha-simple-html-reporter and mochawesome can be used for reporting. Mochawesome reports are intuitive, just like cucumber reports
Documentation/Forums support
Yes
Yes
Yes
Rerun of failed tests
No inbuilt support for JS version of Cucumber
No inbuilt support
Inbuilt support available
Highlight slow tests
No support available
Can be implemented using jasmine-slow-reporter
Inbuilt support available
Asynchronous testing
Easy
Difficult
Easy
Parallel execution
Yes
Yes
Yes
Plug-in support and extensibility
Limited
Limited
Good

All the above are used for JavaScript based frameworks.