Why bother testing your JavaScript?

When a user encounters a bug they look like this: 🤬

Bugs grind work to a halt.

Bugs cause financial harm.

Every single time a bug is encountered, user trust erodes.

Bugs are bad.

And who gets blamed?

You.

The developer.

You know you should squash bugs before your code is deployed.

You know you need to ship code that:

Takes every opportunity to guarantee that it works.

Doesn’t punish users with unnecessary bugs.

Doesn’t play whack-a-mole with features, fixing one thing only to break another.

Is maintainable and understandable to your co-workers.

A professional ships working code. Code that works.

We’re talking about code that is well tested. Only through testing can you confidently deliver confident, professional code.

Why aren’t you testing code that users rely on?

When code fails on your users, have you failed to do your job?

You should do your job as well as possible and test, right?

Right.

Just one problem...

“Testing takes too much time and effort.”

There’s no time. You’re busy already.

There’s no obvious ROI. You can’t get the buy-in or budget for testing efforts.

There’s no way to test everything. Most testing is click click clicking around every turn of your application. It takes forever and feels like a waste of time—time you want to spend shipping new features, not QAing.

Nobody has time for that. But one way or another, your application will be tested. If not by you, then by your users.

Cross your fingers and push to prod.

So... click click click hope for the best? That’s what we’re doing?

If we want to ship high-quality, well-tested JavaScript applications there has to be a better way.

Imagine outsourcing the heavy lifting of testing your application.

You're a developer.

You know humans are bad at complex, repetitive tasks.

You also know that computers are very, very good at complex, repetitive tasks.

Professional developers use computers to automate testing of critical paths, behaviors, and all the little things—over and over and over again, all day and all night.

That’s how professional developers get things done... and done well.

Automated tests are the pro move.

Automated tests are your backup, your muscle.

Automated tests are your secret weapon...

But before you can build those tests, you need to know:

What should I test?

When do I test it?

Do I need 100% coverage?

How many tests are enough?

You could scour the internet to find the right alchemy of testing tools and techniques—or you could skip the analysis paralysis and go right to application success with a proven testing method.

A four-layer proven method for testing software

The Testing Trophy is a bottom-to-top professional method for testing web applications. It’s about writing just enough tests—the right tests. It’s not about reaching for 100% coverage.

By using this proven testing method, you’ll layer these techniques:

Use a static type system and a linter to capture basic errors like typos and syntax.

to capture basic errors like typos and syntax. Write effective unit tests that target the critical behavior and functionality of your application.

that target the critical behavior and functionality of your application. Develop integration tests to audit your application holistically and make sure everything works together correctly in harmony.

to audit your application holistically and make sure everything works together correctly in harmony. Create end-to-end (e2e) functional tests for automated click-testing of critical paths instead of relying on your users to do it for you.

These four layers of automated testing give you the playbook to ship professional JavaScript applications with confidence, speed, and money savings. Every time.

One professional method of testing every JavaScript application

This course will apply the four-layer testing method to a React application, but this foundational strategy can be applied across any JavaScript framework: Angular, Vue, legacy Backbone apps, even frameworks and libraries we haven’t met yet.

Following this course, you’ll be equipped to:

deliver solid features that work for users as expected

choose the best tools for the job

communicate more effectively with your coworkers

be a more confident, professional JavaScript developer

Learn the professional method for JavaScript testing and always ship high quality software like the professional you are.