Fixing Sporadically Failing Specs

When developing things with a large suite of unit tests or automated specifications, inevitably tests that actually pass fail for some reason. More difficult is the case where the test or spec fails only intermittently. I’ve taken the approach of late to keep a file around that records when I run into a problematic spec. When I get to five times that the spec failed, it’s time to refactor it to be less troublesome.

The first thing I check is to look at the spec and the code it executes and ensure that I think nothing is actually broken. Next, I ensure that the spec is actually adding value. If it’s slightly broken and is actually useless, we might as well get rid of it now and not spend more time on it. Generally though, the functionality of a sporadically failing test will be correct, and the spec will add some value.

Read on →

Run Local Scripts on Heroku

In order to run an arbitrary script on Heroku, you can use the Heroku console. They state that “you can use heroku console as a stand-in for Rails’s script runner”, but one key component of the script runner is that you can run files. You can run files in your git repository that are deployed to the instance that you want to run them on by using the method advocated by Steve Wilhelm.

What if the file is not checked in or you need to make rapid modifications for prototyping? If you have a lot of code that you want to write and you want to be able to easily modify it, try the solution below. Manually typing in many multi-line statements at the console (and retyping when you make an inevitable mistake) is frustrating.

Read on →

How to Run A Successful Brown Bag System

Software Engineering Professionals has a brown bag system that has been going on for over a year now. This post will describe how this successful system works.

Overview

Brown bags (also known as ‘lunch and learns’) are a great way to spread knowledge among coworkers. They are a way for managers and employees to present on topics they are interested in. As the name suggests, brown bags are held during lunch. People bring their own lunches, and kill two birds with one stone by learning and eating at the same time. Presentations or fishbowls are generally the formats of choice.

I think the biggest benefits of a well-run brown bag system are:

Read on →

Redundant Communication Redundancy

I’m sorry I wrote such a long letter. I did not have the time to write a short one.

Abraham Lincoln

For a long time, I strove to be efficient in communication. I would carefully consider the right words for things, especially when writing. But I realize now that good communication should have some redundancy.

Most of the time, the point of communicating is to convey information. Of course, there are other reasons people might converse. Redundancy is nice because it gets the message across eventually. Communication is inherently a very lossy channel.

Read on →

Show Git Version a Heroku Repository Is Using

I tried git show and git log, but these operate on the local repository and defined remotes. In order to see what git treeish your Heroku repo is using, try:

$ git ls-remote git@heroku.com:APP-NAME.git
97ec101adde21cfaf7f8c3ed47656e  HEAD
97ec101adde21cfaf7f8c3ed47656e  refs/heads/master

To find out the Heroku git repository name, you can also try

Read on →