Question about variables.

Ask general questions here.
Maslak
Posts: 3
Joined: Fri Dec 14, 2012 1:19 pm

Question about variables.

Post by Maslak » Fri Dec 14, 2012 1:24 pm

Hi,i`m doing automotive 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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Question about variables.

Post by Support Team » Wed Dec 19, 2012 11:46 am

Hello,

You could use use the following code to store your hostname in a global parameter:
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'
}
Regards,
Markus (T)
.
Image