May 07

Formal Code Review with Upsource

Upsource LogoIn the embedded world there is a never ending story to reach the highest quality of code possible. Once you bake a chip with a certain ROM, it’s usually  pretty expensive to fix bugs and a nightmare to upgrade devices in the field. Because of this, the quality delivered ‘for production’ should be thoroughly checked, formally reviewed and signed off as OK before sending it out to the manufacturer.

In previous posts I’ve talked about Software Requirement Traceability which already gives you a better idea on the overall state of your software through linking testcases with certain requirements. But we can go one step further!

People who have worked with Git might know Gerrit as some kind of gatekeeper that will force people to sign off bits of code, commits, before allowing it to be merged into the main repository. Due to various reasons I could not use Gerrit at the company I’m currently doing a project with and had to look elsewhere. Thanks to a friend of mine who is working at ZeroTurnaround I bumped into Upsource (from the guys over at Jetbrains and famous for their IntelliJ IDE). Upsource presents itself as a Polyglot Code Reviewing tool, which isn’t a lie!

I’m not going to bore people with details but rather give an overview on how I’ve implemented it and convinced people to actively use it.

First off, Upsource is a post-commit review framework. Unlike Gerrit, changes will have been merged into your favorite SCM. With this you really have to follow-up on what commits are done. Luckily you can set up Upsource to have triggers so it automatically creates reviews for commits done on, for example, a certain module of your software.

Secondly, these reviews can be auto-assigned to people based on some limited options (Upsource 3.5 should have more capability here, this is scheduled for September 2016 the last time I checked). What I added to my Upsource install is assigning people to a review based on one or more tags in the commit message. For example a message that looks like this: “Refactor sign-in function [DKE]” would have Upsource automatically assign it to me thanks to the [DKE] tag. With this, the committer can immediatelly notify people he would them to have a look (or sanity check) at whatever was in that commit.

Thanks to Upsource and the reviewing, we’ve already ended up with cleaner code, nobody wants to be “that guy” if you know somebody will have a (quick) look at your code. We used to shout feedback about commits back and forth and informally tell the original author to update this and that. Nothing of the converation got captured for future reference. Now we have the entire review history in Upsource and can get back to it in an instant to see why a certain decision to change some code was made. As an added bonus, people on the team might also become more familiar with parts of the code they are not an owner of maintainer of.

Lastly, Upsource provides some neat analytics on how much of your commits have been reviewed by one or more people. This could then also be used to show the management that the quality of the software is continuously being reassessed by the team and no compromises are being made.

I’d like to close with the fact that Upsource neatly integrates with GitHub, YouTrack and JIRA. The setup time took me less than an hour and in less than a day I got most of the system up and running. If your code quality could use a boost, give it a try, you’ll like it!

Jan 08

Gamification as a motivator

A new year brings along some new resolutions and goals. Last year I didn’t put up a lot of goals at the start (except for the GoodReads reading challenge). Picked up some guitar again and played around with some piano pieces but nothing big.

Let’s make a list of things that I’d like to achieve this year:

  • Being able to name the most important 150 or so countries in the world…
  • … and their capital
  • Improve my French and Spanish
  • Improve my guitar and piano skills

That’s.. a lot to achieve in one’s free time. But let’s disregard time for a second (pun somewhat intended).

Research has shown many people ditch their new year’s resolutions after one or two months as they become less and less motivated. One way I’ve found keeps the urge going is adding some element of play into the mix.

Introducing

  • DuoLingo – Learn plenty of languages for free, earn points, compete with friends and translate real life documents and articles to improve your language skills
  • Memrise – Learn basically anything you want, being focussed on languages, it’s  an easy platform to learn things from countries in the world to music notations
  • Yousician – Going from a total tonedeaf musician to a somewhat decent guitar/piano/ukelele player
  • Synthesia – Focused on piano, import any MIDI file from any song you like and start learning it in less than a minute

The first two websites are entirely free (Memrise does offer a Pro mode that enables some extra features but you don’t really need those). You can set daily goals, try to get a higer score than your peers, see your progress bar fill up, get poked by their mobile apps if you forget/skip a day, the list goes on.

The latter two are freemium, Yousician has a subscription based plan while Synthesia is a one-time purchase. Both get you started playing a musical instrument. While Synthesia allows you to learn songs you like for free, you’ll need to find decent quality MIDI files. It offers you no real guidance on how to play though (think Guitar Hero).
Yousician on the other hand tries to be your online music teacher with some instructional videos between musical pieces to master.

It doesn’t really matter what your goal is, if you can split it up into tiny bits that can show you you’re progressing on a daily or weekly basis your motivation won’t be dissipating as fast as before. A bonus one I’d like to mention is Habitica (formerly known as HabitRPG), where you get rewarded for doing (daily) chores or tasks you define yourself.

All applications/sites mentioned add some sort of gamification aspect (read: rewarding you with something) which makes the learning process less dull than staring at text or playing that piece of music over and over without any direct feedback that you’re making progress.

If you feel like giving up your resolution, try incorporating your goals into one of these services and see if it makes you more eager to achieve your goals, it sure does for me!

Jul 06

Test Management using TestLink – Pt IV

Continuing where we left off last time, let’s add an issue tracker to our management system. TestLink supports many popular issue tracking systems including Bugzilla, JIRA and Mantis. In this tutorial we’ll configure TestLink to use Mantis. First of all, download and install Mantis, check out any of the multitude of tutorials on the web if you run into trouble.

Once that’s done head over to the Issue Tracker Management section in TestLink. Hit create and give your tracker a name. Select the mantis (Interface: soap) type and paste the following configuration in the textbox:

<!-- Template mantis soap Interface -->
<issuetracker>
<username>administrator</username>
<password>root</password>
<uribase>http://localhost/mantis/</uribase>
<!-- IMPORTANT NOTICE -->
<!-- You Do not need to configure uriwsdl,uriview,uricreate -->
<!-- if you have done Mantis standard installation -->
<!-- In this situation DO NOT COPY these config lines -->
<uriwsdl>http://localhost/mantis/api/soap/mantisconnect.php?wsdl</uriwsdl>
<uriview>http://localhost/mantis/view.php?id=</uriview>
<uricreate>http://localhost/mantis/</uricreate>
<!-- Configure This if you want be able TO CREATE ISSUES -->
<project>YourProjectName</project>
<category>YourCategory</category>
<!-- Configure This if you want NON STANDARD BEHAVIOUR for considered issue resolved -->
<resolvedstatus>
<status><code>80</code><verbose>resolved</verbose></status>
<status><code>90</code><verbose>closed</verbose></status>
</resolvedstatus>
</issuetracker>

I’ve put things you probably need to edit to match your settings in bold.

We still need to activate the issue tracker integration for our project, you can do so on the Test Project Management page. Tick the box next to “Active” and select mantis from the dropdown. When you go to Execute Tests you can see BUG management with two links, one to link an existing bug/issue using its Mantis bug ID and a second to create a new issue in Mantis.

Version 1.9.13 of TestLink does not give you any feedback when you hit Save (aside from throwing errors when you don’t fill in a description). If the page does not refresh automatically, just click on the given test again and the linked bug will appear.

Issue Tracking

Issue Tracking

If you have several of these, there’s a nice little overview in the Reports and Metrics section as well.

Bug Report

Bug Report

Clicking any of the bugs will take you directly to its respective Mantis page. The input in TestLink is quite limited which means you probably want to add additional information regarding the issue in Mantis.

Thanks to the integration with an issue tracker you can quickly file bugs while you’re busy executing tests, reducing the chance you forget about an issue you’ve encountered. As an added bonus, TestLink will also store on what build you filed this bug so the developer who will try to fix it can trace it back to a specific point in time and try to recreate it.

We’re coming to a close very soon! Let’s see what we’ve got so far:

  1. Requirement tracing
  2. Test Case management
  3. Automatic execution of a Test Plan using Jenkins
  4. Issue Tracking using Mantis

With all of this you’ve already accomplished quite an extraordinairy amount of tracking and tracing! But what if you do not use Jenkins and still want automatic reporting of test results? Next time we’ll take a look at the Python module that can interface with TestLink’s API.