Author: tziade
Date: Thu Mar 23 01:03:21 2006
New Revision: 2695

translated recipe 51 (fr->en)

Modified: cookbook/trunk/recipe51.en.tex
--- cookbook/trunk/recipe51.en.tex      (original)
+++ cookbook/trunk/recipe51.en.tex      Thu Mar 23 01:03:21 2006
@@ -3,17 +3,121 @@
 \author{Tarek Ziad�}
+\translator{Tarek Ziad�}
 \chapter*{Recording a user web session to write tests}
-Not translated in english yet.
+Writing a functional test is most of the time driven by a precise user story,
+where all steps are made with the provided user interface. For Zope, the
+interface is most of the time the browser.
+Coding a full user web session can be a real pain.
+This recipe presents how to record browser activities and use it back, in order
+to speed up functionnal test writing.
-Not translated in english yet.
+\section*{Knowing about the package}
+Zope 3 provides \code{}, wich let the developer add a special
+publisher, configured through \code{zope.conf}. This publisher acts like a
+proxy and record user actions over the browser. The problem is that its output
+are a bit raw to use and must be worked out. The extra workload to make it
+usable for \code{zope.testbrowser} can be quite long.
+\section*{Using zope.testrecorder}
+Zope Corp has created another package, called \code{zope.testrecorder}, which
+provides the same kind of features, but with output in convenient forms:
+\item \code{Python Doctest}, usable as is for \code{zope.testbrowser};
+\item \code{Selenium Test}, usable with \code{Selenium} tool.
+The tool is not part of Zope 3, and must be downloaded separately. There are
+neither website nor packaged distribution yet. The source code has to be taken
+from's subversion repository, and placed into the \code{/lib/python}
+directory of the instance.
+\codetitle{Getting zope.testrecorder from subversion}
[EMAIL PROTECTED]:~$ cd /home/zopes/zope3/lib/python/
[EMAIL PROTECTED]:/home/zopes/zope3/lib/python$ svn co 
svn:// testrecorder
+A    testrecorder/html
+A    testrecorder/html/recorder.js
+A    testrecorder/
+R�vision 65919 extraite.
+The package is then hooked to Zope by adding a initialization file, called
+\code{testrecorder-configure.zcml}, and placed into the
+\code{etc/package-includes} directory of the instance, with the content below.
+\codetitle{testrecorder-configure.zcml file}
+<include package="testrecorder" />
+When Zope is restarted, a new resource directory called \code{recorder} is made
+available, and points over the \code{html} directory of the package.
+\subsection*{Recording a session}
+After the installation is done, \code{testrecorder} is reachable through
+\url{/@@/recorder/index.html}. This page presents a banner where the initial
+URL to visit can be typed to start a session recording. The page appears
+under the banner and the tester can start a session recording by clicking
+The \code{Stop Recording} button finishes the session recording.
+\includegraphics[bb=0 0 302 270]{media/recipe51.screenshot1.png}
+% recipe51.screenshot1.png: 72.009dpi, width=10.65cm, height=9.52cm, bb=0 0 
302 270
+\legend{zope.testrecorder at work}
+\subsection*{Getting back results}
+When the session is done, \code{testrecorder} provides two types of outputs.
+The \code{Python Doctest} one is the most used since it can be used as is in
+a Python doctest.
+\codetitle{An output sample:}
+Doctest generated Sun Mar 12 2006 17:07:22 GMT+0100 (CET)
+Create the browser object we'll be using.
+    >>> from zope.testbrowser import Browser
+    >>> browser = Browser()
+    >>>'http://localhost/')
+    >>> browser.getLink('++etc++site').click()
+    >>> browser.getLink('[top]').click()
+    >>> browser.getLink('Folder').click()
+    >>> browser.getControl(name='new_value').value = 'MyFolder'
+    >>> browser.getControl('Apply').click()
+    >>> browser.getLink('MyFolder').click()
+    >>>'http://localhost/')
+    >>> browser.getLink('[top]').click()
+    >>> browser.getLink('Folder').click()
+    >>> browser.getControl(name='new_value').value = 'test'
+    >>> browser.getControl('Apply').click()
+    >>> browser.getLink('test').click()
+This piece of Python code can be taken back and modified, to add some
+assertions over the pages for examples.

Modified: cookbook/trunk/recipe_list.txt
--- cookbook/trunk/recipe_list.txt      (original)
+++ cookbook/trunk/recipe_list.txt      Thu Mar 23 01:03:21 2006
@@ -67,7 +67,7 @@
 50 - organizing tests in a package  (TZ)
 51 - finding the good pace between coding, documenting, unit testing and
      functional testing  (TZ)
-52 - recording a user web session to write tests  (TZ)
+52 - recording a user web session to write tests  (TZ), (fr->en:TZ)
 53 - organizing the code in a package  (TZ)
 54 - using ldap to store users
 55 - using a sql database to store data

Reply via email to