← Back to team overview

launchpad-dev team mailing list archive

Faster TDD cycle: persist test services between test runs


If you're into TDD, you're probably a bit annoyed about Librarian and
Memcached taking quite a while to set up and tear down when running the
tests, right? Well, these are things that we usually don't change, so
there's not much point in keep starting and stopping them every time you
run a test.

If you specify LP_PERSISTENT_TEST_SERVICES=1 in the environment (for
example in .bashrc), the Librarian and Memcached daemons won't be shut
down when the test run ends. And the next time you run a test, the test
harness will see that those services are running, and won't try to start
them again.

If you need to kill them, you can use bin/kill-test-services.

You can see that this work by making sure that it takes around 0 seconds
to set up and tear down LibrarianLayer and MemcachedLayer when running
bin/test -vv -t some-test.

Another good tips is to always specify. -m to the test runner. If you
run a test in lp.bugs for example, specifying -m lp.bugs will make the
test discovery much faster.

Björn Tillenius | https://launchpad.net/~bjornt

Follow ups