DavidFRobb
14 years agoNew Contributor
Unable to access certain properties in a large Delphi application
Hi everyone,
We're using Delphi XE, TestComplete 9 under Win7-64.
We are experiencing some problems accessing Delphi properties in a very large Delphi application (2.4+ MLOC). It seems that RTTI is generated for these properties, but TestComplete cannot read or write the properties.
In most cases, the following error is generated: "The property or method does not exist or it is used incorrectly. (You are trying to read a write-only property or to write to a read-only property)"
The properties of course do have readers and/or writers when necessary. Sometimes the read accessors are functions, sometimes they map directly to fields. I have discovered that if the reader or writer is a function, I can call that function and that always seems to work.
For example, I have a TAdvColumnGrid object. If I try to access the grid's Row property I get the error above. The definition of that property is:
published
property Row: Integer read GetRowEx write SetRowEx;
If I call GetRowEx the TestComplete script works properly and all is good. I can also successfully call SetRowEx.
If I use the Object Spy to look at the object in question, the Col and Row properties (which are two that I know aren't working) are listed in the Debug Agent section of the Advanced View, but the properties do not show a value (there should be an integer in the value column but there is nothing there at all). Most other properties do show values.
Here is another example. We have a property on a form that returns an object:
public
property QAKeywords: TQAKeywords read FQAKeywords;
If the property is public, it is not accessible to TestComplete unless I replace read FQAKeywords with GetQAKeywords and write the function so that is returns the private FQAKeywords object.
published
property QAKeywords: TQAKeywords read FQAKeywords;
When the property is scoped published, it works properly as declared above, but I think this is a coincidence, since other inaccessible properties are published.
An interesting clue: when the property above is declared public, the class is not accessible to the Object Spy. The application under test crashes as soon as I use the Object Spy to look at that form. Test Complete then displays the error "The RPC server is not available".
None of these problems are reproducible in small test applications.
I have tried various techniques, such as "VCLObject()", or direct variable naming (p.Window('WindowName').ObjectName and also tried using NativeDelphiObject. None of these techniques worked.
My questions are:
1. Does anyone know whether this is an issue in TestComplete or in Delphi?
2. Is anyone aware of any limitations on the amount of debug info that Delphi can generate (or TestComplete can read) properly? Our application isn't getting any smaller and I suspect that this problem will eventually manifest itself when accessing methods as well as properties. That will impact our ability to use TestComplete to test our application.
Thanks in advance,
Dave
We're using Delphi XE, TestComplete 9 under Win7-64.
We are experiencing some problems accessing Delphi properties in a very large Delphi application (2.4+ MLOC). It seems that RTTI is generated for these properties, but TestComplete cannot read or write the properties.
In most cases, the following error is generated: "The property or method does not exist or it is used incorrectly. (You are trying to read a write-only property or to write to a read-only property)"
The properties of course do have readers and/or writers when necessary. Sometimes the read accessors are functions, sometimes they map directly to fields. I have discovered that if the reader or writer is a function, I can call that function and that always seems to work.
For example, I have a TAdvColumnGrid object. If I try to access the grid's Row property I get the error above. The definition of that property is:
published
property Row: Integer read GetRowEx write SetRowEx;
If I call GetRowEx the TestComplete script works properly and all is good. I can also successfully call SetRowEx.
If I use the Object Spy to look at the object in question, the Col and Row properties (which are two that I know aren't working) are listed in the Debug Agent section of the Advanced View, but the properties do not show a value (there should be an integer in the value column but there is nothing there at all). Most other properties do show values.
Here is another example. We have a property on a form that returns an object:
public
property QAKeywords: TQAKeywords read FQAKeywords;
If the property is public, it is not accessible to TestComplete unless I replace read FQAKeywords with GetQAKeywords and write the function so that is returns the private FQAKeywords object.
published
property QAKeywords: TQAKeywords read FQAKeywords;
When the property is scoped published, it works properly as declared above, but I think this is a coincidence, since other inaccessible properties are published.
An interesting clue: when the property above is declared public, the class is not accessible to the Object Spy. The application under test crashes as soon as I use the Object Spy to look at that form. Test Complete then displays the error "The RPC server is not available".
None of these problems are reproducible in small test applications.
I have tried various techniques, such as "VCLObject()", or direct variable naming (p.Window('WindowName').ObjectName and also tried using NativeDelphiObject. None of these techniques worked.
My questions are:
1. Does anyone know whether this is an issue in TestComplete or in Delphi?
2. Is anyone aware of any limitations on the amount of debug info that Delphi can generate (or TestComplete can read) properly? Our application isn't getting any smaller and I suspect that this problem will eventually manifest itself when accessing methods as well as properties. That will impact our ability to use TestComplete to test our application.
Thanks in advance,
Dave