Day Two:

So lately, I’ve been hard at work at making my webmention receiver work so that others can send me comments, likes as well as all other sorts of replies to my posts and notes! My implementation has been tested out with webmention.rocks, which is an AMAZING site which helped me build my version and it automatically tests sending a webmention when I run my program on my computer. This is great and all, but as I continue to add more features and complexity to my implementation it makes me worried that I’ll mess something up in my program with all these moving parts. When it comes to sending a webmention, lots can go wrong! The site may take too long to load, the user may have entered in the URL wrong, etc and all of this needs to be carefully tested. In order to help out with that, I’ve been trying to read up as much as I can to learn more about software testing. That way, I can catch any errors that arise in an automated way instead of checking each individual condition.

Since I’ve written my Webmention receiver in JavaScript, I’ve been using Mocha and Chai to do my testing which seems to be very popular choices. Mocha is the test framework which runs the tests I’ve created and Chai is an assertion library. Essentially, Chai is what allows me to check that nothing went wrong. If something did, Chai will say there’s been an error which’ll popup after Mocha finishes running.

When I first started to think about how I would be testing this mainly server-side application, I thought I should be testing every single method, including the internal ones. Instead thanks to this article, I’m going to instead focus on only the public methods. Internals change and it doesn’t really matter what’s going on behind the scenes. In my tests, I’m checking that things happened like I expected, how they happened isn’t important. The internals are tested implicitly by testing the public methods as what’s public depends on what’s hidden.

With that, I’ve shared a bit about software testing and how I’m going to go about testing my latest project. Software testing is incredibly important, so don’t leave it to the wayside. Until next time!

Do you have a reply you want to share? You can send me the URL here: