॥ स्वक्ष ॥

To content | To menu | To search

Tag - QA-TDD

Entries feed

2010 July 25 [Sunday]

Selenium RC and Python client

Selenium is quite a famous testing tool and has a lot of documentation so I wont bother to repeat stuff from there, rather just focus on the bits where I feel the documentation could improve.

STEP#0.  After downloading selenium remote-control change to the directory where you extracted it. {Btw, to install selenium on your local machine, download selenium from here.}

~$ cd selenium-remote-control-1.0.3/
~/selenium-remote-control-1.0.3/selenium-server-1.0.3$ sudo java -jar selenium-server.jar
09:03:05.618 INFO - Java: Sun Microsystems Inc. 1.6.0_0-b11
09:03:05.638 INFO - OS: Linux 2.6.24-28-generic i386
09:03:05.722 INFO - v2.0 [a2], with Core v2.0 [a2]
09:03:06.304 INFO - RemoteWebDriver instances should connect to: http://192.168.1.5:4444/wd/hub
09:03:06.307 INFO - Version Jetty/5.1.x
09:03:06.311 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
09:03:06.324 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:03:06.324 INFO - Started HttpContext[/,/]
09:03:06.381 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@12d15a9
09:03:06.382 INFO - Started HttpContext[/wd,/wd]
09:03:06.399 INFO - Started SocketListener on 0.0.0.0:4444
09:03:06.400 INFO - Started org.openqa.jetty.jetty.Server@228a02

I wanted to run the python script from the console and each time it would stop here and I'd be waiting and nothing would happen.....How do I run the script without a command prompt. So then, I'd interrupt it with 'ctrl C' to get a  "09:03:17.439 INFO - Shutting down...12:39:08.573 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]

That "shutting down" message was odd -- how would you run a process if it was shutting down? What the logs above dont say is "The selenium server must be running so keep that process open. Open ANOTHER terminal window and run your python script there". The documentation didnt explicitly mention that localhost must keep the server running in the background-- Its one of the most basic client-server concepts but when you are running stuff on localhost, your client and server are one and the same. Being explicit with this trivia in the documentation would have helped me not waste hundreds of hours searching the selenium website and reading irrelevant blogs which google threw up, irc, emails, etc... So, in TerminalOne,


:~/selenium-remote-control-1.0.3/selenium-server-1.0.3$ sudo java -jar selenium-server.jar
09:03:05.618 INFO - Java: Sun Microsystems Inc. 1.6.0_0-b11
09:03:05.638 INFO - OS: Linux 2.6.24-28-generic i386
09:03:05.722 INFO - v2.0 [a2], with Core v2.0 [a2]
09:03:06.304 INFO - RemoteWebDriver instances should connect to: http://192.168.1.5:4444/wd/hub
09:03:06.307 INFO - Version Jetty/5.1.x
09:03:06.311 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
09:03:06.324 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:03:06.324 INFO - Started HttpContext[/,/]
09:03:06.381 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@12d15a9
09:03:06.382 INFO - Started HttpContext[/wd,/wd]
09:03:06.399 INFO - Started SocketListener on 0.0.0.0:4444
09:03:06.400 INFO - Started org.openqa.jetty.jetty.Server@228a02
09:03:17.439 INFO - Shutting down...
mom@drga:~/selenium-remote-control-1.0.3/selenium-server-1.0.3$ sudo java -jar selenium-server.jar
09:03:36.248 INFO - Java: Sun Microsystems Inc. 1.6.0_0-b11
09:03:36.252 INFO - OS: Linux 2.6.24-28-generic i386
09:03:36.270 INFO - v2.0 [a2], with Core v2.0 [a2]
09:03:36.486 INFO - RemoteWebDriver instances should connect to: http://192.168.1.5:4444/wd/hub
09:03:36.489 INFO - Version Jetty/5.1.x
09:03:36.491 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
09:03:36.493 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:03:36.493 INFO - Started HttpContext[/,/]
09:03:36.523 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@12d15a9
09:03:36.523 INFO - Started HttpContext[/wd,/wd]
09:03:36.533 INFO - Started SocketListener on 0.0.0.0:4444
09:03:36.533 INFO - Started org.openqa.jetty.jetty.Server@228a02
09:04:30.236 INFO - Checking Resource aliases
09:04:30.260 INFO - Command request: getNewBrowserSession[*firefox, http://localhost:4444, ] on session null
09:04:30.283 INFO - creating new remote session
09:04:30.614 INFO - Allocated session 7cba6a7dadb243618c046ee7fb6c6bc9 for http://localhost:4444, launching...
09:04:30.778 INFO - Preparing Firefox profile...
09:04:34.676 INFO - Launching Firefox...
09:04:38.697 INFO - Got result: OK,7cba6a7dadb243618c046ee7fb6c6bc9 on session 7cba6a7dadb243618c046ee7fb6c6bc9
09:04:38.715 INFO - Command request: open[/selenium-server/tests/html/test_click_page1.html, ] on session 7cba6a7dadb243618c046ee7fb6c6bc9
09:04:38.854 INFO - Got result: XHR ERROR: URL = http://localhost:4444/selenium-server/tests/html/test_click_page1.html Response_Code = 404 Error_Message = Not+found on session 7cba6a7dadb243618c046ee7fb6c6bc9
09:04:38.863 INFO - Command request: testComplete[, ] on session 7cba6a7dadb243618c046ee7fb6c6bc9
09:04:38.863 INFO - Killing Firefox...
09:04:38.933 INFO - Got result: OK on session 7cba6a7dadb243618c046ee7fb6c6bc9
09:09:28.085 INFO - Command request: getNewBrowserSession[*firefox, http://www.irian.at, ] on session null
09:09:28.086 INFO - creating new remote session
09:09:28.088 INFO - Allocated session 97dec9f0b53545acbc9ca3624fc6cbd4 for http://www.irian.at, launching...
09:09:28.165 INFO - Preparing Firefox profile...
09:09:31.873 INFO - Launching Firefox...
09:09:35.599 INFO - Got result: OK,97dec9f0b53545acbc9ca3624fc6cbd4 on session 97dec9f0b53545acbc9ca3624fc6cbd4
09:09:35.604 INFO - Command request: open[http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html, ] on session 97dec9f0b53545acbc9ca3624fc6cbd4
09:09:41.698 INFO - Got result: XHR ERROR: URL = http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html Response_Code = 404 Error_Message = Not Found on session 97dec9f0b53545acbc9ca3624fc6cbd4
09:09:41.707 INFO - Command request: testComplete[, ] on session 97dec9f0b53545acbc9ca3624fc6cbd4
09:09:41.707 INFO - Killing Firefox...
09:09:41.740 INFO - Got result: OK on session 97dec9f0b53545acbc9ca3624fc6cbd4
10:18:38.252 INFO - Command request: getNewBrowserSession[*firefox, http://www.google.com/, ] on session null
10:18:38.253 INFO - creating new remote session
10:18:38.254 INFO - Allocated session c4b9c7f35ea34d428b50f2f31a6181c2 for http://www.google.com/, launching...
10:18:38.322 INFO - Preparing Firefox profile...
10:18:41.921 INFO - Launching Firefox...
10:18:45.741 INFO - Got result: OK,c4b9c7f35ea34d428b50f2f31a6181c2 on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:45.800 INFO - Command request: open[http://www.google.com/, ] on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:47.204 INFO - Got result: OK on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:47.211 INFO - Command request: type[q, hello world] on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:47.277 INFO - Got result: OK on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:47.282 INFO - Command request: click[btnG, ] on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:47.334 INFO - Got result: OK on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:47.340 INFO - Command request: waitForPageToLoad[5000, ] on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:48.359 INFO - Got result: OK on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:48.365 INFO - Command request: getTitle[, ] on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:48.411 INFO - Got result: OK,hello world - Google Search on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:48.416 INFO - Command request: testComplete[, ] on session c4b9c7f35ea34d428b50f2f31a6181c2
10:18:48.417 INFO - Killing Firefox...
10:18:48.434 INFO - Got result: OK on session c4b9c7f35ea34d428b50f2f31a6181c2


ALL this happens on TerminalOne, so keep that window open to check for the above while you are doing steps below.

STEP#1. In TerminalTwo, Change directory to the 'python-client' to run your scripts. Lets test the selenium.py script first. Btw, note that your bash file must contain the PYTHONPATH for all the directories that you run .py scripts from.

:~/selenium-remote-control-1.0.3$ ls
README.txt  selenium-php-client-driver-1.0.1  selenium-dotnet-client-driver-1.0.1  selenium-python-client-driver-1.0.1
selenium-java-client-driver-1.0.1  selenium-ruby-client-driver-1.0.1  selenium-perl-client-driver-1.0.1    selenium-server-1.0.3

:~/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1$ python selenium.py

If it returns silently (read, No errors), it means your selenium server is working.

STEP#2
. Try testing another script, test_google.py or test_default_server.py

:~/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1$ ls
doc    test_ajax_jsf.py  test_google.py~    selenium.py  test_ajax_jsf.pyc  test_google.pyc selenium.pyc                     test_default_server.py   test_i18n.py  selenium_test_suite_headless.py  test_default_server.pyc  test_i18n.pyc
selenium_test_suite.py  test_google.py

:~/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1$ python test_default_server.py
Using selenium server at localhost:4444
E
======================================================================
ERROR: testLinks (__main__.TestDefaultServer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_default_server.py", line 36, in testLinks
    selenium.open("/selenium-server/tests/html/test_click_page1.html")
  File "/home/me/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1/selenium.py", line 764, in open
    self.do_command("open", [url,])
  File "/home/me/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1/selenium.py", line 215, in do_command
    raise Exception, data
Exception: XHR ERROR: URL = http://localhost:4444/selenium-server/tests/html/test_click_page1.html Response_Code = 404 Error_Message = Not+found

----------------------------------------------------------------------
Ran 1 test in 8.852s

FAILED (errors=1)

:~/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1$ python test_ajax_jsf.py
Using selenium server at localhost:4444
E
======================================================================
ERROR: testKeyPress (__main__.TestAjaxJSF)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_ajax_jsf.py", line 39, in testKeyPress
    selenium.open("http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html")
  File "/home/me/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1/selenium.py", line 764, in open
    self.do_command("open", [url,])
  File "/home/me/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1/selenium.py", line 215, in do_command
    raise Exception, data
Exception: XHR ERROR: URL = http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html Response_Code = 404 Error_Message = Not Found

----------------------------------------------------------------------
Ran 1 test in 13.663s

FAILED (errors=1)

:~/selenium-remote-control-1.0.3/selenium-python-client-driver-1.0.1$ python test_google.py
.
----------------------------------------------------------------------
Ran 1 test in 10.190s

OK

When you are running the above scripts you would see Selenium throw a browser with messages but this is too fast and disappears. In the second terminal,   run your scripts from the directory you've stored them in.

 

2010 July 18 [Sunday]

Installing Sahi on Ubuntu 8.04 hardy

I was referred to sahi by ex-selenium users, so I decided to try it out.

To install sahi on ubuntu 8.04 hardy::

STEP#0.

I downloaded sahi from http://sourceforge.net/projects/sahi/files/

STEP#1.

Extracted the zip folder and changed directory. Ran the start_sahi shell script.

:~/sahi/userdata/bin$ sudo ./start_sahi.sh (The ./ is necessary because its not in the PATH as yet)
--------
SAHI_HOME: ../..
SAHI_USERDATA_DIR: ../../userdata
SAHI_EXT_CLASS_PATH:
--------
../../bin/sahi.sh: line 19: java: command not found

Since Sahi requires java installed on your ubuntu system, do "sudo apt-get install sun-java6-jd" and run the shell script again.

~/sahi/userdata/bin$ sudo ./start_sahi.sh
[sudo] password for mom:
--------
SAHI_HOME: ../..
SAHI_USERDATA_DIR: ../../userdata
SAHI_EXT_CLASS_PATH:
--------
Sahi properties file = /home/moi/sahi/config/sahi.properties
Sahi user properties file = /home/moi/sahi/userdata/config/userdata.properties
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi0
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi1
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi2
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi3
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi4
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi5
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi6
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi7
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi8
Copying profile to /home/moi/sahi/userdata/browser/ff/profiles/sahi9
>>>> Sahi started. Listening on port: 9999
>>>> Configure your browser to use this server and port as its proxy
>>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Controller

STEP2:
Now visit http://sahi.co.in/w/using-sahi for the "Configure the browser" section and follow those instructions.
For FF, its "Edit > Preferences > Advanced > Network > Settings" and then you can continue with the remaining instructions for Manual Proxy Configuration.

Since “No Proxy for..” should not have localhost in it I removed it but sahi controller was not being activated. I would get the message "the proxy server is refusing connections" which results in FF browsing failing completely. Not nice.

Apparently the installation is fine and proxy has started on 9999 -- this port number is not used for any other process so technically Sahi should run. It doesnt. The second reason I didnt venture further with this is because it lacks a python client driver. Even if ruby is easy to learn, selenium scores when it provides a language driver for all the scripting languages.

2010 June 20 [Sunday]

funkload builder load testing

After installing funkload on hardy, it was time for testing a few web-sites with it. I downloaded the build script and tested it. It worked like a charm but would only store results for google.com. All other sites, including blogs drew a blank which is strange. You can see the errors in the steps3 and 4, listed below:

Step0:

Test your funkload installation as below. It should run and give an OK result.
i@ubu804:~/funkload-demo/simple$ fl-run-test -v test_Simple.py
test_simple (test_Simple.Simple) ... Ok

----------------------------------------------------------------------
Ran 1 test in 36.425s

OK

Step0.1: Test the sample file.

i@ubu804:~/funkload-demo/simple$ fl-run-test -l 4 -n 100 test_Simple.py
End of loop: 100 pages rendered in 246.905s, avg of 2.469s per page, 0.405 SPPS without concurrency.
.
----------------------------------------------------------------------
Ran 1 test in 477.608s

OK

The log files for this test are located in "simple-test.log"

Step0.2: Bench it

i@ubu804:~/funkload-demo/simple$ fl-monitor-ctl monitor.conf start
Starting monitor server at http://localhost:8008/ as daemon.


Step1:

Next, download funkload Builder v0.2 - funkloadBuilder02.tar.gz.
Extract it into your home folder directory. Then just follow the installation instructions on that page which I did as below:

i@ubu804:~$ tar -xzvf funkloadBuilder02.tar.gz

funkload/
funkload/tmp/
funkload/tmp/wget/
funkload/builder/
funkload/builder/ResourceBundle.py
funkload/builder/build.py
funkload/builder/builder.conf
funkload/builder/util.py
funkload/builder/default/
funkload/builder/default/monitor.conf
funkload/builder/default/test-results/
funkload/builder/default/test_Load.py
funkload/builder/default/Load.conf

i@ubu804:~$ cd funkload/builder

i@ubu804:~/funkload/builder$ vi builder.conf


Here, you must edit the following lines in builder.conf:

wsb_root=/home/esw/funkload-results/ {hint: set your directory path correctly}
test_repository=/home/esw/funkload/ {hint: set your directory path correctly}
test_sites=[www.test1.co.uk, www.test2.co.uk] {hint: add the URI of sites you want to test}

and if required, setup parameters for wget {Ex. your /home/i/funkload/tmp/wget/www.google.co.in/index.html is the folder which will store the .html files for viewing}.

Save and exit builder.conf file.

Step2:

Next, we will run the build file.

i@ubu804:~/funkload/builder$ python build.py -b 50
{'-b': '50'}
Performing sampling of site login.launchpad.net, this may take a while!
Sampling complete
Performing sampling of site svaksha.com, this may take a while!
Sampling complete
Performing sampling of site google.com, this may take a while!
Sampling complete
find: /home/i/funkload/tmp/wget/google.com: No such file or directory

If you change directory to the funkload folder, you will see three new folders for each of the sites you ran the tests on: "login.launchpad.net", "svaksha.com", and "google.com"

Step3:

Now we are running the load tests:

i@ubu804:~/funkload/builder$ python build.py --run
{'--run': ''}
/home/i/funkload/builder/.. login.launchpad.net
Traceback (most recent call last):
File "/usr/bin/fl-run-bench", line 8, in <module>
load_entry_point('funkload==1.12.0', 'console_scripts', 'fl-run-bench')()
File "build/bdist.linux-x86_64/egg/funkload/BenchRunner.py", line 606, in main
File "build/bdist.linux-x86_64/egg/funkload/BenchRunner.py", line 220, in __init__
File "build/bdist.linux-x86_64/egg/funkload/BenchRunner.py", line 123, in load_unittest
File "/home/i/funkload/login.launchpad.net/test_Load.py", line 9, in <module>
from MembersTestCase import MembersTestCase
ImportError: No module named MembersTestCase
Traceback (most recent call last):
File "build.py", line 271, in <module>
main(sys.argv[1:])
File "build.py", line 261, in main
funkloadBuilder.runLoadTesting()
File "build.py", line 240, in runLoadTesting
shutil.copyfile("%s/%s"%(copyDir,FunkloadBuilder.LOAD_TESTING_RESULTS_FILE),"%s/%s/%s"%(copyDir,FunkloadBuilder.LOAD_TESTING_RESULTS_FOLDER,FunkloadBuilder.LOAD_TESTING_RESULTS_FILE))
File "/usr/lib/python2.5/shutil.py", line 46, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: '/home/i/funkload/login.launchpad.net/load-bench.xml'

This is where the test fails because it only stores results for google.com in the folder /home/i/funkload/tmp/wget/www.google.co.in/index.html , where I can reproduce the google.in website as is. The other two domains that were tested, login.launchpad.net and svaksha.com dont have any results. Strange. The error above shows that /usr/bin/fl-run-bench, is not being called from the funkload==1.12.0 folder  which is where the build fails.

Step4:

Next, we will have to generate HTML reports for each tested website but before giving the following command, create a funkload-results directory in your home folder, then :

i@ubu804:~/funkload/builder$ python build.py -s output-report-name
{'-s': 'output-report-name'}
load-bench.xml not found in: /home/i/funkload/login.launchpad.net/test-results/
load-bench.xml not found in: /home/i/funkload/svaksha.com/test-results/
load-bench.xml not found in: /home/i/funkload/google.com/test-results/


The above command only creates a directory "output-report-name" within the funkload-results directory but cd'ing into one of them, like /funkload-results/output-report-name/svaksha.com, shows an empty directory. Test #fail.

2010 June 17 [Thursday]

howto install funkload on ubuntu8.04 hardy

In between my earlier attempts and patchy internet for almost a week and google searches yielding this:

#0.http://nedbatchelder.com/blog/200810/funkload_ftw.html
#0.http://blog.jbglenn.net/search/label/Funkload and
#0.http://pydanny.blogspot.com/2008/02/funkload-charting-woes.html

It seemed like a challenge to get funkload working on Hardy but Ben had emailed and commented (thanks Ben :-)) that Funkload and TCPWatch package has to be installed manually for all Ubuntu releases below ver8.10 and its packaged for Debian-lenny.

On a clean Hardy/8.04 system, I tried installing funkload, yet again. So I suppose a proper listing of the steps will be useful to others.

Step0:

Installing the package dependencies.

i@ubu804:~$ sudo aptitude install python-dev python-xml python-setuptools python-docutils gnuplot

Step1:

Downloading TCPWatch, extracting and building from source.

i@ubu804:~$ wget http://hathawaymix.org/Software/TCPWatch/tcpwatch-1.3.tar.gz
--13:23:27--; http://hathawaymix.org/Software/TCPWatch/tcpwatch-1.3.tar.gz
; => `tcpwatch-1.3.tar.gz'
Resolving hathawaymix.org... 67.161.215.12
Connecting to hathawaymix.org|67.161.215.12|:80... failed: Connection timed out.
Retrying.
--13:26:37--; http://hathawaymix.org/Software/TCPWatch/tcpwatch-1.3.tar.gz
; (try: 2) => `tcpwatch-1.3.tar.gz'
Connecting to hathawaymix.org|67.161.215.12|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13,065 (13K) [application/x-tar]
100%[===================================================================] 13,065; 11.43K/s;
13:26:39 (11.42 KB/s) - `tcpwatch-1.3.tar.gz' saved [13065/13065]

i@ubu804:~$ tar xzvf tcpwatch-1.3.tar.gz
tcpwatch/
tcpwatch/tcpwatch.py
tcpwatch/setup.py
tcpwatch/CHANGES.txt

i@ubu804:~$ cd tcpwatch/

i@ubu804:~/tcpwatch$ ls
CHANGES.txt; setup.py; tcpwatch.py
i@ubu804:~/tcpwatch$ python setup.py build
running build
running build_scripts
creating build
creating build/scripts-2.5
copying and adjusting tcpwatch.py -> build/scripts-2.5
changing mode of build/scripts-2.5/tcpwatch.py from 644 to 755

i@ubu804:~/tcpwatch$ sudo python setup.py install
running install
running build
running build_scripts
running install_scripts
copying build/scripts-2.5/tcpwatch.py -> /usr/bin
changing mode of /usr/bin/tcpwatch.py to 755
running install_egg_info
Writing /usr/lib/python2.5/site-packages/tcpwatch-1.2.1.egg-info

i@ubu804:~/tcpwatch$ cd

Step2:

Installing funkload version 1.12.0.

i@ubu804:~/tcpwatch$ sudo easy_install -U funkload
Searching for funkload
Reading http://pypi.python.org/simple/funkload/
Reading http://funkload.nuxeo.org/
Best match: funkload 1.12.0
Processing funkload-1.12.0-py2.5.egg
funkload 1.12.0 is already the active version in easy-install.pth
Installing fl-credential-ctl script to /usr/bin
Installing fl-monitor-ctl script to /usr/bin
Installing fl-install-demo script to /usr/bin
Installing fl-run-test script to /usr/bin
Installing fl-record script to /usr/bin
Installing fl-build-report script to /usr/bin
Installing fl-run-bench script to /usr/bin
Installing fl-credential-ctl script to /usr/bin
Installing fl-run-test script to /usr/bin
Installing fl-record script to /usr/bin
Installing fl-run-bench script to /usr/bin
Installing fl-monitor-ctl script to /usr/bin
Installing fl-install-demo script to /usr/bin
Installing fl-build-report script to /usr/bin

Using /usr/lib/python2.5/site-packages/funkload-1.12.0-py2.5.egg
Processing dependencies for funkload
Finished processing dependencies for funkload

Step3:

Installing python-gdchart and python-gdchart2

i@ubu804:~$ sudo aptitude install python-gdchart2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
libgdchart-gd2-noxpm
The following NEW packages will be installed:
libgdchart-gd2-noxpm python-gdchart2
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 87.0kB of archives. After unpacking 352kB will be used.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
Get:1 http://np.archive.ubuntu.com hardy/universe libgdchart-gd2-noxpm 0.11.5-4 [46.7kB]
Get:2 http://np.archive.ubuntu.com hardy/universe python-gdchart2 0.beta1-3.4 [40.3kB]
Fetched 87.0kB in 24s (3608B/s)
Selecting previously deselected package libgdchart-gd2-noxpm.
(Reading database ... 151343 files and directories currently installed.)
Unpacking libgdchart-gd2-noxpm (from .../libgdchart-gd2-noxpm_0.11.5-4_amd64.deb) ...
Selecting previously deselected package python-gdchart2.
Unpacking python-gdchart2 (from .../python-gdchart2_0.beta1-3.4_amd64.deb) ...
Setting up libgdchart-gd2-noxpm (0.11.5-4) ...

Setting up python-gdchart2 (0.beta1-3.4) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Building tag database... Done

Step4:

Now follow the demo testing steps given here

i@ubu804:~$ fl-install-demo
Extract FunkLoad examples into ./funkload-demo : ...  done.
i@ubu804:~$ cd funkload-demo/xmlrpc/
i@ubu804:~/funkload-demo/xmlrpc$ make test
fl-credential-ctl cred.conf restart
Starting file_credential server at http://localhost:44401/ as daemon.
fl-run-test test_Credential.py -v
test_credential (test_Credential.Credential) ... Ok

----------------------------------------------------------------------
Ran 1 test in 0.038s

OK
fl-credential-ctl cred.conf stop
Server http://localhost:44401/ is stopped.
i@ubu804:~/funkload-demo/xmlrpc$

Step5:

Make bench

i@ubu804:~/funkload-demo/xmlrpc$ make bench
Starting file_credential server at http://localhost:44401/ as daemon.
Starting monitor server at http://localhost:44402/ as daemon.
fl-run-bench -c 1:20:40:60:80:100 -D 10 test_Credential.py Credential.test_credential
========================================================================
Benching Credential.test_credential
========================================================================
Check all credentiald methods
------------------------------------------------------------------------

Configuration
=============

* Current time: 2010-06-17T14:54:09.755672
* Configuration file: /home/i/funkload-demo/xmlrpc/Credential.conf
* Log xml: /home/i/funkload-demo/xmlrpc/credential-bench.xml
* Server: http://localhost:44401/
* Cycles: [1, 20, 40, 60, 80, 100]
* Cycle duration: 10s
* Sleeptime between request: from 0.1s to 0.2s
* Sleeptime between test case: 0.5s
* Startup delay between thread: 0.05s

Benching
========

Cycle #0 with 1 virtual users
-----------------------------

* Start monitoring localhost: ... done.
* Current time: 2010-06-17T14:54:09.773675
* Starting threads: . done.
* Logging for 10s (until 2010-06-17T14:54:19.830918): ........ done.
* Waiting end of threads: . done.
* Waiting cycle sleeptime 1s: ... done.
* Stop monitoring localhost:  done.
* End of cycle, 12.62s elapsed.
* Cycle result: **SUCCESSFUL**, 8 success, 0 failure, 0 errors.

Cycle #1 with 20 virtual users
------------------------------

* Start monitoring localhost: ... done.
* Current time: 2010-06-17T14:54:22.385506
* Starting threads: .................... done.
* Logging for 10s (until 2010-06-17T14:54:33.519986): .............................................................................................................................................................................. done.
* Waiting end of threads: .................... done.
* Waiting cycle sleeptime 1s: ... done.
* Stop monitoring localhost:  done.
* End of cycle, 14.33s elapsed.
* Cycle result: **SUCCESSFUL**, 174 success, 0 failure, 0 errors.

Cycle #2 with 40 virtual users
------------------------------

* Start monitoring localhost: ... done.
* Current time: 2010-06-17T14:54:36.716379
* Starting threads: ........................................ done.
* Logging for 10s (until 2010-06-17T14:54:49.032317): ............................................................................................................................................................................................................................................................................................................................ done.
* Waiting end of threads: ........................................ done.
* Waiting cycle sleeptime 1s: ... done.
* Stop monitoring localhost:  done.
* End of cycle, 14.59s elapsed.
* Cycle result: **SUCCESSFUL**, 316 success, 0 failure, 0 errors.

Cycle #3 with 60 virtual users
------------------------------

* Start monitoring localhost: ... done.
* Current time: 2010-06-17T14:54:51.301751
* Starting threads: ............................................................ done.
* Logging for 10s (until 2010-06-17T14:55:04.779492): ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ done.
* Waiting end of threads: ............................................................ done.
* Waiting cycle sleeptime 1s: ... done.
* Stop monitoring localhost:  done.
* End of cycle, 15.76s elapsed.
* Cycle result: **SUCCESSFUL**, 464 success, 0 failure, 0 errors.

Cycle #4 with 80 virtual users
------------------------------

* Start monitoring localhost: ... done.
* Current time: 2010-06-17T14:55:07.066691
* Starting threads: ................................................................................ done.
* Logging for 10s (until 2010-06-17T14:55:21.814678): ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ done.
* Waiting end of threads: ................................................................................ done.
* Waiting cycle sleeptime 1s: ... done.
* Stop monitoring localhost: done.
* End of cycle, 20.69s elapsed.
* Cycle result: **SUCCESSFUL**, 672 success, 0 failure, 0 errors.

Cycle #5 with 100 virtual users
-------------------------------

* Start monitoring localhost: ... done.
* Current time: 2010-06-17T14:55:27.761091
* Starting threads: .................................................................................................... done.
* Logging for 10s (until 2010-06-17T14:55:43.883081): .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. done.
* Waiting end of threads: .................................................................................................... done.
* Waiting cycle sleeptime 1s: ... done.
* Stop monitoring localhost: done.
* End of cycle, 20.43s elapsed.
* Cycle result: **SUCCESSFUL**, 686 success, 0 failure, 0 errors.

Result
======

* Success: 2320
* Failures: 0
* Errors: 0

Bench status: **SUCCESSFUL**
fl-build-report credential-bench.xml --html
Creating html report: ...done:
/home/i/funkload-demo/xmlrpc/test_credential-20100617T145409/index.html
Server http://localhost:44402/ is stopped.
Server http://localhost:44401/ is stopped.
i@ubu804:~/funkload-demo/xmlrpc$

Step6: Install Zope (installation instructions) and create a sandbox.

i@ubu804:~/funkload-demo/simple$ cat README.txt
====================
FunkLoad demo/simple
====================
$Id: README.txt 53544 2009-03-09 16:28:58Z tlazar $

This is a simple FunkLoadTestCase demonstration.

It requires an web test server (configuration is done for an apache2
default install)

WARNING: You should *not* run this script against a server that is not under
your responsablity as it can result a DOS in bench mode.

1/ Modify the Simple.conf file

  Set the [main] url and pages keys

2/ Test it

verbose mode::

fl-run-test -v test_Simple.py

debug mode::

fl-run-test -d test_Simple.py

view the downloaded page in real time using firefox::

fl-run-test -V test_Simple.py

check performance of a single page::

fl-run-test -l 4 -n 100 test_Simple.py

PS:

I have yet to finish testing so I'll update this entry later as its almost midnight and as usual google threw more to-read stuff for laters... yum !
0. funkload-modules
0. funkload-test-in-few-minutes
0. funkloadtests/INSTALL.txt
0. plone-collective.recipe.funkload
0. set up funkload to do functional tests on a SOAP web service
0. funkload build script
0. collective funkload tests, thread on a plone list
0. plone sprint report
0. functional load testing notes

A nice-to-have feature would be a screen key recording feature in funkload :)

2010 June 6 [Sunday]

funkload installation on ubuntu lucid and hardy

Crediting my earlier failed installation attempt to the owl-like-shift for most of last week, yesterday, I started afresh on Ubuntu Hardy.

Ubuntu Hardy

I tried the installation on Ubuntu Hardy, which is the environment in which funkload will be installed for use. Installing tcpwatch-httpproxy removes procmail and sendmail.

Not good. Those packages are required by other parts of the system. Strangely this does not happen on Ubuntu 10.04, for which I repeated the installation to test separately. Earlier Ben had left a comment offering his help so I've emailed him the logs and am hoping to solve this problem and post another entry about that.

$sudo aptitude install tcpwatch-httpproxy --without-recommends
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Reading extended state information     
Initializing package states... Done
Writing extended state information... Done
Building tag database... Done            
Couldn't find any package whose name or description matched "tcpwatch-httpproxy"
Couldn't find any package whose name or description matched "tcpwatch-httpproxy"
The following packages are unused and will be REMOVED:
  procmail sendmail-base sendmail-cf sensible-mda
0 packages upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 3191kB will be freed.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
(Reading database ... 151156 files and directories currently installed.)
Removing sensible-mda ...
Removing procmail ...
Removing sendmail-base ...
Cleaning up the queues...find: /var/spool/mqueue: No such file or directory
done.
Removing sendmail-cf ...
Reading package lists... Done            
Building dependency tree      
Reading state information... Done
Reading extended state information     
Initializing package states... Done
Writing extended state information... Done
Building tag database... Done            


Ubuntu Lucid (10.04)

The experience of installing funkload on Lucid was a little better than Hardy, which was a small step ahead. Even if the installation failed, I tried the test-runner but the tests failed and I wanted to try it again with virtualenv. Likewise, the modules was not loading in TestRunner

(funkload)me@ubuntu10.04:~$ fl-run-test -v myFile.py
Traceback (most recent call last):
  File "/home/me/.virtualenvs/funkload/bin/fl-run-test", line 8, in <module>
    load_entry_point('funkload==1.12.0', 'console_scripts', 'fl-run-test')()
  File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/TestRunner.py", line 483, in main
    TestProgram(testLoader=test_loader)
  File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/TestRunner.py", line 342, in __init__
    self.loadTests()
  File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/TestRunner.py", line 352, in loadTests
    module_relative=False)
  File "/usr/lib/python2.6/doctest.py", line 2419, in DocFileSuite
    suite.addTest(DocFileTest(path, **kw))
  File "/usr/lib/python2.6/doctest.py", line 2338, in DocFileTest
    doc, path = _load_testfile(path, package, module_relative)
  File "/usr/lib/python2.6/doctest.py", line 219, in _load_testfile
    return open(filename).read(), filename
IOError: [Errno 2] No such file or directory: '/home/me/myFile'

Next it was 'make bench' which failed. So too with BenchRunner.

(funkload)me@ubuntu10.04:~$ fl-run-bench -u http://localhost:8080 -c 10:20 -D 30 myFile.py MyTestCase.testSomething
Traceback (most recent call last):
  File "/home/me/.virtualenvs/funkload/bin/fl-run-bench", line 8, in <module>
    load_entry_point('funkload==1.12.0', 'console_scripts', 'fl-run-bench')()
  File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/BenchRunner.py", line 606, in main
    bench = BenchRunner(args[0], klass, method, options)
  File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/BenchRunner.py", line 220, in __init__
    mmn_encode(method_name, 0, 0, 0), options)
  File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/BenchRunner.py", line 123, in load_unittest
    module = __import__(test_module)
ImportError: No module named myFile

2010 June 3 [Thursday]

funkload installation fail

I was analysing various tools for web-testing and tried out funkload - a functional, load web tester in Python.

$sudo easy_install -f http://funkload.nuxeo.org/snapshots/ -U funkload (and "sudo easy_install -U funkload" results are below:)
/usr/lib/python2.6/dist-packages/setuptools/package_index.py:156:
UserWarning: Unbuilt egg for setuptools [unknown version]
(/usr/lib/python2.6/dist-packages)
Environment.__init__(self,*args,**kw)/usr/lib/python2.6/dist-packages/setuptools/command/easy_install.py:216:
UserWarning: Unbuilt egg for setuptools [unknown version]
(/usr/lib/python2.6/dist-packages)
self.local_index = Environment(self.shadow_path+sys.path)
Searching for funkload
Reading http://pypi.python.org/simple/funkload/
Reading http://funkload.nuxeo.org/
Best match: funkload 1.12.0
Processing funkload-1.12.0-py2.6.egg
funkload 1.12.0 is already the active version in easy-install.pth
Installing fl-credential-ctl script to /usr/local/bin
Installing fl-monitor-ctl script to /usr/local/bin
Installing fl-build-report script to /usr/local/bin
Installing fl-run-test script to /usr/local/bin
Installing fl-record script to /usr/local/bin
Installing fl-install-demo script to /usr/local/bin
Installing fl-run-bench script to /usr/local/bin
Installing fl-credential-ctl script to /usr/local/bin
Installing fl-run-test script to /usr/local/bin
Installing fl-record script to /usr/local/bin
Installing fl-run-bench script to /usr/local/bin
Installing fl-monitor-ctl script to /usr/local/bin
Installing fl-install-demo script to /usr/local/bin
Installing fl-build-report script to /usr/local/bin
Using /usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg
Processing dependencies for funkload
Finished processing dependencies for funkload

$ fl-install-demo
Extract FunkLoad examples into ./funkload-demo : ... done.

Googling showed that Debian packages were 1.6.0 but easy_install pulls 1.12.0, hmm... continued with installing the dependencies:

$sudo apt-get install python-setuptools python-xml python-dev gnuplot (if you want the graphs)

$ cd funkload-demo/xmlrpc/
~/funkload-demo/xmlrpc$ make test

fl-credential-ctl cred.conf restart
Starting file_credential server at http://localhost:44401/ as daemon.
fl-run-test test_Credential.py -v
test_credential (test_Credential.Credential) ... FAIL
======================================================================
FAIL: test_credential (test_Credential.Credential)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/FunkLoadTestCase.py",
line 868, in __call__
testMethod()
File "/home/mom/funkload-demo/xmlrpc/test_Credential.py", line 21,
in test_credential
description="Check getStatus")
File "/usr/local/lib/python2.6/dist-packages/funkload-1.12.0-py2.6.egg/funkload/FunkLoadTestCase.py",
line 417, in xmlrpc
raise SocketError("Can't access %s." % url)
error: Can't access http://localhost:44401/.
----------------------------------------------------------------------
Ran 1 test in 0.007s
FAILED (failures=1)
make: *** [credential_test] Error 1

Apparently the version checked out via " sudo apt-get install -f http://funkload.nuxeo.org/snapshots/ -U funkloadinstall" is messed up -- the port number is weird.

Tried the same installation as blogged here and then I repeated the whole process with virtualenvwrapper for good measure. Virtualenv was a nicer place to try testing if each *.py file worked or not. Atleast some of the .py files ran and errors reduced but the one consistent error was the high port number. Strange that the Install file (or was it the Readme file?) lists localhost on port "http://localhost:33301/".

So although both installation methods failed spectacularly i wanted to document all the stuff that i tried for my reference. After an 18-hour day, blogging is the last thing on my mind but very often when I do some stuff, am tired after these marathon days, move on as i'm tired and dont document it. The next time I want to replicate the _exact_ method i followed earlier, I waste more time digging out stuff. This is especially true with eggs which break easily and i'm a vegetarian who dislikes omelette ;)