Automation on different System Name?

Experiences, small talk, and other automation gossip.
Posts: 1
Joined: Tue Apr 14, 2020 5:29 am

Automation on different System Name?

Post by SolomonShawn » Tue Apr 14, 2020 5:41 am

Hi we are automating tests on 3 computers. I wanna change variable for every computer as login of computer name ( System.Environment.MachineName ). Can someone help me? I`m trying to do that as class but doesn`t work.

This Question was asked already and answered as
public void getHostname()
TestSuite.Current.Parameters["Hostname"] = Environment.MachineName; // get current hostname
Report.Info("New: " + TestSuite.Current.Parameters["Hostname"]); // store hostname in global parameter 'hostname'

But our point is that above code is not working which copy it on user code

Kindly say a way to use the above code like where we have to insert and call it

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

Re: Automation on different System Name?

Post by odklizec » Tue Apr 14, 2020 9:26 am


Are you using repository? It should be enough to simply replace host name in root xpath element with whatever you want (via variable) or eventually, you can add all required host names with OR operator. Could you please share a screenshot of your repository and xpath you want to improve with variable?
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