Get Advice Icon

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

Mocha
Mocha

2.3K
1.6K
+ 1
399
Selenium
Selenium

4.1K
2.6K
+ 1
444
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.

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.
Get Advice Icon

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

Why do developers choose Mocha?
Why do developers choose Selenium?

Sign up to add, upvote and see more prosMake informed product decisions

    Be the first to leave a con
      Be the first to leave a con
      Jobs that mention Mocha and Selenium as a desired skillset
      What companies use Mocha?
      What companies use Selenium?

      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

      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.
      Enzyme
      Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output.
      See all alternatives
      Decisions about Mocha and Selenium
      Dschinkel Schinkel
      Dschinkel Schinkel
      Mocha
      Mocha
      Jest
      Jest
      JavaScript
      JavaScript
      React
      React
      Enzyme
      Enzyme
      #Tdd
      #Bdd
      #Testdrivendevelopment

      I use both mocha and Jest because:

      • I don't care whether teams use Jest or Mocha. But jest is way too overhyped. Most devs are writing integration tests and think that it's so much better but frankly I don't write integration tests as the way to get both design feedback and confidence when I code. I adhere to the test pyramid, not ice cream cone or the dumb "trophy"

      • I TDD, so I only ever use the "API" of test frameworks. I don't do a lot of integration tests for TDD and all the bells and whistles Jest provides you from the command-line I just don't need. And I certainly do not care about or touch Jest Snapshots, I despise them

      • My tests are fast enough because I write isolated tests with TDD, so I don't run into performance issues. Example: I write my tests in a way that I can run 300 tests in literally 1 second with mocha. So the Jest ability to pinpoint and only run those tests which are affected by code changes. I want to run all of them every time when I TDD. It's a different mindset when you TDD

      • I also mainly code in IntelliJ or WebStorm because I feel the tools in that IDE far surpass VSCode and I also love running the test UI runner in it vs. lousy command-line

      • I feel both mocha and Jest read just fine in terms of code readability. Jest might have shorter assertion syntax but I don't really care. I just care that I can read the damn test and my tests are written well and my test descriptions, as well as the code itself including constants represent business language, not technical. I care most about BDD, clean code, 4 rules of simple design, and SOLID

      • I don't like using mock frameworks so no I don't use Jest's Mocking framework. I don't have to mock a lot in my tests due to the nature of how I strive to code...I keep my design simple and modular using principals such as clean code and 4 rules of simple design. If I must mock, I create very simple custom mocks with JS

      • On the contrary to the belief that integration tests and mount are the way to go (this belief drives me absolutely crazy, especially Dodd's promoting that), I TDD with shallow & enzyme. My tests are simple. My design is driven by my tests and my tests give me quick and useful feedback. I have a course I'm working on coming out soon on TDD with React to show you how to truly test the FE and why the ice cream cone and trophy suck (you're being scammed people). Watch for that here: https://twitter.com/DaveSchinkel/status/1062267649235791873

      Don't forget to upvote this post!

      Mocha Jest JavaScript React @jsdom Enzyme #tdd #bdd #testdrivendevelopment

      See more
      Scott Mebberson
      Scott Mebberson
      CTO / Chief Architect at Idearium Β· | 2 upvotes Β· 21.7K views
      Mocha
      Mocha
      Jest
      Jest

      We used to Mocha for as our primary Node.js test framework. We've now switched to Jest and haven't looked back.

      Jest is faster and requires less setup and configuration. The Mocha API and eco-system is vast and verified, but that also brings complexity.

      It you want to get in, write tests, execute them and get out, try Jest πŸ˜€

      See more
      Benjamin Poon
      Benjamin Poon
      QA Manager - Engineering at HBC Digital Β· | 8 upvotes Β· 66.5K views
      Nightwatchjs
      Nightwatchjs
      Selenium
      Selenium
      JavaScript
      JavaScript
      Cucumber
      Cucumber
      GitHub
      GitHub
      GoCD
      GoCD
      Docker
      Docker
      ExpressJS
      ExpressJS
      React
      React
      PostgreSQL
      PostgreSQL

      For our digital QA organization to support a complex hybrid monolith/microservice architecture, our team took on the lofty goal of building out a commonized UI test automation framework. One of the primary requisites included a technical minimalist threshold such that an engineer or analyst with fundamental knowledge of JavaScript could automate their tests with greater ease. Just to list a few: - Nightwatchjs - Selenium - Cucumber - GitHub - Go.CD - Docker - ExpressJS - React - PostgreSQL

      With this structure, we're able to combine the automation efforts of each team member into a centralized repository while also providing new relevant metrics to business owners.

      See more
      Jack Graves
      Jack Graves
      Head of Product Development at Automation Consultants Β· | 3 upvotes Β· 30.3K views
      atAutomation ConsultantsAutomation Consultants
      JUnit
      JUnit
      Jest
      Jest
      Apache JMeter
      Apache JMeter
      Mocha
      Mocha

      We use JUnit and Jest to perform the bulk of our automated test scenarios, with additional work with Apache JMeter for performance testing - for example, the Atlassian Data Center compliance testing is performed with JMeter. Jest provides testing for the React interfaces, which make up the backend of our App offerings. JUnit is used for Unit Testing our Server-based Apps. Mocha is another tool we use.

      See more
      Kevin Roulleau
      Kevin Roulleau
      QA Engineer Freelance at happn Β· | 5 upvotes Β· 19.1K views
      athappnhappn
      WebdriverIO
      WebdriverIO
      Appium
      Appium
      Selenium
      Selenium

      I chose WebdriverIO and Appium to implement a E2E tests solution on a native mobile app. WebdriverIO goes well beyond just implementing the Selenium / Appium protocol and allows to run tests in parallel out of the box. Appium has the big advantage of supporting iOS and Android platforms, so the test codebase and tools are exactly the same, which greatly reduces the learning curve and implementation time.

      See more
      Interest over time
      Reviews of Mocha and Selenium
      Review ofSeleniumSelenium

      we at www.cloudqa.io use selenium hub and node architecture to execute our test cases its a very powerful tool to automate web applications.

      How developers use Mocha and Selenium
      Avatar of Kang Hyeon Ku
      Kang Hyeon Ku uses SeleniumSelenium

      κ°€μž₯ κ°•λ ₯ν•œ μ›Ή UI / UX ν…ŒμŠ€νŠΈ 툴 μ΄μ§€λ§Œ, λ¬Έμ œλ„ λ§Žλ‹€. iframe μ•ˆμ— μžˆλŠ” 건 잘 select κ°€ μ•ˆλ˜κΈ°λ„ ν•˜κ³ , 화면이 μž‘μ•„ μ»΄ν¬λ„ŒνŠΈκ°€ 화면에 보이지 μ•ŠμœΌλ©΄ 또 select ν•  수 μ—†λ‹€. ν•˜μ§€λ§Œ λΈŒλΌμš°μ €λ₯Ό μžˆλŠ” κ·ΈλŒ€λ‘œ μ œμ–΄ ν•  수 μžˆλ‹€λŠ” 게 κ°€μž₯ 큰 맀λ ₯이닀.

      ps. selenide 와 같이 μ“°λ©΄ μ½”λ“œκ°€ 많이 κ°œμ„ λœλ‹€.

      Avatar of samdfonseca
      samdfonseca uses SeleniumSelenium

      Maintaining and expanding automated regression tests is one of my primary responsibilities at CrowdTwist. We use Selenium to test the front-end parts of our platform.

      Avatar of Matt Welke
      Matt Welke uses MochaMocha

      Used for unit testing when working with Node.js. Used over other testing frameworks because of good compatibility with TypeScript and ts-node.

      Avatar of Kang Hyeon Ku
      Kang Hyeon Ku uses MochaMocha

      javascript ν…ŒμŠ€νŠΈλ₯Ό μœ„ν•΄ 써본 ν”„λ ˆμž„μ›Œν¬ 이닀. 초반 유λͺ…ν•œ ν”„λ ˆμž„μ›Œν¬μ€‘ ν•˜λ‚˜μ˜€λŠ”λ° μš”μ¦˜μ€ λ„ˆλ¬΄ ν…ŒμŠ€νŠΈ ν”„λ ˆμž„μ›Œν¬λ„ λ‹€μ–‘ν•΄μ Έ 잘 λͺ¨λ₯΄κ² λ‹€. junit μ—κ²ŒλŠ” hamcrest 이 μžˆλ‹€λ©΄ mocha μ—κ²ŒλŠ” chaiκ°€ μžˆλ‹€.

      Avatar of Dave Woolfenden
      Dave Woolfenden uses MochaMocha

      Is a feature-rich JavaScript test framework running on Node.js and in the browser supporting asynchronous testing.

      Avatar of Ralic Lo
      Ralic Lo uses SeleniumSelenium

      Used Selenium web-driver for automated QA testing in continuous integration and continuous deployment.

      Avatar of Owen Miller
      Owen Miller uses SeleniumSelenium
      • Navigating our site for tests
      • Navigating other sites that discriminate against non-human visitors
      Avatar of Ataccama
      Ataccama uses SeleniumSelenium

      Selenium is a great way to automatically test if a build is sane and can be deployed.

      Avatar of Kingsley Victor
      Kingsley Victor uses MochaMocha

      Mocha is ideal for running tests on apis built with Node's Express

      Avatar of Tim De Lange
      Tim De Lange uses MochaMocha

      Unit testing on shared code between brow ser and back end.

      How much does Mocha cost?
      How much does Selenium cost?
      Pricing unavailable
      Pricing unavailable