Nov 12 2010

Getting results from Selenium RC using htmlSuite option

Selenium IDE is great for recording and running tests. However, running recorded test suites using Selenium RC is better.

I had an issue today where results weren't being generated after executing:

java -jar selenium-server.jar -htmlSuite "*firefox" "http://url" "/path/to/testsuite" "/tmp/results.html"

Turns out the test suite and tests must have the .html extension. Googling helped me to find the answer in the comments of this blog post.

java -jar selenium-server.jar -htmlSuite "*firefox" "http://url" "/path/to/testsuite.html" "/tmp/results.html"

The generated results are excellent.

Nov 10 2010

Installing PEAR packages locally to a project rather than globally

Recently at work we had the need to install PEAR packages locally to a project rather than globally.

After some research (Google) I happened upon these options - I concede there may be other/better options out there:

  1. Use a project PEAR configuration file and install packages into the project
    • Packages are managed on the project level
  2. Specify --installroot when installing a package
    • Packages are still managed globally
    • Wanted to preserve dependency management
  3. Pyrus
    • Pyrus appears to solve this issue
    • PHP 5.3+
  4. Each project has its own pear instance

We decided upon option 1 as the packages can be managed effectively on a per-project basis. Although I have seen this method described as "config hell", it has proved to be a good solution so far.

To use a local PEAR configuration file and install packages locally, you can do the following:

mkdir `pwd`/_packagelib
pear config-create `pwd`/_packagelib pear-conf
pear -c pear-conf channel-discover <channel>
pear -c pear-conf install <channel alias>/<package name>

To use the project specific configuration, you must specify the configuration file location as detailed above

pear -c pear-conf ...

From what I've seen Magento do something similar. Have only taken a brief look at their code so need to do some more investigation.

Update

Found PHPiranha / Pearanha by Benjamin Eberlei - https://github.com/beberlei/pearanha . It's a neat tool that automates the process described above.

Additionally, http://pearfarm.org/ looks really useful. They provide an OO interface to generating package.xml.

Info

I'm Ade Slade, a PHP web developer.