A co-worker was recently having issues with some business process testing scripts that he converted from Quick Test Professional 10 to QTP 11. He asked if I had ever heard of any issues with using the TestName environment variable functionality in BPT when running from ALM. I was not aware of any issues, but after doing some quick research I found out the following:
In a nutshell, when using the TestName environment variable, there is a difference in behavior between the testing tool versions of QTP 10, QTP 11 and UFT—WTF?
The TestName Issue
A quick way to see this behavior is to create a test in QTP 10 and:
- Add the following code:
- Save and Run the test from the ALM Test Plan section.
- The name of the actual component being run should appear.
- If you run the same script using QTP 11 this behavior does not work.
Annoying, right? But I’m not sure I can blame HP for these behavior changes.
BPT Performance Issue
Anyone that has used business process testing from the beginning will tell you that BPT has a performance issue. In QTP, this performance issue was due to BPT opening and closing QTP for each and every component. As you know, starting QTP itself can be a slow process so you can imagine what happens when you have a BPT test that potentially contains hundreds of components.
In ALM/QTP 11, HP made some changes to try to fix this issue by introducing the BPTWrapperTest feature. This change basically takes a BPT test, downloads all its components at once, and generates a single QTP “BPT Wrapper” test to run. This change was meant to help avoid the BPT performance issue seen in QC 10. I personally have not seen much improvement in our BPT performance, regardless of which version of HP’s test tool version we are using.
How to Fix the BPT issue
The reason for this little history lesson is that since QTP 10 starts each component individually, it shows the component name. In QTP 11, because of the new BPTWrapper feature, the components are being converted into actions at runtime.
So the quick fix is to change any BPT code that contains TestName and replace with ActionName instead:
If you convert your test scripts from QTP 11 to Unified Functional Testing, be warned — UFT also displays completely different behavior and only returns the BPT test name.