When comparing livedoc-mocha vs Nightwatch.js, the Slant community recommends Nightwatch.js for most people. In the question“What are the best JavaScript BDD frameworks?” Nightwatch.js is ranked 4th while livedoc-mocha is ranked 5th. The most important reason people chose Nightwatch.js is:
Nightwatch solves the [Paradox of Choice](http://www.ted.com/talks/barry_schwartz_on_the_paradox_of_choice?language=en) among testing frameworks such as Jasmine, Cucumber or Mocha+Chai, by including its own BDD-style assertion library, based on Chai.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Great looking test output
Pro Loads of options and create your own reports if needed
You can create your own reports as it can output the results in JSON. Not done it ourselves yet, but could be useful.
Pro Powerful implementation of the Gherkin Spec
Pro You don't have to choose a testing framework
Nightwatch solves the Paradox of Choice among testing frameworks such as Jasmine, Cucumber or Mocha+Chai, by including its own BDD-style assertion library, based on Chai.
Pro Includes its own testing framework / assertions library
Pro Test organization is out of the box
Supports page object model, custom commands, custom assertions, and globals.js.
Pro 3rd party integration with Cucumber
Though Cucumber is not officially supported, Nightwatch can be used with Cucumber.
Cons
Con Not great for Teams that don't value testing
As this takes more effort (ie you need to think harder about the test/spec) to write good tests. We found some team members didn't like it. If your team thinks tests are a tax, better to go with a simpler option like mocha.
Con To get maximum benefit need to write using Gherkin
The Gherkin language is a lot more verbose than what devs are used to writing in.
Con No official BDD-style syntax support
Con Includes its own testing framework / assertions library
Unlike WebdriverIO, which lets you use various test frameworks and assertion libraries (e.g. Jasmine, Cucumber, Mocha + Chai), Nightwatch comes with its own BDD-style interface for performing assertions, based on Chai.
Here's a simple test example:
module.exports = {
'Demo test Google' : function (browser) {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end();
}
};