Binding variables to recorded modules called via user code : General Questions

Binding variables to recorded modules called via user code

Ask general questions here.

Binding variables to recorded modules called via user code

Postby Pixi6s » Tue Jul 05, 2011 9:15 pm

I created a User Code module that calls recording Modules
Code: Select all
        void ITestModule.Run()
        {
            int x = TestCase.Current.DataContext.CurrentRowIndex;
            if (x == 1)
            {
               SetupShipping.Start();
            }else{
             SetExistingShipping.Start();
            }
        }


Within SetupShipping I have several variables that I need to bind to a data source. Start doesn't take parameters and they no longer just appear in the data binding menu. How would I accomplish this?

Thanks
Pixi6s
 
Posts: 86
Joined: Tue Jun 28, 2011 9:57 pm

Re: Binding variables to recorded modules called via user code

Postby Pixi6s » Wed Jul 06, 2011 5:54 pm

Hello support team,

Is this possible? I have to finish this test soon and I need to know if I am going down the wrong path using record modules asap.

Thanks
Pixi6s
 
Posts: 86
Joined: Tue Jun 28, 2011 9:57 pm

Re: Binding variables to recorded modules called via user code

Postby Support Team » Wed Jul 06, 2011 8:56 pm

Hello,

Sometimes, for branches and special loops, it's necessary to start other modules from user code modules. Just be a aware that this way you are hiding things from the Test Suite view. And there is the problem to forward variables. A solution to the latter could be to manually create variables via Insert Module Variable in the editor's context menu and instead of using the string in the property you forward to the according variables in the called modules.

[TestVariable("A83ECAE2-3EB7-48B3-88BA-15AEC5AF4766")]
public string MyTestVariable
{
    get { return CalledRecording.Instance.MyTestVariable; }
    set { CalledRecording.Instance.MyTestVariable = value; }
}


We are currently working on an extension to the Test Suite to make this less necessary to manually call other modules.

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

Re: Binding variables to recorded modules called via user code

Postby Pixi6s » Fri Jul 08, 2011 4:32 pm

This works great! Thanks
Pixi6s
 
Posts: 86
Joined: Tue Jun 28, 2011 9:57 pm


Return to General Questions

Who is online

Users browsing this forum: No registered users and 1 guest