diff options
author | Jonathan Lange <jml@canonical.com> | 2008-08-17 22:26:23 +1000 |
---|---|---|
committer | Jonathan Lange <jml@canonical.com> | 2008-08-17 22:26:23 +1000 |
commit | 2199429ab0b0864757e8f8e374f3cadfe63d53e3 (patch) | |
tree | 9bb301c9babd61b9d843c7d9c835d5747d732a5b /README | |
parent | 5b115544f4b94dd78319d71f9924689490b8ad2e (diff) | |
download | testresources-2199429ab0b0864757e8f8e374f3cadfe63d53e3.tar.gz |
README cleanups.
Diffstat (limited to 'README')
-rw-r--r-- | README | 48 |
1 files changed, 17 insertions, 31 deletions
@@ -1,31 +1,17 @@ - - testresources: extensions to python unittest to allow declaritive use - of resources by test cases. - Copyright (C) 2005 Robert Collins <robertc@robertcollins.net> +testresources: extensions to python unittest to allow declaritive use +of resources by test cases. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. +Copyright (C) 2005-2008 Robert Collins <robertc@robertcollins.net> +See LICENSE for more details. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -UnitResources is attempting to extend unittest with a clean and simple api to +testresources is attempting to extend unittest with a clean and simple api to provide test optimisation where expensive common resources are needed for test cases - for example sample working trees for VCS systems, reference databases for enterprise applications, or web servers ... let imagination run wild. -How UnitResources works: +How testresources works: ======================== -There are three main components to make UnitResources work: +There are three main components to make testresources work: 1) testresources.TestResource A TestResource is a object that tests can use, which provide a getResource() method that returns and object implementing whichever interface the client @@ -34,35 +20,35 @@ There are three main components to make UnitResources work: Commonly the TestResource will be a class, though that is not a requirement. Most importantly, two getResources with no finishedWith call in the middle, to the same TestResource, should return the same object. - XXX the same object requirement may not be needed - but for expensive + XXX the same object requirement may not be needed - but for expensive resources that is the optimisation goal. The goals for TestResources that cannot finish properly are not yet clear, so for now the behaviour will to silently continue. - See pydoc testresources.TestResource for details. + See pydoc testresources.TestResource for details. 2) testresources.OptimisingTestSuite This TestSuite will introspect all the test cases it holds directly and - if they declare needed resources, will run the tests in an order that - attempts to minimise the number of setup and tear downs required. + if they declare needed resources, will run the tests in an order that + attempts to minimise the number of setup and tear downs required. It attempts to achieve this by callling getResource() and finishedWith() around the sequence of tests that use a specific resource. OptimisingTestSuite has a new method over normal TestSuites: adsorbSuite(suite), which scans another test suite and incorporates all of - its tests directly into the OptimisingTestSuite. This allows for you to + its tests directly into the OptimisingTestSuite. This allows for you to optimise across as broad or small a collection of tests as you wish. - + 3) testresources.ResourcedTestCase - ResourceTestCase can be used as a base class for tests, and when that is + ResourceTestCase can be used as a base class for tests, and when that is done tests will have their _resources attribute automatically checked for resources by both OptimisingTestSuite and their own setUp() and tearDown() - methods. (This allows tests to remain functional without needing this + methods. (This allows tests to remain functional without needing this specific TestSuite as a container). Alternatively, you can call ResourceTestCase.setUpResources(self) and - ResourceTestCase.tearDownResources(self) from your own classes setUp and + ResourceTestCase.tearDownResources(self) from your own classes setUp and tearDown and the same behaviour will be activated. Do declare the use of a resource, set _resources as an attribute listing - tuples of attribute name, TestResource. During setUp self._attribute_name + tuples of attribute name, TestResource. During setUp self._attribute_name will be set to TestResource.getResource(), and finsh() will be called for you during tearDown(). |