[TIP] using unittest for other tasks

Ben Finney ben+python at benfinney.id.au
Wed Jul 24 17:37:44 PDT 2013

Rita <rmorgan466 at gmail.com> writes:

> I know that unittest is great for testing code.

More specifically, unittest is great for unit testing: isolating a small
unit of code and testing whether it gives expected outputs for given

> I was wondering if anyone is using it to test system consistency. I
> manage several hundred systems and I am currently using Nagios

I think Nagios is more for monitoring, not automated testing. Is that
not correct?

> but instead I was wondering if unittest would be OK for something like
> this.

For testing system behaviour, the unittest module is a poor fit since it
is designed to test isolated units of code at the function-call level.

You would do better to look at behavioural testing tools, like Behave
<URL:https://pypi.python.org/pypi/behave> that can work from assertions
about the behaviour of the whole system.

 \       “We must find our way to a time when faith, without evidence, |
  `\    disgraces anyone who would claim it.” —Sam Harris, _The End of |
_o__)                                                     Faith_, 2004 |
Ben Finney

More information about the testing-in-python mailing list