Page 1 of 1

How to use the same Key Sequence variable in diff recording

Posted: Tue Dec 20, 2011 8:27 pm
by pksy
Hi,

I have several recordings where I enter the same company name in a text field on different pages of the application. I then converted the company name into a variable for all those recordings. I also have a global parameter "companyName" where the value is "Test Company". I understand that one option is to bind the global paramenter "companyName" to every company name variable in each recording. Another option is to use a code module where I have a line for each recording to set the variables. For ex:

Recording1.Instance.companyName = TestSuite.Current.Parameters["companyName"];
Recording2.Instance.companyName = TestSuite.Current.Parameters["companyName"];
Recording3.Instance.companyName = TestSuite.Current.Parameters["companyName"];
...

Both options seems to be inefficient especially if I have a lot of recordings entering the company name. Is there a better way of doing this? I was hoping that in each recording, I could pick the same companyName variable for each recording.

Re: How to use the same Key Sequence variable in diff recording

Posted: Tue Dec 20, 2011 8:34 pm
by Ciege
Sounds like to me that its time for you to start exploring using a common framework. A single DLL that holds common methods and procedures that each individual test use. With a common framework you only have a single place to modify code that will trickle down into each individual test script when compiled.

Re: How to use the same Key Sequence variable in diff recording

Posted: Wed Dec 21, 2011 3:26 pm
by omayer
"A single DLL that holds common methods and procedures that each individual test use" , Ciege would you please give a sample on this

Re: How to use the same Key Sequence variable in diff recording

Posted: Wed Dec 21, 2011 4:09 pm
by Ciege
Depends on the IDE you use to create the DLL properly, but I use Visual Studio. Create a new project for use as a DLL, add your standard references you would normally add (i.e. all your Ranorex references), add your code to the project. Compile and save it as a DLL named appropriately (I name mine RanorexFramework).
Now, from each of your tests, add a new reference to the DLL you created and viola, you can now access the code modules you created in your framework DLL from each individual test that references that DLL.

Further, you can create separate public classes within the DLL to help separate the different types of methods you wish to share. For example, in my framework, I have my "AUT" class that contains methods for dealing with my AUT, I have a "DOM" class, an "Excel" class, etc...

One place to make code changes and all my tests get the benefit of reusing the code I only had to write once.

Re: How to use the same Key Sequence variable in diff recording

Posted: Wed Dec 21, 2011 5:32 pm
by omayer
thank you Ciege, i am starting building common framework now, would you please tell me what is the difference between "Ranorex Test suite module" and "Ranorex Class library" . looks like i can create code module from either location.

Re: How to use the same Key Sequence variable in diff recording

Posted: Wed Dec 21, 2011 5:59 pm
by omayer
Here is the framework that i am building right now-

UtilityTestLibrary - which contains code module > AUT , Browser, OpenTestEnv, CSVparser,WriteTOXls, emailsend

ApplicaionSpecificTestlibrary - which contains multiple code modules named by the page, broken down with moduler base approach, each code module contains all the controls as a method that belongs to that page

TestSuite - referenced above testlibrary and then drag and drop whichever code module that that i need to run the test.

Ciege, please give some feedback
Thank you,
Beginner