Testing JavaScript Applications

Author: Lucas da Costa
Publisher: Manning
Date: April 2021
Pages: 512
ISBN: 978-1617297915
Print: 1617297917
Audience: JavaScript developers
Level: Intermediate
Rating: 5
Reviewer: Ian Elliot
Testing the most web's fundamental language is clearly important...

but 500 pages! Is this testing JavaScript or the reader? Can there really be so much to say? The answer seems to be yes if you are serious about testing and want to be a complete expert.

The most important thing to state about any book detailing how to do testing with a specific language is what the test framework is. This is quite difficult to discover as its not on the cover or on the back jacket. On page 27 it says that the testing framework to be used is Facebook's Jest and that it is used throughout the book. Even if you are not interested in using Jest the book will still be of use to you as it contains lots of general ideas.

JavaScript is different from most languages in being used extensively on the client and the server - front end and back end. Testing therefore has some interesting additional difficulties which this book addresses within its JavaScript focus.

Banner

Part 1 contains just two chapters. Chapter 1 covers the standard argument for testing which put briefly is how can you possibly know that your code works without testing? Chapter 2 discusses the types of test you can apply, and this is where the fact that Jest is the framework being used emerges. You might have to also set up node.js and VS Code if you aren't already using them.

Part 2 is called "Writing Tests" and it goes into details of how to write tests - mocks, stubs and spies. Testing the back end and the front end. React is also covered. In Chapter 9 the idea of Test Driven Development is explained. It's not a philosophy I've ever subscribed to and after reading the chapter it still isn't for me. Chapters 10 and 11 deal with UI testing.

Part 3 is called "Business Impact" and it deals with very general topics such as continuous integration and delivery. This is mostly waffly stuff suitable for managers - but if you need to sell your idea to a manager then why not...

Conclusion

This is probably more than most JavaScript programmers want to know about testing, but if you do then this is the place to start. The fact that Jest is used as the testing framework isn't a disadvantage and there are lots of reasons for selecting it if you aren't already committed to testing. I don't think an innocent JavaScript programmer is going to get though all 500 pages - you need a certain amount of dedication to the testing philosophy for that. The book also doesn't really stress the big problems with extensive testing - writing more test code than production code, testing the obvious and leaving the subtle untested, a false sense of security that your code passes all of "your" tests without any real world justification for its quality.

If you think testing is a good approach then why not read this encyclopedic book - its the only real choice.

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

 

Banner

 


The Joy of JavaScript (Manning)

Author: Luis Atencio
Publisher: Manning
Date: March 2021
Pages: 360
ISBN: 978-1617295867
Print: 1617295868
Audience: JavaScript developers
Rating: 4
Reviewer: Ian Elliot
Joy you say!



Essential C# 12 (Pearson)

Author: Mark Michaelis
Publisher: Addison-Wesley
Date: December 3, 2023
Pages: 1232
ISBN: 978-0138219512
Print: 0138219516
Kindle: B0CLKY8GNV
Audience: C# developers
Rating: 5
Reviewer: Mike James
The latest edition of a highly recommended book that combines reference and tutorial material.


More Reviews

 

Last Updated ( Saturday, 12 February 2022 )