Global parameters

Ask general questions here.
Posts: 43
Joined: Fri Jan 17, 2020 5:29 am

Global parameters

Post by kavya13 » Fri Feb 14, 2020 1:08 pm

Hello Team,

Kindly let me know, can we give data from the excel sheet and declare a global parameter and bind the variables to the global parameters.

Thanks in advance.

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

Re: Global parameters

Post by odklizec » Fri Feb 14, 2020 1:23 pm


Binding Global Parameters with Excel sheet is not possible. But you can fill Global Parameters from code. Here is an (old) example code:

Code: Select all

/// <summary>
/// Set Up global parameters from excel file
/// </summary>
/// <param name="scDataConnectorName">Name of excel data conector defined in data source</param>
public void setUpGlobalParameters(string scDataConnectorName)
    if (DataSources.Get(scDataConnectorName) != null)
        Ranorex.Core.Data.DataCache MyDataCache = DataSources.Get(scDataConnectorName);
        int curIterationNum = getIterationNumber();
        if (MyDataCache.Rows.Count == 1)
            curIterationNum = 0;
        foreach(var col in MyDataCache.Columns)
            TestSuite.Current.Parameters.Add(col.Name, MyDataCache.Rows[curIterationNum].Values[col.Index]);
            Report.Info("Param. name: " + col.Name + " " + "Param. value: " + MyDataCache.Rows[getIterationNumber()].Values[col.Index]);
I'm not using this code in any of my actual projects, so it may need to be updated with actual Ranorex API ;)
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