Test set properties caching issue
I've encountered an issue when using Quality Center and QuickTest Pro together.
I have been using user-defined test set properties in Quality Center to pass in test environment parameters for my QTP tests. When I want to change which test environment I run the tests against, I simply change the test set properties, refresh in QC, and run. It works great, most of the time.
Recently I have been seeing an issue where Quality Center ignores the current test set properties and passes cached values of the test set properties from an earlier run of the same test set to QuickTest Pro instead. This caching persists even after closing and re-opening both applications.
It's a bit like driving a car and suddenly your steering wheel decides that because the last turn it made was a right turn, from now on it will only make right turns.
I've noticed that sometimes QC has more than one connection active to the same machine, I wonder if it might be picking an old stale connection rather than the current one, and that is why it is sending old data.
If I figure out the cause and a solution I will post it here.
Update: The issue appears to be an integration bug in the Mercury tools. Apparently QC opens two connections to QTP. This is visible in the QC admin tool. When a test set is finished, QC leaves the connection open. If the connections are not shut down, the test set properties will be re-used, causing the caching behavior.
I tried using the Disconnect method of the QCUtil interface to shut down the connections, but that does not work. QCUtil only accesses one of the connections, it does not affect the second connection.
To prevent the caching behavior, it is necessary to shut down both connections at the end of a test set. The QCUtil interface only accesses one of these connections, so it cannot be used to shut down or reset both connections.
I found part of a workaround on the HP forum here. A QTP script has to launch an external VBS script that shuts down QTP.
I added some code to shutdown the connections using the TDConnection object in the QTP automation interface. This method shuts down both connections. The VBS file looks like this:
'Give time for QTP script that called this to finish
WScript.Sleep(10000)
'Access the running QTP application
Set qtApp= GetObject("","QuickTest.Application")
'Close the Quality Center connection, if any
If qtApp.TDConnection.IsConnected Then
qtApp.TDconnection.Disconnect
End If
'Shut down QTP
qtApp.Quit
This code will tell QTP to close its QC Connection, and then close QTP. The next time a test set is run (even the same test set with different test set properties), QC will launch QTP with a new QC Connection, then QC will pass the current test set properties to QTP when it runs.
This workaround does not completely eliminate the issue, but it does help.