Monday, June 7, 2010

Address project risk with testing starting from the top

So we have a website that grew to some size and I need to manage my risks on that system while cowboy young developers explain to their superiors that the code should be difficult to read because it was difficult to write. Yes, totally organic stuff.

I need something quickly to start with. Hello Selenium. Quickly run through a few scenarios. At least the main cases to start with. Hey , wait, let's teach a tester how to record their tests and ask them for a copy. Voila. And then run that test suite after changes to confirm the system state.

It would actually be nice if I didn't have to sit here and stare at the screen while these macros play their way through all the clicks and form submissions. Let's automate it.

It's a Drupal website and it is always a good idea to search for something related to drupal as there just may be a module for it already. And so it is. On Drupal 6 install the examples module with drush and enable the simple test module. Voila, with some example tests and, hey looky, some modules have tests on the admin page at http://mydrupalsite.bom/admin/build/testing. Where do they come from? Select a few tests and run them. Beautiful. I'm getting a warm and fuzzy feeling around my heart.

Quickly write a test. Translate the Selenese to Simpletest and voila, it does not work. Simple test like other test frameworks are spawned from the testing realm and there are some ideas you have to subscribe to and they all make sense and we will get there while right now i just want to run tests against the test site on the highest level. And I can use the scripts I get from testers easily. It will take a bit of modification to get the assumptions ironed out of simple test and I should perhaps do that as soon as I have some extra time on my hands

In the meantime export the selenium scripts to Java code, write a class and call that ever so often. Convert the Selenese to Webdriver so we do not have to worry about browsers crashing or bothering our screens. Junit have those asserts and the reporting is convenient. Hudson presents the test results conveniently and has a nice interface to run the tests from and keep track of their trends. And Bob is your auntie. Hudson picks up the changes in my git repository and runs the tests. I can get an email of the reports and see who changed what and what the results was. Beautiful.

No comments:

Post a Comment

Thank you for your comment :)