Norway


You Should Have a Test Suite

Software tests improve confidence in an application’s behavior, make it easier to grow and maintain, help identify breaking bugs and can even serve as a form of documentation. For a developer practicing TDD, writing tests is even an essential step before writing any application code.

The problems tests mitigate are expensive to resolve, so really they help organizations as much as developers.

Of course, tests don’t write themselves, and there is a cost associated with creating a comprehensive test suite for an application. One of the hurdles to creating a useful test suite is the infrastructure required to write and run tests. Applications are complicated beasts, and useful tests need to handle that complexity.

Inspiration

Recently, I created a test suite for a client’s .js project. I love working in .js because it’s an un-opinionated framework that grants a lot of freedom to developers to tap into the huge ecosystem of JavaScript packages. That huge ecosystem extends to tools as well, so even for someone that has done a lot of JavaScript , setting up a test suite for the first , or adding new tools to an existing test suite, can be a significant undertaking. I wanted to share the testing tools I use on Node projects, and demonstrate how to configure them to build a test suite that is scalable and provides meaningful feedback about an application. Testing in Node is a Skill Pack on The Frontier I created to do that.

Note that even though the series focuses on adding test coverage to a Node , most of the tools and strategies can be used for any JavaScript .

The Series

Over the course of the series, we’ll be adding test coverage to a full-stack messaging app called ChattrBox. You may be familiar with this app from the Big Nerd Ranch Front-End Web Development Book or our Full-Stack and React Essentials Bootcamp. It’s a , full-stack app that has a Node backend running sockets and a API to power the frontend’s chat interface. If you’re learning web development, I encourage you to follow along with the book and build the app yourself. However, if you just want to learn how to use some JavaScript testing tools, you’ll be able to download the application code from the Frontier and focus on the screencast material.

The series doesn’t cover testing philosophy or offer any opinions on what is or is not a good test, but it will show you how to add and configure a set of tools that will enable writing thorough tests to support an application. If you’re looking for thoughts on how to write good tests once you’ve got the tools set up, take a look at some of the testing blog posts by other Nerds.

Summary

If you’re new to testing in JavaScript and Node, this is a great series for you. If you have an existing app and test suite that you want to expand, you should be able to cherry pick some screencasts from the series that provide valuable direction for your unique situation.

The series describes my approach to Node or JavaScript testing, and there are plenty of other valid approaches. If you prefer another tool or strategy, tell us about it in the comments. Also, feel free to ask questions in the comments section. We’ll get someone to help you out.

The series starts with the ‘Basics’ video, so I’ll see you over there when you’re to get started.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here