QTP And C# Objects (551 Views)
Reply
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 1 of 24 (551 Views)
Accepted Solution

QTP And C# Objects

I was trying to add various objs of an application to the Object Repository. The app was created in C#. I have just the .NET Add-in loaded. At first, it saw everything was a class Window object. Somehow, I was able to learn the app with class swfWindow. At this point, it recognized buttons, tab objects, checkboxes, etc which was great. Just for curiosity, I was trying the different Add-ins and now, even when I go back to loading just the .NET Add-in it sees the entire app as a Window object again. What happened? What should I do in general when working with an app created using C#?

- Thanks
Honored Contributor
john scarpino
Posts: 1,344
Registered: ‎02-15-2008
Message 2 of 24 (551 Views)

Re: QTP And C# Objects

Alan:

Stick with one add-in. If you use one add-in then di-select it and choose another the script will not run. So stay with what it was recorded with. I usally document in the script which add-in was used to execute the script.

I hope this helps.
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 3 of 24 (551 Views)

Re: QTP And C# Objects

Thanks.

I'm back to using the .NET Add-in only like I had originally but QTP still sees the entire app as Windows objects.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 4 of 24 (551 Views)

Re: QTP And C# Objects

Alan, you did not post versions of your QTP and .NET add-ins and info on your Operating system.
In general, when this happens, make sure:

1. You install the .net framework first before installing .net add-in.
2. Patches if any applicable to your versions of QTP / .NET add-ins are all installed.
3. Launch QTP before launching your application under test.
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 5 of 24 (551 Views)

Re: QTP And C# Objects

Thanks Krishna.

I have .NET Framework 3.0 (SP1) installed
I launched QTP with the .NET add-in then started the app

Since all objects were learned as class Swf (SwfWindow, SwfButton, SwfCheckBox, etc..), does that mean I had the .NET Add-in loaded at the time? I'm pretty sure I did.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 6 of 24 (551 Views)

Re: QTP And C# Objects

Yes, if it recognizes them as SwfObject etc, your .NET add-in is loaded and working.

You say you have .NET 3.0 framework installed. a) What is your QTP version and
b) what version of .NET runtime is your application using?
c) Also, is your application WPF based? If so, are you loading WPF add-in as well?
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 7 of 24 (551 Views)

Re: QTP And C# Objects

QTP 9.5
.NET Runtime 2.0
Not WPF based
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 8 of 24 (551 Views)

Re: QTP And C# Objects

Alan,
you are probably noticing this. Can you confirm?
When you bring up QTP with .NET add-in loaded and then the application, at first it recognizes everything as standard Windows Objects...but if you try to "record" anything, it starts recognizing everything from then on with Swf....class as it should have in the first place.
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 9 of 24 (551 Views)

Re: QTP And C# Objects

Actually, I get the SystemUtil.Run... line when I start the app then nothing else as I do other things on the app. I'm thinking maybe I should re-install QTP?
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 10 of 24 (551 Views)

Re: QTP And C# Objects

Re-installed but no luck. Same problem. I don't understand how QTP was able to see all of the objs as SWF objs once then never again. Extremely frustrating. I long for the care-free days of WinRunner.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 11 of 24 (551 Views)

Re: QTP And C# Objects

Alan, can you do this?
Start QTP with .NET add-in loaded, start the application, spy on the main window of the application as well as any other standard control like a button etc, and post screenshots of what the Object Spy sees in each case.
Trusted Contributor
CARTMAN_1
Posts: 153
Registered: ‎04-10-2008
Message 12 of 24 (551 Views)

Re: QTP And C# Objects

Try running these batch files : "QuickTestProfessional.bat" and "QuickTestProfessional.NETAddin.bat".

Location of the files :

C:\Program Files\Mercury Interactive\QuickTest Professional\bin
------------------------------------------
Read this :

http://geekswithblogs.net/MaryanneSweat/archive/2007/07/17/Why-does-QTP-lose-its-mind.aspx
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 13 of 24 (551 Views)

Re: QTP And C# Objects

All set. Attachment shows shot of version and .NET add-in selected, then shots of how QTP sees the main window and a few different objects, then a shot of the original Swf objects that are no longer found.

Thanks
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 14 of 24 (551 Views)

Re: QTP And C# Objects

Alan,
your add-in manager dialog does not look right. Where are the default add-ins that are supposed to be there? ..like VB, ActiveX etc..I know you may not need those for your application. But, it means that during installation, these add-ins were omitted somehow and hence QTP cannot be considered installed properly. Please uninstall completely and go through custom installation procedure and make sure the default set up is not modified in anyway except for the addition of .NET add-in.
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 15 of 24 (551 Views)

Re: QTP And C# Objects

Thanks for the info and the article SVK.

I just noticed that my install path is C:\Program Files\HP.. instead of C:\Program Files\Mercury Interactive... I assume that doesn't matter?

Beyond that, neither of the .bat files you specify exist in this dir or anywhere on my C: drive for that matter.

Since they say to delete the install dir when re-installing, I'm going to do that now that I know where the install dir is. Maybe those .bat files will get re-created?
Trusted Contributor
CARTMAN_1
Posts: 153
Registered: ‎04-10-2008
Message 16 of 24 (551 Views)

Re: QTP And C# Objects

Hi Alan,
We are on QTP 9.2 ,and after the HP-Mercury merger ,the file name was changed to HP.thats why ur files are stored in diff location.
Iam not sure why you dont see those files .
Trusted Contributor
CARTMAN_1
Posts: 153
Registered: ‎04-10-2008
Message 17 of 24 (551 Views)

Re: QTP And C# Objects

Please see the attached img of how the batch files will look like :
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 18 of 24 (551 Views)

Re: QTP And C# Objects

After re-installing QTP9.5, I still don't aee those .bat files. I have the files before and after them based on the screenshot you attached but not the .bat files. The only .bat files I have in the bin dir are:

Bpt4ErpCrmRegAssemblies.bat
RegCommonExtAssemblies.bat
RegVerFormAssemblies.bat
WinFormsInstLic.bat

I don't know what they do but I ran them anyway but QTP still doesn't see the objects as class Swf either before or after running the .bat files.

Could you attach them and I could try running them? I've got nothing to lose at this point.
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 19 of 24 (551 Views)

Re: QTP And C# Objects

Also, I installed with all of the default add-ins plus the .NET add-in. Previously, I excluded some add-ins that I knew I didn't need but this time, I included all of the default add-ins.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 20 of 24 (551 Views)

Re: QTP And C# Objects

Alan,
I use QTP 9.5 and I can tell you for a fact those .bat files do not exist in 9.5. What you are seeing is fine. What you may not be paying attention to is one of my posts above where I mentioned your installation is not right based on how your add-in manager dialog looked like. Can you read that again and attempt what I suggested?
By the way, when I uninstall, I restart after the uninstall, get rid of HP folder, get rid of Mercury Interactive folder under Program files\Common Files, get rid of Mercury Interactive (entire key hierarchy) in both HKLM and HKCU in registry and restart again.
Trusted Contributor
CARTMAN_1
Posts: 153
Registered: ‎04-10-2008
Message 21 of 24 (551 Views)

Re: QTP And C# Objects

Alan,
Krishna is right there are no batch files in QTP9.5 .

The batch files registers all the Dll files that QTP has .I installed QTP9.5 trial version on a different machine and copied over the two .bat files(from QTP9.2) to the bin folder of QTP 9.5 and when I ran them it registered all the files that QTP had.

Prob if you haven't uninstalled QTP yet you can try this .Copy these files to the bin folder of your QTP and run them.
Advisor
Naag
Posts: 20
Registered: ‎03-05-2008
Message 22 of 24 (551 Views)

Re: QTP And C# Objects

Hi Alan,
Can u try this.We are currentlu working on QTP 9.0.
Go to Automation Menu,select Record and run settings.In Record and run settings Dialog box select "windows Apllications" tab.Then select radio button next to the "Record and run test on any open windows-based application".

I hope it will work.
Regular Advisor
Alan Abreu
Posts: 102
Registered: ‎04-17-2008
Message 23 of 24 (551 Views)

Re: QTP And C# Objects

IT WORKED! Thanks Naaq and thanks everyone else for all of your help. One stupid setting. Unbelievable. For the record, the 'Record and run on any Windows based..' s/b the default setting.
Occasional Advisor
SachinCoorg
Posts: 9
Registered: ‎06-12-2008
Message 24 of 24 (551 Views)

Re: QTP And C# Objects

I have a similar problems, QTP8.2 spys all the .net fron-end c# application (CRD) as window based objects. I have Installed .net add-in, still no help.

One more point, QTP unable to identify any objects while recording.

I want the objects to be identified as .net objects.

Any help pls, Attached snapshot
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.