Continuous Integration and Unit Testing

Continuous Integration and Unit Testing

If you saw my presentation at GDevCon 2, you’ll know that Test Driven Development is about more than just writing unit tests. It’s about the whole development process. However, after each development iteration, you do end up with a bunch of tests. Why not integrate them into your workflow using Continuous Integration?

Workflow for vipm package building.

This diagram shows a development workflow I have been working on for VI Packages. I chose not to use it for the package in my presentation, but I’m still mulling things over. I use a modified form of GitLab Flow (Actually since I originally wrote this I have adapted just straight Gitflow after discovering the Gitflow button in SourceTree). Master is always the latest and greatest and feature development/bugfixes take place is their own branches. So every time I check in on any branch, I run a basic VI Analyzer test and a set of unit tests. Then when I merge into master I already know that the unit tests pass. Then for every check-in on master I build the vip file. Then I install it and run the same unit tests against the installed code. When I am ready to release, I tag master and that triggers a nextcloud deployment, which puts the vip file on a share server and sends an email. That was what I intended.

As you can see, I planned to use the unit tests at 2 different places:

  • to make sure any updates pass before I merge them into master
  • to verify that the final package installs correctly

If you want to learn more about Continuous Integration, be sure to attend our webinar on Wednesday.