Physical Object Model tutorial

The Logical Functional Model typically calls methods of the Physical Object Model that implement the interactions with the user interface.

The Physical Object Model really is needed, because otherwise the Logical Functional Models would get into too much low level detail, and also because they facilitate and encourage reusing code.

If you have the impression that you can do without Physical Object Models, chances are that you are right in the beginning. Sometimes it can be easier to start out a functional test using low level calls, refactoring code out to the Logical Functional Model later, and finally, if a chance for reuse is becoming evident, the code may be better assembled in a Physical Object Model.

Logging in to a Plone site

Let's login to the Plone site using the Physical Object Model:

from funittest import interpreter
from funittest import physical
interpreter.start()
interpreter.open("/")
physical.cmfplone.application.login({'id':'admin','password':'admin'})