views:

65

answers:

1

I wonder if there are any good / possible ways to automate - for a unit test perhaps - a human-dependant action on an eCommerce website?

For example, could I have a macro or a script to simulate "can user put items in basket?" or "can user reach the payment gateway?".

I am currently managing a very heavily used eCommerce codebase and would like to be able to quickly verify that any changes I implement are not going to goof things up for the end user.

Comment is free ;-)

[codebase is PHP by the way]

+9  A: 

Check out Selenium... All the tests execute in a browser, so you can test your JS, etc...

Edit:

Oh, and the REALLY cool thing, is if you use Selenium Grid, you can then scale out your already written tests to multiple browsers and platforms. So you write your test once, and then can run it (simultaneously) on literally dozens of different browser/platform combinations. You'll still need to intelligently write your test cases, but once you do you can use it to detect problems on other browsers (Test for JS errors/crashes)...

ircmaxell
Looks cool. I was thinking more of something that would execute on the live server when I did an automated deploy.
Dougal
If you use PHPUnit, you can have it execute the tests (either by writing the test cases in PHPUnit, or including the selenium tests) for you automatically. Personally, I use Phing for deployment, so I have it run all my tests (Unit, Integration, Functional and Selenium) automatically every update/deployment/copy/etc cycle.
ircmaxell
I also use Phing for deployment. Am I right in thinking that one can only "do" the Selenium tests on a machin with a GUI and with the browser installed and what not?
Dougal
Well, the tests will need to be executed on a machine with a GUI. But that doesn't mean that's where the test cases need to be run from. Basically, the test case (PHPUnit) connects to a SeleniumRC server (or a SeleniumGrid server) and sends its messages there. Personally, I have a server with dedicated VM's for this kind of testing. So my build machine connects to the master test VM, and then the master VM distributes the test cases among all of its children. These could be simple desktops (Heck, you could theoretically setup the tests to run at night on your regular desktops)....
ircmaxell