A few tips on producing bulk test data

I recently had a requirement to run some performance tests against the nopCommerce open source eCommerce application. Whilst the default sample data was useful, if I really wanted to give the application a “work out”, I felt that I should create a large amount of test data.

I needed product descriptions, short descriptions and images for potentially thousands of products.
I considered taking content from other websites, but, conscious of the logal implications of doing this, I decided to produce my own data.

Images
To produce sample images, I took screenshots from the Intechnica company website and saved them as JPG files.
I then ran a batch file to make duplicate copies of each of these files.

e.g. To create 10 copies of a file called Image.jpg, use this command
for /l %i IN (1,1,10) DO COPY Image.jpg Image%i.jpg


Descriptions
To ensure that my test data was not always cached by the server, and was more representative of “real life” I needed to ensure that I used different descriptions for each product. This would ensure that my tests were production-like. I downloaded War and Peace from Project Gutenberg and used the UNIX “SPLIT” command to divide this text file into chunks. I chose 100 byte chunks for the short descriptions and 700 byte chunks for the long descriptions.

e.g. To split WarAndPeace.txt into 700 byte chunks, use this command. (SPLIT comes with CYGWIN)
split WarAndPeace.txt -b 700 -a 6 -d

This creates files called x000000, x000001, x000003 etc.
I needed to rename these to text files for simplicity so i used the DOS REN (rename) command to do this.

e.g. To rename all the new files in the folder
ren * *desc.txt




 

Author: Richard Bishop

http://about.me/richard_bishop