Pot: nose

nose is my Python testing tool of choice. You can use it to very easily create test suites. While it does support the unittest module which is included with Python, it also allows for a much simple style using just methods and asserts. Put the following code into a file called test_basic.py: <notextile>def test_addition(): print 2 + 2 assert 2 + 2 == 4 def test_addition_wrong(): print 2 + 3 assert 2 + 3 == 6</notextile> Then just run nosetests in the directory where you stored this file. You’ll get an output indicating, that there is a test failure. ...

April 6, 2009 · Patrice Neff

Continuous testing with Python

Back when I did some Ruby on Rails development I was a big fan of autotest. With it I could stay in my editor while the project test suite got executed with every change. Setup Now that I’m working in Python I was looking for something similar and I was successful. You’ll need the following: Mac OS X Growl nose nosegrowl tdaemon Then you can execute tdaemon like this in your project directory: ...

February 7, 2009 · Patrice Neff

PHP Testing with SimpleTest

Maarten’s post at Tillate finally brought the motivation to document the PHP testing approach we use at local.ch. First let me give you a short introduction to our architecture at local.ch. We have a clear separation of frontend (presentation, user-visible parts) and backend (search logic and database accesses). The frontend is written in PHP and XSLT. The PHP-part basically only orchestrates queries to our Java-based backend and passes the XML responses to XSLT. The bigger parts of the system are the XSLT stylesheet. All this means, that traditional unit tests don’t have a big value for the frontend as there isn’t much traditional logic. But we need to do functional/integration testing. ...

May 22, 2007 · Patrice Neff

Mail testing with Selenium

For the next phase of local.ch E-Mail processes will play a central role. So I wanted to include those processes in our Selenium tests. It’s actually quite easy to do. First create an account where test mails can go to. That account should be accessible by one of your scripts. I use a normal IMAP account for that. Then write a script which always outputs the newest mail on that account. I include some of the important headers plus the body (body parts for multi-part mails). I also made that page refresh itself every two seconds. ...

November 23, 2006 · Patrice Neff

Name of Selenium

Selenium is a open-source framework for functional testing of web applications. Today we found out the most likely reason for it’s naming. Intervention to minimise the toxic effects of mercury and other free radical inducers is feasible for both the dental team and patients. Probably the most effective protective agent against the hazards of mercury poisoning is the element selenium. Mercury apparently produces some test software that’s not well-liked with developers. Or so I gather as I have never worked with it myself. ...

September 5, 2006 · Patrice Neff

Testing with Selenium

I spent Friday and Saturday at the T.Camp of the Swiss Web consultancy namics. That’s a yearly conference for the namics techies. As a member of the namics sister company local.ch I was also allowed to participate. And like every year for the past five years I held a presentation again. This time I talked about testing. Specifically Selenium. It’s much the same as I’ll talk about on September 12 at the Webtuesday event. You can download the presentation. ...

September 2, 2006 · Patrice Neff