Function Library

Ranorex Spy, Recorder, and Studio.
Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Function Library

Post by Deepak_Singh » Wed May 21, 2014 7:50 am

Hi All,

Back with new Problem :wink:

I have Created a New Project and Made Different TC's in the Suite.
Now I am having Problem: I have a Function named Screen Validation
I wrote it in Code Module and Was using it by Drag and Drop.

Now the Problem is I want to get a value from this Module(Screen Validation) to the Main Test Case but I think that is Not Possible. Or is it? :?:

Is there a way we can use this in any Function Library and call the function any number of times we want from a Code Module?

If Yes then How? :?:
Because I have seen the Posts of Creating Function Library and were not of any Help.

Please Help on this ASAP.

Support team any comments?

Regards,
Deepak :(

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Function Library

Post by Deepak_Singh » Thu May 22, 2014 5:02 pm

Hey Guys are you all Sleeping????


Please reply. I am waiting for ur Reply.
Reply fast.

Ranorex Team????? :?:


Regards,
Deepak

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3914
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Function Library

Post by odklizec » Thu May 22, 2014 9:46 pm

Hi, what you probably looking for is so called "inheritance". Simply, create a new class (let's call it "Common.cs") move your method from the user code to this new "Common" class and then inherit that class with each user code where you would like to use the methods from the common class. The inheritance code should look like this...
public partial class Recording1:Common


For more details take a look at this post...
http://www.ranorex.com/forum/usercode-f ... t4048.html

Or this msdn page:
http://msdn.microsoft.com/en-us/library ... S.80).aspx

Hope this helps?
Last edited by odklizec on Mon Feb 09, 2015 10:39 am, edited 3 times in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Function Library

Post by Deepak_Singh » Fri May 23, 2014 6:04 am

Request you to Provide Snapshots as The Link you Provided talks about Recording which I never use and The Microsoft Link says "Content Not Found".


Please Help.


Regards,
Deepak

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3914
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Function Library

Post by odklizec » Fri May 23, 2014 7:24 am

Hi,

Snapshot is of no use here. The link I provided is about the subject of inheritance, with some code examples. It's just a general example how to use inheritance.

Another examples can be found here:
http://www.ranorex.com/forum/feature-re ... tml#p14251
http://www.ranorex.com/blog/keyword-dri ... work#table

Some other examples can be found by using "Search" facility. It was discussed many times in the past.

The MSDN link is now fixed. It was incorrectly parsed by the forum.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Function Library

Post by Deepak_Singh » Thu May 29, 2014 11:04 am

I got the Inheritance thing but when I Replace the : keywordLibrary

Then it gives me error.

Plz help,
Regards

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3914
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Function Library

Post by odklizec » Thu May 29, 2014 11:10 am

Hi,

I'm afraid, you need to be a bit more specific ;) What kind of error you getting? Could you please post a sample project or at least an excerpt from your code?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration