Using MySQL instead of VTS for LoadRunner

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 available in my GitHib library.
Please feel free to comment below if you find this useful.