BeakerLib Newsletter #01: Basics

Dear QE colleagues,

this is the first of the series of newsletters about BeakerLib, the
shell testing library. The newsletter purpose is
to browse BeakerLib, feature by feature. Some features are well-known,
but some are not: by skimming the newsletters, you might discover some
trick you missed so far, or a feature which might make your test writing
life easier. I intend to send a letter every two or three weeks.

What is BeakerLib

We describe BeakerLib as a shell-level integration testing library. It
was created by Red Hat QE to make our test writing easier by:

  •  More declarative elements in tests
  • Unified test structure
  • Dealing with different impact of setup and test failures
  • Provide a machine-readable test output
  • Provide unified, nice, human-readable test log
  • Provide a library of helpers for common testing tasks
  • Easier collaboration by providing a shared language subset

If you are writing tests for Beaker, you have probably met BeakerLib:
it’s the thing providing all those rlSomething commands.

Most FAQ: Why shell?

Because we do mostly operating system-level integration testing. We
create and delete files, run different programs, analyze their result
and output, run and stop daemons. In short, we control the operating
system. Not many things can beat shell in this job.

BeakerLib itself is a public open source project [1]. We try to have as many things as possible in this part. It is distributed in beakerlib RPM in Fedora.

Different BL pieces

There are several types of useful stuff in BeakerLib:

  • Test harness: Basic stuff like logging, asserting conditions hold, and reporting results to upper level harness.
  • Utilities: Functions doing useful tasks, like backing up and restoring files, obtaining environment information, and the like.
  • Journal: Logging back-end storing information about what is happening during the test.
  • Watcher: New stuff. Automatic cleanup after a test is killed by Beaker watchdog, or terminated with Ctrl-C. Not released yet. Stay tuned for more information.
  • Libraries: A support for test code sharing, lack of which was a pain with Beaker tests in the past.

More resources

BeakerLib has a man-page:

$ man beakerlib

Next time: BeakerLib phases

Links

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.