ViewTests

Not logged in - Log In / Register

This page offers some details about writing unit tests for the view layer.

Investigating View errors

Sometimes the errors reported by ZOPE and TAL are not very comprehensive. An AttributeNotFound error can be triggered by a bunch of reasons.

To help investigating this problems you should write unit tests and use pdb for seeing what goes wrong.

Below is an example using iharness:

make iharness
> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
> from lp.translations.browser.distroseries import DistroSeriesTemplatesView
> # Create a view
> view = DistroSeriesTemplatesView(hoary, LaunchpadTestRequest())
> view.initialize() # trigger the view attributes initialization
> # Now you can access the view attributes in the same way as TAL
> print view.label


CategoryTesting

ViewTests (last edited 2010-07-14 12:44:14 by adiroiban)