Test driving prime factors in Go / Testify

This article will show how to “test drive” the prime factors kata in Go with Testify. Testing in Go is built right in, which is great. It’s a very bare-bones implementation though so adding Testify to the mix makes it a lot easier to write your tests.

How often do we run our tests?

Today, automated tests1 are fairly ubiquitous in software projects. That is, almost every project has a large number of automated tests and that they tend to get run by some continuous integration (CI) server.

  1. More precisely, what we’re talking about are automated checks, not tests, but the agile community has never adjusted to using the more precise language so I’m going to keep calling them tests here. 

Improvements in CSS: Dark mode and CSS variables

Ryan and I started working on dark mode support for jirametrics and have discovered that CSS now has much better support for this sort of thing than it’s ever had in the past. Specifically, the latest versions of all the main browsers, now support dark mode directly, as well as CSS variables, which simplifies much of the configuration.

Jira API: Board details

Next we’ll look at the API to get information about a board. Boards are fundamentally broken, in my opinion, because they aren’t a real thing in Jira. They’re a view into issues at a point in time, which means that they don’t show up anywhere in the history. You can’t tell what board an issue was on when a status change happened, and you can’t assign an issue to a board.

Jira API: Statuses

The issue history gives us both the name and id of any statuses that the ticket has moved through. Sometimes that’s enough but often we then need to know more about that status, such as what status category it belongs to and for that, we need to call a different API.

Jira API: Issue history

If you want metrics out of Jira, the single most important thing you need to access is the issue history and it’s not obvious how to get that. Just about all the metrics you’ll want to collect will need data from the history - you might need to know when an item started or when it entered a certain priority or when the flag was set or cleared.

Jira API: Intro and authentication

I’m the primary author of the jirametrics tool that extracts data from Jira and generates reports. This tool evolved to satisfy my own pain of not being able to get useful data out of Jira with the built-in reports and along the way, I’ve learned more about Jira internals than I ever wanted to know.

Warning levels

Over my career, I’ve noticed that a significant number of programmers ignore compiler and linter warnings. They either turn the warning levels down or just ignore the output. I’ve worked with teams using SonarQube that would have tens of thousands of warnings that they wouldn’t even look at.

Linguistic Antipatterns

A linguistic antipattern is a place in the code where the naming implies that it does one thing and in fact, it does something different. For example, the method void isEmpty() suggests that it will return a boolean reflecting whether or not the object is empty, yet the method does not return anything.