Page 1 of 1

Function Library

Posted: Wed May 21, 2014 7:50 am
by Deepak_Singh
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 :(

Re: Function Library

Posted: Thu May 22, 2014 5:02 pm
by Deepak_Singh
Hey Guys are you all Sleeping????


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

Ranorex Team????? :?:


Regards,
Deepak

Re: Function Library

Posted: Thu May 22, 2014 9:46 pm
by odklizec
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?

Re: Function Library

Posted: Fri May 23, 2014 6:04 am
by Deepak_Singh
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

Re: Function Library

Posted: Fri May 23, 2014 7:24 am
by odklizec
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.

Re: Function Library

Posted: Thu May 29, 2014 11:04 am
by Deepak_Singh
I got the Inheritance thing but when I Replace the : keywordLibrary

Then it gives me error.

Plz help,
Regards

Re: Function Library

Posted: Thu May 29, 2014 11:10 am
by odklizec
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?