Thursday, 8 May 2008

"...test data independant"

"...test data independant" (from post last week)

What do I mean by that ?

In automation, I try to avoid hard-coded test data which depends on whether the AUT database is in "start-position" or not.

Mostly I create test data during run-time using random values or getting random data from the AUT database which match my critera for the specific test case.

Consider a test case where you want to change an address for example. Here is an approach you could use (in pseudo-code]:

Select top 1 [myAddressColumns] from ADDRESS where [myCritera = True] order by newid() 'Note! Newid() MS SQL Server specificOptional
If blnNoAddressFound Then call createAddress 'In case of empty database call test case/method for create an address

Test case can be executed to any AUT database (empty or full)
You get test data variation using random values

It is more difficult to implement compare methods (but not impossible)

No comments: