• Funittest

last modified October 16, 2007 by maikroeder

Funittest Project


Funittest project home page

Miscellaneous

Presentation

PLIP:

Selenium Remote Control:
The Braidy Tester:
Article by Jennitta Andrea

Preparations

In order to make most of the sprint you should check out and get Funittest working for you before the sprint. Just follow the installation instructions in the Python module:

$ svn co https://svn.plone.org/svn/collective/funittest/trunk funittest
$ cd funittest
$ less README.txt

There is an interactive browser demo of Funittest available, which includes some tutorials. This makes use of Crunchy.

$ cd funittest/doc
$ python crunchy.py

Topics

  • Add use cases, tests, scenarios and verbs needed for your functional tests
  • Work on PLIP 100 in order to resubmit it for acceptance
  • functional test stack improvements
  • Upgrade to Crunchy 0.9.2

Participants (topics)



  • Maik Röder (functional test stack improvements)
  • Riccardo Lemmi (axaroth)
  • Emmanuel Masker
  • Frederic Tedesco
  • Jordan Baker (hexsprite) - buildout for seleniumRC, improvements to tutorial, glossary

Interested

...

In order to get you interested in Funittest, here is a quick demo


It all starts with a Use Case

    Registration of a new user to the Plone site

    Precondition

    1. Registration is allowed and user can choose password

    2. User is not yet registered

    Main scenario

    1. Access the registration form

    2. Fill in the registration form

    3. Submit the registration form

    4. Directly log in to the site
You define the steps of the main scenario calling the logical functional model
    def step_1(self):
logical.cmfplone.register.access(self._user)

def step_2(self):
logical.cmfplone.register.fill(self._user)

def step_3(self):
logical.cmfplone.register.submit(self._user)

def step_4(self):
logical.cmfplone.register.direct_login(self._user)
Your main scenario is expected to work ok:

    def scenario(self):
        """
        User registers
        """
        self.expect_ok(1,2,3,4)

You define the extension points that first fail, and then usually work ok:

    def scenario_3a(self):
        """
        User enters password different from the confirmation password
        """
        password = self._user['password']
        self._user['password']='differentfirstpassword'
        self.expect_ko(1,2,3)
        # Recover from the error by filling in the correct password this time
        self._user['password']=password
        self.expect_ok(2,3,4)
You define the logical functional model

    def access(self, user):
        physical.cmfplone.register.access(user)

    def fill(self, user):
        physical.cmfplone.register.fill(user)

    def submit(self, user):
        physical.cmfplone.register.submit(user)

    def direct_login(self, user):
        physical.cmfplone.register.direct_login(user)

You define the physical model
    def access(self, user):
interpreter.open('/join_form')

def fill(self, user):
forms = physical.cmfplone.forms.getForms()
form = forms.getFormByLocator("//form[@action='join_form']")
values = []
values.append( {'id':'fullname',
'value':user['fullname']} )
values.append( {'id':'username',
'value':user['id']} )
values.append( {'id':'email',
'value':user['email']} )
values.append( {'id':'password',
'value':user['password']} )
values.append( {'id':'password_confirm',
'value':user['password_confirm']} )
form.fillForm(values)

def submit(self, user):
interpreter.clickAndWait("form.button.Register")

def direct_login(self, user):
interpreter.annotate("Login after registration")
interpreter.clickAndWait("//input[@value='Log in']")
Verification is factored out.
    def submit(self, user):
element = "//dl[@class='portalMessage error']"
if interpreter.is_element_present(element):
interpreter.verifyNotVisible(element)
Interested?

Join the sprint and read the following articles:
Other resources that are interesting/related