Skip to content

Supybot Website

Sections
Personal tools
You are here: Home » Documentation » Supybot Help Center » Tutorials » Advanced Plugin Testing » Other Tests

Other Tests

Document Actions
If you had to write helper code for a plugin and want to test it, here's how.

Strike

The complete guide to writing tests for your plugins.
Page 4 of 4.

Previously we've only discussed how to test stuff in the plugin that is intended for IRC. Well, we realize that some Supybot plugins will require utility code that doesn't necessarily require all of the overhead of setting up IRC stuff, and so we provide a more lightweight test case class, SupyTestCase, which is a very very light wrapper around unittest.TestCase (from the standard unittest module) that basically just provides a little extra logging. This test case class is what you should use for writing those test cases which test things that are independent of IRC.

For example, in the MoobotFactoids plugin there is a large chunk of utility code dedicating to parsing out random choices within a factoid using a class called OptionList. So, we wrote the OptionListTestCase as a SupyTestCase for the MoobotFactoids plugin. The setup for test methods is basically the same as before, only you don't have to define plugins since this is independent of IRC.

You still have the choice of using setUp and tearDown if you wish, since those are inherited from unittest.TestCase. But, the same rules about calling the setUp or tearDown method from the parent class still apply.

With all this in hand, now you can write great tests for your Supybot plugins!

Created by Strike
Contributors : Strike
Last modified 02:17 December 06, 2005
 

Powered by Plone

This site conforms to the following standards: