Category Archives: Ruby on Rails

Product moving parts as source for test strategy

Reading Time: 2 minutes

In this post I will explain how I identify product moving parts (what changed in product) as a source for test strategy of product release.

Tools that I am using are Github and Huboard. Everybody knows github, and huboard is application that integrates with Github and creates Kanab board automatically from Github issues. The glue between Kanab and Github are Github labels. Github label assigned to the issue puts that issue in Huboard list.

What are tools if they are not used by humans. Every issue could be an issue or new feature. Their body should contain text that help me to understand what should be implemented. No help of tools if that body is poorly written.

Every huboard issue is connected with Github pull request. Pull request contains all files that are related with that issue. By investigating github pull request, I am identifying product moving parts.

As the application context is Rails application, pull request contains application and data (database migration files) changes. As rails uses MVC pattern, this helps a lot how to direct my testing. For example, if change is in view, controller or model file, I know which feature and scenarios I should test.

If change is in helper file, by searching the codebase for the changed method, I can also identify features that should be tested.

Rails has rake tasks, which are also under github control. If there is change in rake tasks, I know that some scripts should be run in order to prepare environment for the new feature (for example, populate database with static data).

What are the benefits of this ability to identify product moving parts? I do not need to run single browser automation test!

All the testing is done using my brain, eyes, hands and browser.

Browser automation tests are usually developed as part of regression tests. We often hear: “We are running our cucumber tests to be sure that nothing is broken”.

This is not good practice. This is like putting patient again and again through x rays to be sure that he does not have pneumonia. But asking patient questions about his physical conditions can give as quick answer about possible pneumonia.

Instead of putting hours of work in creating scripts for browser automation, try to organize your project  to have:

  • code base under git
  • use kanab boards
  • use branches
  • learn basics how product code is organized (MVC in Rails)
  • learn basic about programming language that is used (Ruby in Rails)


Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

How to smart test minor version Ruby on Rails upgrade?

Reading Time: 1 minute


In this post I will explain what should be checked after Ruby on Rails minor version upgrade. Minor version upgrades are usually connected with security releases.

As I am subscribed to Ruby on Rails security Google group, when I receive information about latest security issue, I need to act very fast. Update must be pushed to production almost immediately, so there is no time for extensive regression testing.

How can we do quick test and be sure that everything still works as before upgrade?

Heuristic 1. Rails upgrade was extensively regression tested.

That heuristic proved itself to be always true.

Heuristic 2. Inspect Gemfile.lock to be sure that only Rails gem is upgraded.

How do we actually upgrade Ruby on Rails?

Edit gemfile:gem 'rails', ''
bundle update rails

Investigate Gemfile.lock changes using git diff to see what else was updated beside Rails. If some other gem (not part of Rails) was also updated, check, using Google search, possible issues for that gem that are connected with Rails upgrade.

Heuristic 3. Search Google for Ruby on rails upgrade to n.n.n.n version issues (bugs, problems)


For minor Ruby on Rails upgrades, using those three heuristics, you can do regression test in smart and quick way.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Simulating time in Ruby on Rails

Reading Time: 1 minute


In this post I will provide an example why Ruby on Rails is great framework that has testability in its core design.

Time is a measure in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. Time is often referred to as the fourth dimension, along with the three spatial dimensions [source: Wikipedia].

When tester needs to test time related features, he needs to become time traveler. Ruby on Rails has very interesting time machine. It consists of Rails console and panel that helps you to set in which direction you are traveling.

Using that time machine, you can easily simulate time lapses. For example, using UI interface, you created one business object. Features says that email about this object should be sent after one week. What is easier, setting the machine system time, or simulate that time lapse in Ruby console? Here is gist:

Instead of setting system time one week in the future, we updated object time to be one week in the past. Notice plain english for setting created_at parameter! Refer to [direction you are traveling] link for more time calculation idioms.

Congratulations on your first time travel in Ruby on Rails framework!

But I am not using Ruby on Rails framework! Do not worry, by knowing Rails time machine, consult your developer does his framework has something similar.



rails console

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather