Automation on different System Name?

Experiences, small talk, and other automation gossip.
SolomonShawn
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
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6553
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

Hi,

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

User avatar
DrPsyche
Posts: 6
Joined: Tue Dec 11, 2018 12:27 pm

Re: Automation on different System Name?

Post by DrPsyche » Wed Mar 24, 2021 7:24 am

SolomonShawn wrote:
We are trying to automate tests on our multiple computers. What we need to do is to change variable for each computer as the login for its name. But as we found the a user is required to pay for dissertation to get the full copy of the automation testing tools.
Hello,

You can simply add a variable to the repository in Ranorex. Then it will be accessible as yourrepo.yourvariable in c#. And a default value can be set in Ranorex.

User avatar
DrPsyche
Posts: 6
Joined: Tue Dec 11, 2018 12:27 pm

Re: Automation on different System Name?

Post by DrPsyche » Wed Mar 24, 2021 7:25 am

Update
Here's a guide how to share data properly between modules:

https://www.ranorex.com/blog/sharing-da ... o-another/