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

 


Embracing Modern C++ Safely

Author: Dr. John Lakos, Vittorio Romeo, Dr. Rostislav Khlebnikov and  Alisdair Meredith
Publisher: Addison-Wesley
Date: December 2021
Pages: 1376
ISBN: 978-0137380350
Print: 0137380356
Kindle: B09HTFQB92
Audience: C++ developers
Rating: 4
Reviewer: Harry Fairhead
Writing safe C++ - sounds essential

 [ ... ]



Learn to Code by Solving Problems

Author: Dr. Daniel Zingaro
Publisher: No Starch Press
Date: June 2021
Pages: 335
ISBN: 978-1718501324
Print: 1718501323
Kindle: B08FH92YL8
Audience: People wanting to learn Python
Rating: 4
Reviewer: Mike James
Solving problems - sounds good?


More Reviews

 

Last Updated ( Saturday, 12 February 2022 )