BlueBream The Web Component Framework

9.10. Functional Testing

9.10.1. Introduction

In this chapter, you will learn more about functional testing. A doctest based package (zope.testbrowser) is used in BlueBream for functional testing. Unlike unit tests, functional tests are user interface (view) oriented.

9.10.2. zope.testbrowser

The central part of this package is a browser object. This create this object, import Browser class from zope.testbrowser.testing:

>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()

To learn the usage of package, first create a simple HTML page with following content:

    <title>Test Page</title>
    <h1>Test Page</h1>

To open a page:

>>> browser.url

9.10.3. Test layer

9.10.4. Running tests

Your test suites can be placed in module under each packages. By default, in BlueBream there will be a with one test suite created using z3c.testsetup:

import z3c.testsetup

test_suite = z3c.testsetup.register_all_tests('tc.main')

The z3c.testsetup will aut-recover test suites from doctest files. You can create your doctest files, similar to example given in README.txt:


:functional-zcml-layer: ftesting.zcml

Open browser and test::

  >>> from zope.testbrowser.testing import Browser
  >>> browser = Browser()
  >>> 'Welcome to BlueBream' in browser.contents

The fouth line specifies that a ZCML file named ftesting.zcml is required to setup the test layer.

To run the tests:

$ ./bin/test
blog comments powered by Disqus

Table Of Contents

Previous topic

9.9. Startup

Next topic

9.11. Skinning

This Page