Hi there, I'm currently running on a trial license (of both QTP and TestaAdvantage) so I hope someone can help me quickly!
I am running QTP 9.5 with the .NET add-in; TestAdvantage 2008V1 CLR2, and the application I am testing is written in C# and using NetAdvantage 2008v1 CLR2, so the versions of test and net advantage do matchup.
Here's my problem: I want to be able to retrieve a value from a cell within an UltraWinGrid, when I record a simple click on a cell, QTP records this:
SwfWindow("EMS - Tomi").SwfObject("SwfObject").PaneActivate "Positions"SwfWindow("EMS - Tomi").SwfTable("grid").ActivateRow "10"SwfWindow("EMS - Tomi").SwfTable("grid").ActivateCell "10","Futures"SwfWindow("EMS - Tomi").SwfTable("grid").SelectCell "10","Futures"
When I immediately replay this script, I get an error on the second line (ActivateRow), this error says simply 'General Run Error' and then lists the line in error. Then if I 'skip', the following two lines also throw back the same error. I can seem to access various properties of the grid in a slightly different fashion, for example when I write a script like this (copied from a bit of code that is in one of the samples provided with TestAdvantage):
Dim gridSet grid = SwfWindow("EMS - Tomi").SwfTable("grid").ObjectSet col = grid.DisplayLayout.Bands.getItem(0).Columns.getItem(0)msgbox col
'col' in this case DOES return a value no problems. The only thing is that I am not familiar with the syntax when using the 'Object' method of getting properties, so I don't know if I can access or even set cell properties using this method (The help doesn't seem to provide any examples), and ideally I would like to get to the bottom of why a simple method such as ActivateCell is causing an error.
Does anyone have any ideas?
Many thanks, Ryan.
Hmmm, an interesting twist to the story: When I record an interaction with a different application (this one being a 'test' app and is much simpler in the sense that the grid is not contained within a large heirachy of containers) and replay that, then I CAN subsequently successfully replay the script in my first post!
It seems that whenever I restart QTP, I have to interact with this other application first before my recorded scripts work with my original application I am actually trying to test. Bizarre. I would like to try and find a solution that doesn't involve me having to interact with this other app before I can run my tests.
Cheers, Ryan
"General Run Error" is non-descript error that QTP throws when it is unsure of what is wrong. No error directly related to TestAdvantage code will to my knowledge throw such an error. That is not to say it might not be related to TestAdvantage, or it's setup but it does gives us a general scope of where to look. Let me ask some additional questions to help eliminate other possibilities. From what you are describing it sounds as if it records correctly so unless you manually manipulated yourC:\Program Files\HP\QuickTest Professional\dat\SwfConfig.xml file, your SwfConfig.xml file is likely configured correctly. If there was a possibility of that I would suggest running our Version Utility supplied with TestAdvantage, disabling TestAdvantage and re-enabling it.
I am guessing by your response that my next question would be unnecessary that being, can you record and replay correctly on the samples supplied? By your response I am assuming the answer is yes, that leaves it to something specific in your application an QTP.
The next likely cause is deployment based, that being sometimes an App tested remotely on a network or something similar can cause QTP to get confused in finding all the NetAdvantage assemblies required for our proxies to work correctly. What I would suggest is creating a local directory, adding all of the NetAdvantage assemblies to that directory, and then from their copy them into your global assembly cache(GAC) (typically located at C:\Windows\assembly ) Alternatively if you drop the assemblies in the bin folder of your QuickTestProfessional install directory, that can also resolve this behavior. This may be a distinct possibility with what you described because if your simple sample was on your test machine, not remotely, and had the dll's copy local, it likely found and loaded the dll's correctly, for that app which allowed your larger app to continue.
NOTE: if you change your SwfConfig.xml file, or drop assemblies in the Global Assembly Cache(GAC), or the QuickTestProfessional bin you should close both QuickTestProffesional and your application under testing.
Let me know how those work for you.
As to your cell value question, by retrieving it through the object model as you seem to be attempting to do, it should be noted that the values are not in the column but in the row object. So based on that using your earlier example:
grid.Rows.GetItem(rowNum).Cells.GetItem(cellNum).Value
In the case of Heirarchical data:
grid.Rows.GetItems(parentRowNum).ChildBands(childBandIndex).Rows.GetItems(childRowNum).Cells.GetItem(cellNum).Value
Alternatively you can use GetCellData supplied with TestAdvantage which uses the same variables that is used with ActivateCell and SelectCell. So something like:
MsgBox SwfWindow("EMS - Tomi").SwfTable("grid").GetCellData("10", "Futures")
I hope this answers your question to your satisfaction,
Hi Michael, many thanks for your suggestions. I shall try them out!
I have another question for you but I shall start a new thread for it as it may be relevent for other people to know.
Regards, Ryan
Hi this is adi
I had recorded my application using Test advantage version 2008 and Net advantage 2008
I have recorded my application using infragistic controls and QTP successfully record the methods of ultra explorerbar grid such as set active group, expand group.But when i try to replay the scripts these methods are not recognized.More over i am unable to view these methods in intellisense list for the explorer bar which were recorded by qtp
Please help me out in this regard. Is there something to do with Swfconfig.XML file