Need advice about which tool to choose?Ask the StackShare community!

Mocha

4.6K
2.6K
+ 1
425
Selenium

10.9K
8.3K
+ 1
519
Add tool

Mocha vs Selenium: What are the differences?

Mocha: Simple, flexible, fun javascript test framework for node.js & the browser. Mocha is a feature-rich JavaScript test framework running on node.js and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases; Selenium: Web Browser Automation. Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.

Mocha belongs to "Javascript Testing Framework" category of the tech stack, while Selenium can be primarily classified under "Browser Testing".

"Open source", "Simple" and "Promise support" are the key factors why developers consider Mocha; whereas "Automates browsers", "Testing" and "Essential tool for running test automation" are the primary reasons why Selenium is favored.

Mocha and Selenium are both open source tools. Mocha with 18K GitHub stars and 2.43K forks on GitHub appears to be more popular than Selenium with 14.7K GitHub stars and 4.92K GitHub forks.

MIT, PedidosYa, and HubSpot are some of the popular companies that use Selenium, whereas Mocha is used by Sellsuki, Onedio, and triGo GmbH. Selenium has a broader approval, being mentioned in 770 company stacks & 425 developers stacks; compared to Mocha, which is listed in 397 company stacks and 268 developer stacks.

Advice on Mocha and Selenium
Needs advice
on
WebdriverIOWebdriverIOSeleniumSelenium
and
JestJest
in

we are having one web application developed in Reacts.js. in the application, we have only 4 to 5 pages that we need to test. I am having experience in selenium with java. Please suggets which tool I should use. and why ............................ ............................ .............................

See more
Replies (1)
Prashanth Marappa
Senior Software Engineer at Mphasis · | 1 upvotes · 100K views
Recommends
SeleniumSelenium

with the help of selenium we can automate react js for functional testing

See more
Decisions about Mocha and Selenium

We use Mocha for our FDA verification testing. It's integrated into Meteor, our upstream web application framework. We like how battle tested it is, its' syntax, its' options of reporters, and countless other features. Most everybody can agree on mocha, and that gets us half-way through our FDA verification and validation (V&V) testing strategy.

See more
Get Advice from developers at your company using Private StackShare. Sign up for Private StackShare.
Learn More
Pros of Mocha
Pros of Selenium
  • 136
    Open source
  • 100
    Simple
  • 81
    Promise support
  • 48
    Flexible
  • 28
    Easy to add support for Generators
  • 12
    For browser and server testing
  • 7
    Curstom assertion libraries
  • 4
    Works with Karma
  • 3
    No other better tools
  • 1
    Simple integration testing
  • 1
    Default reporter is nice, clean, and itemized
  • 1
    Simple setup
  • 1
    Works with saucelabs
  • 1
    Lots of tutorials and help online
  • 1
    Works with BrowserStack
  • 169
    Automates browsers
  • 154
    Testing
  • 101
    Essential tool for running test automation
  • 24
    Record-Playback
  • 24
    Remote Control
  • 8
    Data crawling
  • 7
    Supports end to end testing
  • 6
    Functional testing
  • 6
    Easy set up
  • 4
    The Most flexible monitoring system
  • 3
    Easy to integrate with build tools
  • 3
    End to End Testing
  • 2
    Integration Tests
  • 2
    Comparing the performance selenium is faster than jasm
  • 2
    Record and playback
  • 2
    Compatible with Python
  • 2
    Easy to scale
  • 0
    Integrated into Selenium-Jupiter framework

Sign up to add or upvote prosMake informed product decisions

Cons of Mocha
Cons of Selenium
  • 3
    Cannot test a promisified functions without assertion
  • 1
    No assertion count in results
  • 1
    Not as many reporter options as Jest
  • 7
    Flaky tests
  • 2
    Slow as needs to make browser (even with no gui)

Sign up to add or upvote consMake informed product decisions

What is Mocha?

Mocha is a feature-rich JavaScript test framework running on node.js and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.

What is Selenium?

Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.

Need advice about which tool to choose?Ask the StackShare community!

What companies use Mocha?
What companies use Selenium?
See which teams inside your own company are using Mocha or Selenium.
Sign up for Private StackShareLearn More

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Mocha?
What tools integrate with Selenium?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

What are some alternatives to Mocha and Selenium?
Jasmine
Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, Node.js projects, or anywhere that JavaScript can run.
Jest
Jest provides you with multiple layers on top of Jasmine.
Chai
It is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. It has several interfaces that allow the developer to choose the most comfortable. The chain-capable BDD styles provide an expressive language & readable style, while the TDD assert style provides a more classical feel.
Cypress
Cypress is a front end automated testing application created for the modern web. Cypress is built on a new architecture and runs in the same run-loop as the application being tested. As a result Cypress provides better, faster, and more reliable testing for anything that runs in a browser. Cypress works on any front-end framework or website.
SinonJS
It is a really helpful library when you want to unit test your code. It supports spies, stubs, and mocks. The library has cross browser support and also can run on the server using Node.js.
See all alternatives