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

 


Lean DevOps

Author: Robert Benefield
Publisher: Addison-Wesley
Pages: 368
ISBN: 978-0133847505
Print:  0133847500
Kindle: B0B126ST43
Audience: Managers of devops teams
Rating: 3 for developers, 4.5 for managers
Reviewer: Kay Ewbank

The problem this book sets out to address is that of how to deliver on-demand se [ ... ]



SQL Server 2022 Revealed

Author: Bob Ward
Publisher: Apress
Pages: 506
ISBN: 978-1484288931
Print:1484288939
Kindle: B0BLB4VJL9
Audience: DBAs & SQL devs
Rating: 5
Reviewer: Ian Stirk

This book aims to explain the new features in SQL Server 2022, how does it fare?


More Reviews

 

Last Updated ( Saturday, 12 February 2022 )