Design your way

Thursday, September 28, 2017

There are different types of Javascript testing frameworks among which include unit, acceptance and coverage tools.

Although, this is a list of almost all the Javascript test frameworks that can be found online, you will notice that you will be tempted to use just a few of them.

This article doesn’t have the purpose to make you use all of them, because that would be pointless.

Instead the article wants is an overview of the Javascript testing frameworks that developers use now.

Javascript testing frameworks to check out

Jasmine

jasmine.github.io_ Javascript Testing Frameworks: The Best to Test JS Code

Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM.

And it has a clean, obvious syntax so that you can easily write tests.

Mocha

mochajs.org_ Javascript Testing Frameworks: The Best to Test JS Code

Mocha is a feature-rich JavaScript test framework running on Node.js and in 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.

PhantomJS

phantomjs.org_ Javascript Testing Frameworks: The Best to Test JS Code

PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

Jest

facebook.github.io_jest_ Javascript Testing Frameworks: The Best to Test JS Code

Jest is used by Facebook to test all JavaScript code including React applications.

One of Jest’s philosophies is to provide an integrated “zero-configuration” experience. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in more stable and healthy code bases.

Karma

karma-runner.github.io_1.0_index.html Javascript Testing Frameworks: The Best to Test JS Code

The main goal for Karma is to bring a productive testing environment to developers.

The environment being one where they don’t have to set up loads of configurations, but rather a place where developers can just write the code and get instant feedback from their tests.

Because getting quick feedback is what makes you productive and creative.

FuncUnit

funcunit.com_ Javascript Testing Frameworks: The Best to Test JS Code

FuncUnit enhances assertion libraries like QUnit and Jasmine, enabling them to simulate user actions, easily test asynchronous behavior, and support black box testing. Use its terse jQuery-like syntax to superpower your functional or unit tests.

Intern

theintern.io_ Javascript Testing Frameworks: The Best to Test JS Code

Intern is a complete test system for JavaScript designed to help you write and run consistent, high-quality test cases for your JavaScript libraries and applications. It can be used to test any JavaScript code.

Intern is minimally prescriptive and enforces only a basic set of best practices designed to ensure your tests stay maintainable over time.

Its extensible architecture allows you to write custom test interfaces, executors, and reporters to influence how your tests run & easily integrate with your existing coding environment.

Intern also comes with Grunt tasks so it can be quickly added to existing Grunt-based workflows, and is designed to work out-of-the-box with popular continuous integration services like Jenkins and Travis CI.

Watir

watir.com_ Javascript Testing Frameworks: The Best to Test JS Code

An open source Ruby library for automating tests. Watir interacts with a browser the same way people do: clicking links, filling out forms and validating text.

Istanbul

istanbul.js.org_ Javascript Testing Frameworks: The Best to Test JS Code

Istanbul instruments your ES5 and ES2015+ JavaScript code with line counters, so that you can track how well your unit-tests exercise your codebase.

Enzyme

airbnb.io_enzyme_ Javascript Testing Frameworks: The Best to Test JS Code

Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components’ output.

Enzyme’s API is meant to be intuitive and flexible by mimicking jQuery’s API for DOM manipulation and traversal.

Enzyme is unopinionated regarding which test runner or assertion library you use, and should be compatible with all major test runners and assertion libraries out there. The documentation and examples for enzyme use mocha and chai, but you should be able to extrapolate to your framework of choice.

Chai

chaijs.com_ Javascript Testing Frameworks: The Best to Test JS Code

Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.

testdouble.js

testdouble Javascript Testing Frameworks: The Best to Test JS Code

Are you writing JavaScript tests and in the market for a mocking library to fake out real things for you? testdouble.js is an opinionated, carefully-designed test double library maintained by, oddly enough, a software agency that’s also named Test Double.

If you practice test-driven development, testdouble.js was designed to promote terse, clear, and easy-to-understand tests. There’s an awful lot to cover, so please take some time and enjoy our documentation, which itself is designed to show you how to make the most out of test doubles in your tests.

Ava

ava Javascript Testing Frameworks: The Best to Test JS Code

Even though JavaScript is single-threaded, IO in Node.js can happen in parallel due to its async nature.

AVA takes advantage of this and runs your tests concurrently, which is especially beneficial for IO heavy tests.

In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file. Switching from Mocha to AVA in Pageres brought the test time down from 31 to 11 seconds.

Having tests run concurrently forces you to write atomic tests, meaning tests don’t depend on global state or the state of other tests, which is a great thing!

Nightwatch.js

nightwatchjs.org_ Javascript Testing Frameworks: The Best to Test JS Code

Nightwatch.js is an easy to use Node.js based End-to-End (E2E) testing solution for browser based apps and websites. It uses the powerful W3C WebDriver API to perform commands and assertions on DOM elements.

Protractor

protractortest.org_ Javascript Testing Frameworks: The Best to Test JS Code

Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.

Cucumber

cucumber.io_ Javascript Testing Frameworks: The Best to Test JS Code

Cucumber supports over a dozen different software platforms. Every Cucumber implementation provides the same overall functionality, but they also have their own installation procedure and platform-specific functionality. Cucumber is one of the Javascript testing frameworks that people often recommend.

Wallaby.js

wallabyapp2 Javascript Testing Frameworks: The Best to Test JS Code

Wallaby.js runs your JavaScript tests immediately as you type and displays execution results in your code editor. It also provides beautiful test and code coverage reports updated in realtime.

TestCafe

devexpress.github.io_testcafe_ Javascript Testing Frameworks: The Best to Test JS Code

TestCafe is a pure node.js end-to-end solution for testing web apps. This Javascript testing framework takes care of all the stages: starting browsers, running tests, gathering test results and generating reports. TestCafe doesn’t need browser plugins – it works in all popular modern browsers out-of-the-box.

QUnit

qunitjs_com Javascript Testing Frameworks: The Best to Test JS Code

QUnit is a powerful, easy-to-use JavaScript unit test suite. It’s used by the jQuery, jQuery UI and jQuery Mobile projects and is capable of testing any generic JavaScript code, including itself

Cypress

cypress Javascript Testing Frameworks: The Best to Test JS Code

Cypress is a test engine that runs unit and integration tests in your browser.

Drive your application with automated tests instead of manually verifying that your app works. Don’t spend days setting up a test environment. Just download our desktop app, add your project and start testing! Seriously.

You don’t need to change your code and Cypress doesn’t need to modify your code. Test in any major language or framework. Does your app run in a browser? Yes? You can test it in Cypress.

Chai

chaijs_com Javascript Testing Frameworks: The Best to Test JS Code

Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any Javascript testing framework.

CasperJS

casperjs.org_ Javascript Testing Frameworks: The Best to Test JS Code

CasperJS is an open source navigation scripting & testing utility written in Javascript and based on PhantomJS — the scriptable headless WebKit engine. It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks

Sinon.JS

sinonjs.org_ Javascript Testing Frameworks: The Best to Test JS Code

Sinon is another one of these Javascript testing frameworks. Standalone and test framework agnostic JavaScript test spies, stubs and mocks (pronounced “sigh-non”, named after Sinon, the warrior).

Zombie.js

zombie.js.org_ Javascript Testing Frameworks: The Best to Test JS Code

If you’re going to write an insanely fast, headless browser, how can you not call it Zombie? Zombie it is.

Zombie.js is a lightweight framework for testing client-side JavaScript code in a simulated environment. No browser required.

Should

shouldjs.github.io_ Javascript Testing Frameworks: The Best to Test JS Code

should is an expressive, readable, framework-agnostic assertion library. The main goals of this library are to be expressive and to be helpful. It keeps your test code clean, and your error messages helpful.

By default (when you require(‘should’)) should extends the Object.prototype with a single non-enumerable getter that allows you to express how that object should behave. It also returns itself when required with require.

It is also possible to use should.js without getter (it will not even try to extend Object.prototype), just require(‘should/as-function’). Or if you already use version that auto add getter, you can call .noConflict function.

Selenium

seleniumhq.org_ Javascript Testing Frameworks: The Best to Test JS Code

Selenium is the last of the Javascript testing frameworks included in this article. It 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!) be automated as well.

If you liked this article about Javascript testing frameworks, you should check out these articles as well:

The post Javascript Testing Frameworks: The Best to Test JS Code appeared first on Design your way.



Source: http://ift.tt/2xHKktn

No comments:

Post a Comment

 

The Cash Box Blueprint

Most Reading