How to use the same Key Sequence variable in diff recording

Class library usage, coding and language questions.
pksy
Posts: 10
Joined: Fri Dec 16, 2011 7:06 pm

How to use the same Key Sequence variable in diff recording

Post by pksy » Tue Dec 20, 2011 8:27 pm

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.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

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

Post by Ciege » Tue Dec 20, 2011 8:34 pm

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.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

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

Post by omayer » Wed Dec 21, 2011 3:26 pm

"A single DLL that holds common methods and procedures that each individual test use" , Ciege would you please give a sample on this
Tipu

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

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

Post by Ciege » Wed Dec 21, 2011 4:09 pm

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.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

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

Post by omayer » Wed Dec 21, 2011 5:32 pm

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.
Tipu

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

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

Post by omayer » Wed Dec 21, 2011 5:59 pm

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
Tipu