Cloud TDD: save $4k, time, & do eXtreme Programming anywhere

The Problem

The problem: whether your workload is one of Test-Driven Development (TDD) (Beck, 2003) or test && commit || revert (TCR) (Beck, 2018), after making serious progress, there are going to be thousands of unit tests that must be run every time work is saved. On an old laptop, you might have to wait quarters of an hour, and on a better laptop, minutes, slowing software development progress down to a crawl.

Old Solutions and Copes

Throw Money at the Problem

Until now, throwing money at the problem was probably the most straightforward solution. If you could finance a laptop with more, faster processors, tests could be batched and the time it took to run them all would drop fast. Procuring a faster, desktop computer would lead to even more bang for the buck than a laptop, at the cost of portability.

Delay Testing

An obvious solution is to stop testing upon every change to the codebase and wait until a few hours, a shift, or a week of development were done. This is hardly ideal as the odds of painting yourself into a corner or getting lost in the woods go up exponentially. Tests must always be green (i.e. passed), or sooner or later someone will make a well-intentioned wrong turn and you will lose days, weeks, or months of productivity.

New Solution: the Cloud

For pennies, you can run all your regression tests in the cloud from a modest laptop. In this example, we use GitHub’s CodeSpaces cloud development environment to run about ten thousand regression tests ensuring correct translations between Polish and Lemko (a.k.a. “Rusyn”), an endangered language of Southwestern Ukrainian genetic origin indigenous to Poland and Slovakia (Hungary). Watch as running the regression suite drops to 8 seconds.

Walkthrough

1. Sign up for a Codespaces account on GitHub

Here is a link: https://github.com/features/codespaces

2. Increase your budget to at least a dollar

As a safety mechanism, the initial budget is set to zero and to get serious power you’re going to need to have a non-zero budget. At press time, the most powerful system costs USD 2.88 per hour, and so as little as a dollar is fine to get started.

3. Open your Repository in CodeSpaces

On your code repo, click the big green Code button, ensure the CodeSpaces tab is open, click the ellipsis (three dots…), and select “New with Options” to Create a code space. Go hard with processors and pick the maximum available (probably 16).

4. Open your CodeSpace in Visual Studio Code (!)

In the CodeSpaces menu, click the open in Visual Studio Code button.

5. To get up to 36 cores, file a support request

Questions? Ask in the comments below.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.