Invoking private methods : Automation API

Invoking private methods

Class library usage, coding and language questions.

Invoking private methods

Postby mgrinder » Wed May 14, 2008 6:09 pm

Can Ranorex invoke private methods on a .NET control?
mgrinder
 
Posts: 2
Joined: Wed May 14, 2008 6:07 pm

Postby Support Team » Thu May 15, 2008 10:56 am

Technically, invoking private methods would be possible. However, it is not supported since the names of private methods could interfere with the names of public methods.

Anyway, private methods are usually private for a reason. If you need to call the method, why not make it public or provide a public method that calls the private one?

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Postby mgrinder » Thu May 15, 2008 5:24 pm

Support Team wrote:Technically, invoking private methods would be possible. However, it is not supported since the names of private methods could interfere with the names of public methods.

Anyway, private methods are usually private for a reason. If you need to call the method, why not make it public or provide a public method that calls the private one?


Because making the method public would require justifying the change to development. The developers are very resistant to making changes even if it makes QA's job easier. You obviously haven't actually used your product to test a real application. :-)

Well, I guess that rules out Ranorex for my particular set of problems.
mgrinder
 
Posts: 2
Joined: Wed May 14, 2008 6:07 pm

Postby Support Team » Thu May 15, 2008 6:24 pm

mgrinder wrote:Because making the method public would require justifying the change to development. The developers are very resistant to making changes even if it makes QA's job easier.

Well, I think you got me wrong. What I meant is that usually there is no sense in calling private methods since they are not meant to be called from outside and may be changed or deleted at any time in development. If a private method should be callable, in other words if it should be part of the API, it needs to be marked public.

However, I can understand that there are reasons one would like to call private methods for testing, e.g. to set objects to a certain state. That's why I added this feature to our wanted features list for the next Ranorex version.

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests

cron