Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home Topics tutorials
Navigation
 

tutorials

Nov 13, 2009

How to write funkload test in few minutes

by Andrew Mleczko — last modified Nov 13, 2009 04:50 PM

After PloneConf2009 I noticed interesting changes in collective.recipe.funkload. Right now writing a simple test for funkload is just few steps.

After Plone Conference 2009 I noticed interesting changes in collective.recipe.funkload and in collective.funkload itself. Right now writing a simple stress test for funkload is much easier - you can do it in few steps.

Let's start with creating a simple package called mytest:

$ ls ./mytest
boostrap.py buildout.cfg setup.py src

$ ls ./mytest/src/mytest
__init__.py tests

$ ls ./mytest/src/mytest/tests
__init__.py test_Simple.py Simple.conf

 

buildout.cfg is also simple:

[buildout]
develop = .
parts = funkload    

[funkload]
recipe = collective.recipe.funkload
url = http://www.plone.org
eggs = mytest


where www.plone.org is the url to the site you want to test (it doesn't need to be on you localhost)

Now the funkload test configuration file (Simple.conf):

[main]
title=Simple
label=Simple test for blog.redturtle.it
description=Simple test scenario

[test_Simple]
description=Simple test scenario

[ftest]
log_to = console file
log_path = Simple-test.log
result_path = Simple-test.xml

[bench]
cycles =  5:15:30
duration = 100
startup_delay = 2
sleep_time = 2
cycle_time = 2
log_to = file
log_path = Simple-bench.log
result_path = Simple-bench.xml
sleep_time_min = 2
sleep_time_max = 2


In this example most important bench configurations:

  • cycles = 5:15:30  - contains 3 cycles: for 5, 15 and 30 concurrent users
  • duration = 100 - duration of one cycle in seconds
  • startup_delay = 2 - time to wait between starting-up threads in seconds
  • sleep_time = 2 - time to wait between test in seconds
  • cycle_time = 2 - time to wait between cycle in seconds

And the funkload test scenario (test_Simple.py)

import unittest
from collective.funkload import testcase

class Simple(testcase.FLTestCase):
    """Simple load test scenario."""

    def setUp(self):
        """Setting up test."""
        self.logd("setUp")
        self.label = 'Simple test'
        self.server_url = self.conf_get('main', 'url')

    def test_ReadOnly(self):

        self.get(self.server_url + "/",
             description="Get /")

        self.get(self.server_url + "/login_form",
             description="Get /login_form")

        self.post(self.server_url + "/login_form", params=[
            ['came_from', self.server_url],
            ['form.submitted', '1'],
            ['js_enabled', '0'],
            ['cookies_enabled', ''],
            ['login_name', ''],
            ['pwd_empty', '0'],
            ['__ac_name', 'admin'],
            ['__ac_password', 'admin'],
            ['submit', 'Login']],
            description="Post for login a user /login_form")

        self.get(self.server_url + "/folder/document1",
            description="Get /folder/document1")

        self.get(self.server_url + "/logout",
            description="Get /logout")

    def tearDown(self):
        """Setting up test."""
        self.logd("tearDown.\n")

def test_suite():
    return unittest.makeSuite(Simple)

additional_tests = test_suite

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')

 

It's a very simple scenario in which we are:

  • opening plone site (get /)
  • opening login_form (get /login_form)
  • sending a post with login credentials (post /login_form)
  • opening a document (get /folder/document1)
  • logout (get /logout).

Now you need to bootstrap the buildout:

$ cd mytest
$ python bootstrap.py


lunch the buildout:

$ ./bin/buildout


and lunch the bench:

$ ./bin/funkload bench -t mytest.tests.test_Simple


final report you can find in your buildout directory:

$ ls ./var/funkload/reports/2009-11-11-19-40-20
test_Simple-20091111T194020

$ ls ./var/funkload/reports/2009-11-11-19-40-20/test_Simple-20091111T194020
funkload.css  index.html  index.rst  tests.data  tests.gplot  tests.png


For more information please check:

Oct 30, 2009

redturtle@ploneconf2009

by Massimo Azzolini — last modified Oct 30, 2009 09:50 AM

alcuni riferimenti ai talk che abbiamo tenuto alla plone conference in corso in questo momento

I talk presentati sono stati 2:

  1. Carneade, dar vita alle relazioni del mondo reale: Plone come gestore di organizzazioni
  2. collective.amberjack: Plone come piattaforma per i tutorial

Tutto il materiale è già in linea.

Carneade

  • La presentazione (su slideshare)
  • un video di presentazione del sistema (su youtube)
  • l'intero talk in streaming video (su ustream)

collective.amberjack

  • La presentazione (su slideshare)
  • un video di presentazione del sistema (su youtube)
  • l'intero talk in streaming video (su ustream)

Sep 03, 2009

NSD, il tuo compagno di viaggio quando Domino va in crash

by Fabio Pignatti — last modified Sep 03, 2009 03:05 PM

NSD (Notes System Diagnostic) è uno strumento Lotus per raccogliere informazioni a fronte di un crash o di un hang di sistema. Vediamo la sessione presentata durante DominoPoint Day 2008, l'evento italiano della comunità Lotus.

Tra qualche mese ci sarà il terzo appuntamento con il DominoPoint Day, ripartiamo da dove ci eravamo fermati: la sessione su NSD presentata nel 2008. Scarica la presentazione su Slide Share.

 Anteprima presentazione su Viddler.com

Aug 31, 2009

Amberjack on Plone: first steps

by Massimo Azzolini — last modified Aug 31, 2009 09:26 PM

collective.amberjack project just released the first tours

What's that?

A tutorial in action Amberjack is a tool that allows you to create tours on your site. The purpose of the collective.amberjack project is to improve its functionality and to provide a way for creating not just tours but something more: tutorials.

 

What does it provide?

The actual implementation provides 4 packages:

  • collective.amberjack.core
  • collective.amberjack.portlet
  • collective.amberjack.plonetour
  • collective.amberjack.metatour

collective.amberjack.core

This one contains all the basic functionalities:

  • it lets you add tours via ZCML,
  • it manages and validates tours and steps,
  • it draws the tour box and it manages all the UI interactions via javascript

collective.amberjack.portlet

this package provides two portlets:

  • a one shot tour portlet
  • a portlet with a set of tours

collective.amberjack.plonetours

this one contains the first released tours:

  • Add and publish a Folder
  • Add and publish a Page
  • Add and publish a News Item
  • Add and publish an Event
  • Format a page using the visual editor
  • Create internal links
  • Create external links
  • Upload an image
  • Insert image on a page
  • Using the Display menu

others will be released soon.

collective.amberjack.metatour

the idea is to provide a TTW way to create new tours. You can translate them via LinguaPlone and can be used by a non-technical user.

A next step is to export the TTW created tours as packaged that can be shared for example via pypi.

how simple adding a tour IS?

First of all you need to define the tour:

add_folder = {
    'url': u'/',
           'xpath': u'',
           'xcontent': u'',
           'title': _(u"Create a new folder"),
           'text': _(u"Folders are ..."),
           'steps': ({'description': _(u"Click the [Add new...] drop-down menu."),
                      'idStep': u'menu_add-new',
                      'selector': u'',
                      'text': u''},
                     {'description': _(u"Select [Folder] from the menu."),
                      'idStep': u'new_folder',
                      'selector': u'',
                      'text': u''})}

ajTour = {'tourId': u'basic01_example',
          'title': _(u'Add a Folder'),
          'steps': (add_folder,
                   )}

then you have to register it

<collective.amberjack:tour
        tourdescriptor=".example_tour.ajTour"
        />

If you need a complete example, please refer to the code.

Where can I find infos and code?