I have two requirements for some testing which I’m currently undertaking and MySQL seems to be able to help me in both cases.
- Firstly, I want to create data in one script and use it in subsequent scripts. When the data is “in use” I want other vUsers to use an alternate piece of data. When a piece of data has been “used” I want to flag it as such and prevent it being used in subsequent iterations.
- Secondly, I want to write detailed information about transactions including a description of the transaction, the time it executed and the response time to a database. This will allow more detailed analysis than is normally possible using LoadRunner Analysis and allow a database of performance stats for multiple tests run over a period of time to be built up.
I know that it is possible to use Virtual Table Server (VTS) for this, but VTS has a number of limitations.
- VTS can only read in data one row at a time. Queries must then be written in LoadRunner using C code to determine whether the data is suitable for use. This is inefficient when compared to SQL queries which execute on the server and can return data directly to the vUser.
- VTS is not officially supported by HP (and it wasn’t supported by Mercury). MySQL isn’t supported either, but MySQL is well documented on the Internet and there is an established user community as well as large numbers of people familiar with SQL syntax.
- VTS is an in-memory database and needs to import data before a test and export data to file before it is shut down. This makes it very easy to accidentally close VTS before data is saved and lose your test data. MySQL and other databases automatically save the database tables when they shut down which reduces the risk of this occurring.
A PDF document describing the process for using MySQL with LoadRunner, together with LoadRunner library files, the MySQL DLL and sample scripts which read and write to MySQL are attached on my discussion forum.
Please feel free to comment below if you find this useful.
When testing an application recently, I had a requirement to generate authentication keys. These were generated using OpenSSL. Since it was hard (for me) to use the OpenSSL DLLs directly in my LoadRunner script, I wrote a function to generate the key using OpenSSL (using the LoadRunner system function).
The LoadRunner script then reads the key back into LoadRunner using the fgets command. To improve performance, I moved OpenSSL, the script and the script data to a RAMDISK. This improved end-to-end response times for the function in question from approx 0.8s to 0.6s.
I used RAMDISK 10 from SuperSpeed LLC on Windows 7 64-bit. You can download an evaluation version (like I did) from http://www.superspeed.com/desktop/ramdisk.php .
I’ll use RAMDISK in my final performance tests if I can’t get OpenSSL to integrate properly with LoadRunner.
On a client site recently, I had a requirement to encrypt a small amount of data which needed to be re-used later in a LoadRunner script. The encryption was done by OpenSSL; whilst it was easy to use OpenSSL to encrypt the data in question, it proved extremely difficult to incorporate the OpenSSL functions into LoadRunner.
As a work-around, I wrote a function which writes output to an external file with a unique filename. LoadRunner can then use the external OpenSSL executable by using the system function to call an external DOS command, if the output from this command is written to an output file, the script can then read the data back in from the output file and use it later in the script.
This seems quite convoluted but it works!!
The function can be downloaded in a working sample script on my discussion forum.