Page 1 of 1

Automation on different System Name

Posted: Wed Oct 11, 2017 11:18 am
by Esivakumar
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

Re: Automation on different System Name

Posted: Wed Oct 11, 2017 12:02 pm
by odklizec
Hi,

I would suggest to read below blog post, in which you can learn how to properly share data between modules, including storing/reading data to/from parameters:
https://www.ranorex.com/blog/sharing-da ... o-another/
I'm not quite sure if the coded way you posted is recommended/publicly available way of storing/reading parameters.

Re: Automation on different System Name

Posted: Wed Oct 11, 2017 5:16 pm
by DavidHay
I added a variable to the repository in Ranorex. It is then available in c# as yourrepo.yourvariable. That way you can set a default value in Ranorex or override it in code if need be.