Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Robot Framework for Plone

Robot Framework

Standalone

pip install robotframework

test_hello.robot

*** Settings ***

Library  Dialogs

*** Variables ***

${CORRECT_ANSWER}  42

*** Test Cases ***

Ask the ultimate question
    ${answer} =  Get value from user
    ...          How much is the fish?
    Should be equal  ${answer}  ${CORRECT_ANSWER}

pybot-testrunner

pybot test_hello.robot
==================================
Ask the ultimate question | FAIL |
1 != 42
----------------------------------

User keywords

Ask the ultimate question
    ${answer} =  Ask the question
    Check the answer  ${answer}

*** Keywords ***

Ask the question
    ${answer} =  Get value from user
    ...          How much is the fish?
    [return]  ${answer}

Check the answer
    [arguments]  ${answer}
    Should be equal  ${answer}  ${CORRECT_ANSWER}

With Mockup

pip install robotframework-selenium2library
python -m SimpleHTTPServer
pybot test_mockup.robot

With Plone

testing.py

from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import FunctionalTesting
from plone.testing import z2

PLONE_ROBOT_TESTING = FunctionalTesting(
    bases=(PLONE_FIXTURE, z2.ZSERVER_FIXTURE),
    name="Plone:Robot"
)

# (this is plone.app.testing.PLONE_ZSERVER)

test_plone.robot

*** Settings ***

Resource  plone/app/robotframework/selenium.robot

Test Setup  Open test browser
Test Teardown  Close all browsers

*** Test Cases ***

I see Plone
    Go to  ${PLONE_URL}
    Page should contain  Powered by Plone

Buildout

[robot]
recipe = zc.recipe.egg
eggs =
    Pillow
    ${test:eggs}
    plone.app.robotframework[reload]

robot-server

bin/robot-server plone.app.testing.PLONE_ZSERVER

can reload your code

robot

bin/robot hello-plone.robot

supports test isolation

test_robot.py

import unittest

import robotsuite
from plone.app.testing import PLONE_ZSERVER
from plone.testing import layered


def test_suite():
    suite = unittest.TestSuite()
    suite.addTests([
        layered(robotsuite.RobotTestSuite('test_hello.robot'),
                layer=PLONE_ZSERVER),
    ])
    return suite

Extras

Auto-Login

test_autologin.robot

*** Settings ***

Resource  plone/app/robotframework/selenium.robot

Library  Remote  ${PLONE_URL}/RobotRemote

Test Setup  Open test browser
Test Teardown  Close all browsers

*** Test cases ***

Contributor cannot access control panel
    Enable autologin as  Contributor
    Go to  ${PLONE_URL}
    Click link  css=#user-name
    Element should not be visible  css=#personaltools-plone_setup

testing.py

from plone.app.testing import PLONE_ZSERVER
from plone.app.testing import FunctionalTesting
from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE

AUTOLOGIN_ROBOT_TESTING = FunctionalTesting(
    bases=(AUTOLOGIN_LIBRARY_FIXTURE, PLONE_ZSERVER),
    name="AutoLogin:Robot"
)

SauceLabs

*** Settings ***

Resource  plone/app/robotframework/selenium.robot
Resource  plone/app/robotframework/saucelabs.robot

Test Setup  Open SauceLabs test browser
Test Teardown  Run keywords  Report test status  Close all browsers

https://saucelabs.com/u/parobotframework

Robot Framework IDE

[robot]
recipe = zc.recipe.egg
eggs =
    Pillow
    ${test:eggs}
    plone.app.robotframework[ride,reload]

/usr/bin/python bin/ride

See also: http://openetherpad.org/9w0hiLR8kI