Chapter 16. Testing desktop apps

 

This chapter covers

  • Understanding why testing desktop apps is essential
  • Exploring different approaches to testing your app
  • Writing unit tests with Mocha
  • Testing Electron apps with Spectron
  • Doing behavior-driven development with Cucumber

When I started programming back in 2006, I had no idea how to test software, or why I should. Then, one day I was getting ready to deliver a product demo to a client, making some code changes 20 minutes before the demo. When I demoed the app to the client, it crashed. Perhaps if I had written some tests for the app, I would have foreseen that the app would crash, and I wouldn’t have suffered that embarrassment. This is one of many reasons you don’t want to write code without tests (or, for that matter, make last-minute changes before a product demo).

Thankfully, my colleague Matt Ford (who runs the digital consultancy Bit Zesty) sat down with me and introduced me to unit testing with RSpec in Ruby. From there, I was able to improve the quality of my work by writing tests for my code in a test-driven-development fashion.

16.1. Different approaches to testing apps

16.2. Unit testing

16.3. Functional testing

16.4. Testing Electron apps with Spectron

16.5. Integration testing

16.6. Summary