Random test data from your database

I just finished testing part of an application which basically retrieves information from the database and displays it to the operator. The complexity in this situation comes from ensuring that the correct information set gets retrieved and displayed in the correct place.

At first I wanted to use the other portion of the application to create my own test data as I don’t know the origin of what is already in the database, but I couldn’t get it all wired up correctly. Plan B had me pulling my test data directly from the database (which sorta means Oracle was my oracle). Fortunately, or unfortunately this database hasn’t been refreshed in quite some time so there was a tonne of information to choose from.

Too much actually.

This got me thinking, how could I get the database to feed me a single data point at a time? A few minutes digging led me to SQL to Select a random row from a database table. A few minutes more and I had my search SQL tweaked to provide new test data on every refresh.

Very cool from a sitting-at-a-sql-prompt perspective. Crazy cool if you were to rig things up so your selenium scripts where being driven by this sort of thing.

Post a Comment

Your email is never published nor shared. Required fields are marked *