Tuesday, September 2, 2008

Testing web site performance with Selenium - Setup HowTo for Ubuntu 08.04

I have been asked to create a web site performance test (not: load test), i.e. measure the duration of a specific clickstream in a controlled (no-load) environment.

This is how I got to a proof concept using Selenium and phpunit under Ubuntu 08.04.


  1. Install the packages:
    php5
    php5-pear


  2. Install phpunit and SeleniumRC:

    Download and untargz: http://selenium-rc.openqa.org/download.html

    Install PEAR module for accessing SeleniumRC:
    sudo pear install channel://pear.php.net/Testing_Selenium-0.4.3

    Install phpunit with PEAR:
    sudo pear channel-discover pear.phpunit.de
    sudo pear install phpunit/PHPUnit


  3. Create the test and place measurements:

    Record in SeleniumIDE and export as PHP. Insert something like:
    $start = microtime(true);
    // Test 1 here
    $end = microtime(true);
    echo ($end-$start) . ",";
    $start = microtime(true);
    // Test 2 here
    $end = microtime(true);
    echo ($end-$start) . ",\n";


  4. Configure the browser in your exported tests:

    At the time of this writing, Firefox 3 is not working out of the box with the PlugIns that SeleniumRC provides and requires. I installed Firefox 2 in parallel and changed the generated line
    $this->setBrowser("*chrome");
    to
    $this->setBrowser("*firefox /usr/lib/firefox/firefox-2-bin");
    in mytest.php

  5. Launch SeleniumRC:
    java -jar selenium-server.jar

    Edit: If you're testing an SSL server, adding the -avoidProxy option might save some trouble.

  6. Run your test:
    phpunit yourtest.php



The output would be single line of CSV. Of course this approach doesn't scale at all, and the implementation of Selanese waitFor-commands needs to be modified.

If you know of a more standardized way to record and analyze measurements, let me know. If there is nothing, this might be a nice enhancement for the SeleniumIDE export function.

Last edit: Changed phpunit-installation from package to PEAR

Wednesday, August 20, 2008

How Not To organize an Open Air concert for 3.000+ visitors

(Inspired by yesterday's visit to Eric Clapton on Bowling Green, Wiesbaden, Germany, Earth)

  1. Create different visitor areas for people with seat tickets at the front, stand tickets, and seat tickets at the back. Separate these areas with solid constructions, requesting visitors to show their ticket at each border and disallowing entrance for people with the wrong ticket category. Hey, there's restrooms in each area, even in yours! Just on the other side of that crowd!

  2. Create a separate entrance for each class of ticket holder. Plus, don't place any signs telling people what to do. After all, it's funny for 60-100 € paying customers to queue up for 20 minutes just to be told they found the wrong entrance. Isn't it?

  3. Don't care about sizing the grill or drink stations. People do like queues, don't they? And wouldn't more than 4 grill/drink people per 500 visitors impact the relaxed atmosphere?

Friday, August 1, 2008

X61s + T-Mobile UMTS

In case you're using a Lenovo X61s and wonder why you cannot connect to T-Mobile's UMTS service in Ubuntu 08.04, here's how you get there:

  1. Drivers are not an issue. Run lsusb and you'll see:

    ID 1199:6813 Sierra Wireless, Inc.

    Besides, lsmod | grep sierra should show:

    sierra 14468 0
    usbserial 35816 1 sierra
    usbcore 146028 5 sierra,usbserial,ehci_hcd,uhci_hcd


    And finally, you should have /etc/ttyUSB[0..2]


  2. Turn wireless on. First, the hardware switch (obviously). Secondly, open two consoles, run cat < /etc/ttyUSB0 on the first. Issue 'at!gstatus?' > /dev/ttyUSB0 on the second. You should see something like this:

    !GSTATUS:

    Current Time: 1312 Temperature: 51

    Bootup Time: 0 Mode: LOW POWER MODE
    ...

    Mode is important: If it's LOW POWER MODE, the UMTS LED on the case is off. To turn it on, issue echo 'at+cfun=1' > /dev/ttyUSB0 - the LED should turn on, Mode switches to ONLINE.


  3. Authorize. Check the PIN status using echo 'AT+CPIN?' > /dev/ttyUSB0 - if it says READY, proceed. +CPIN: SIM PIN means: issue your PIN with echo 'AT+CPIN=1234' > /dev/ttyUSB0


  4. Connect. Stop your cat < /etc/ttyUSB0-session beforehand. This chatscript (/etc/chatscripts/tmobile-connect) works for me:

    ABORT BUSY
    ABORT VOICE
    ABORT 'NO DIALTONE'
    ABORT 'NO DIAL TONE'
    ABORT 'NO ANSWER'
    ABORT DELAYED
    "" 'ATZ'
    OK 'AT+CGDCONT=1,"IP","internet.t-mobile"'
    ABORT 'NO CARRIER'
    OK 'ATD*99*1#'
    CONNECT \d


    ... and the wvdial (pppd)-config (/etc/ppp/peers/tmobile):

    /dev/ttyUSB0
    460800
    defaultroute
    usepeerdns
    nodetach
    crtscts
    lock
    noauth
    local
    debug
    connect "/usr/sbin/chat -v -f /etc/chatscripts/tmobile-connect"


    Connect by typing pon tmobile


Would be nice to see the power & PIN management in Ubuntu's network manager some day, wouldn't it?