[Grok-dev] Stuck on unit/integration testing
Peter Bengtsson
peter at fry-it.com
Thu Feb 21 09:10:33 EST 2008
I've setup z3c.testsetup into my buildout and I can run ./bin/test.
In PeterbeLifeBlog/src/peterbelifeblog/tests.py I have this code::
import z3c.testsetup
test_suite = z3c.testsetup.register_all_tests('peterbelifeblog.app_tests')
And in PeterbeLifeBlog/src/peterbelifeblog/app_tests/test_something.py
I have the following code::
"""
Tests with real TestCase objects.
:Test-Layer: python
"""
import unittest
class TestTest(unittest.TestCase):
def setUp(self):
pass
def testFoo(self):
self.assertEqual(2, 1+1)
So far so good. How do I get started from here to write unit tests and
functional tests?
I want to import my application class and some other stuff from app.py
and run normal unit tests and I also want to write unit tests with Grok
up and running with an instance object in ZODB like I'm able to do in
zope2's ZopeTestCase with the self.app thing.
It feels like it's right there in front of my but I don't know how to
get started.
Besides, in my test_something.py I tried to do this:
from peterbelifeblog.app import SomeClass
but I keep getting ImportErrors even though the folder 'peterbelifeblog'
is in sys.path.
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Grok-dev
mailing list