<commit_before>---
layout: post
title: Distributed Test Execution with Go + TLB
status: public
type: post
published: true
author: Go Team
---

Writing tests has become the norm. Consequently, running tests for every commit is central & the most time consuming activity in any CI/CD setup. In a decent-sized production quality project you tend to have thousands of tests. That means the cycle time, i.e. the time it takes for a commit to reach deployable state (after running all unit, integration & functional tests), keeps growing.

It gets harder when teams follow XP related practices like "small commits, frequent commits" since it causes parallel builds & resource starvation.

One such example is Go's codebase. Just the "Common" & "Server" components of Go which comprises of unit & integration tests, together has ~6000 tests which will take about *~5 hours* if run serially! The functional test suite is about 260+ tests with combined runtime of *~15 hours*. That's close to a day & we haven't even run everything for a single commit!

Note that the number of tests is soo huge that just putting in a powerful box & running test in parellel will not bring it down to acceptable limits.

## Solution [Go + TLB]

Go improves the cycle time of its own build by making test execution faster, distributing it across many agents (machines). After this "Common" + "Server" takes *20 minutes*. All functional tests run in *45 minutes*. Thats close to an hour! Still not ideal (a few minutes), but better. :)

### Test Load Balancer (TLB)

[TLB](http://test-load-balancer.github.io) is a library which provides the ability to break up a test suite into pieces and run a part. It garantees 'Mutual Exclusion' & 'Collective Exhaustion' properties that are essential to reliably running tests in distributed fashion.

Note: As of this writing, TLB integrates with JUnit (through Ant, Maven & Buildr), RSpec (through Rake), Cucumber (through Rake), Twist (through Ant & Buildr).

#### Quick Setup

[Download](https://code.google.com/p/tlb/downloads/detail?name=tlb-complete-0.3.2.tar.gz&can=2&q=) TLB<commit_msg>Blog: Distributed test execution with Go + TLB. update - 6<commit_after>---
layout: post
title: Distributed Test Execution with Go + TLB
status: public
type: post
published: true
author: Go Team
---

Writing tests has finally become the norm. Consequently, running tests for every commit is central to & the most time consuming activity in any CI/CD setup. In a decent-sized production quality project you tend to have thousands of tests. That means the cycle time, i.e. the time it takes for a commit to reach deployable state (after running all unit, integration & functional tests), keeps growing.

It gets harder when teams follow XP related practices like "small commits, frequent commits" since it causes parallel builds & resource starvation.

One such example is Go's codebase. Just the "Common" & "Server" components of Go which comprises of unit & integration tests, together has ~6000 tests which will take about *~5 hours* if run serially! The functional test suite is about 260+ tests with combined runtime of *~15 hours*. That's close to a day & we haven't even run everything for a single commit!

Note that the number of tests is soo huge that just putting in a powerful box & running test in parellel will not bring it down to acceptable limits.

## Solution [Go + TLB]

Go improves the cycle time of its own build by making test execution faster, distributing it across many agents (machines). After this "Common" + "Server" takes *20 minutes*. All functional tests run in *45 minutes*. Thats close to an hour! Still not ideal (a few minutes), but better. :)

### Test Load Balancer (TLB)

[TLB](http://test-load-balancer.github.io) is a library which provides the ability to break up a test suite into pieces and run a part. It garantees 'Mutual Exclusion' & 'Collective Exhaustion' properties that are essential to reliably running tests in distributed fashion.

Note: As of this writing, TLB integrates with JUnit (through Ant, Maven & Buildr), RSpec (through Rake), Cucumber (through Rake), Twist (through Ant & Buildr).

#### Quick Setup

[Download](https://code.google.com/p/tlb/downloads/detail?name=tlb-complete-0.3.2.tar.gz&can=2&q=) TLB
{'fraction_non_alphanumeric': 0.0749063670411985, 'fraction_numerical': 0.008661048689138577, 'mean_word_length': 4.499356499356499, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2008871', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1087, 'n_words': 625}