Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Test Driven Node.js Development

DZone's Guide to

Test Driven Node.js Development

· Performance Zone
Free Resource

Transform incident management with machine learning and analytics to help you maintain optimal performance and availability while keeping pace with the growing demands of digital business with this eBook, brought to you in partnership with BMC.

What would a language and framework be with unit testing, BDD, and other testing methods, frameworks and systems?

So once you get beyond casual Node.JS development, you will need to start unit testing.  Node.js has a surprisingly robust and mature set of testing tools and options.  Out of the box, Node.js has Built In Assert which will let you do some basic XUnit style tests.   A step beyond that is NodeUnit, which is pretty easy to use for XUnit oriented people.  For me, it’s easy to pick up coming from doing a lot of JUnit tests.  This article is great for Using NodeUnit for Testing.  Node.js is great because so many people have developed tools, frameworks and utilities for it.  The only issue I have it some are not very mature and the options are so fragmented.  There’s no Spring framework or hibernate that garners massive usage.  So many variations and options, I wish they could work together to put together a killer Rails or Spring type group of mature, tested, interconnected tools and utilities.  Full Testing Suite – Mocha is installable via NPM and works with a CI server.  This one is pretty cool.

The source for everything testing/bdd/mocking for Node.JS is  Joyent’s Testing Wiki.
There’s a number of behavior driven development tools including the polyglot tool Cucumber ->  BDD Testing Tool – Cucumber.JS.  Another option is  Asynchronous BDD Testing Tool – Vow.
For mocking,   Mockito Style Mock Objects – Mary Jane, looks great.   I will hope that maybe Mockito will officially support this one.
For JQuery fans, someone has ported QUnit to Node.JS [Node-Qunit]
This is just a sampling of test options.  Obviously tools like Selenium and Firebug will help you and so would JMeter and and SOAPUI.  A lot of general web testing tools are available that can do full system testing or integration testing for your Node.JS web apps.
I will be adding some examples in a future post with a github link.

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

Topics:

Published at DZone with permission of Tim Spann, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}