public void ExecuteUiTestOnRemoteHost() { // Test Assumption C:\_work folder exist on remote Host using (var operatingSystem = new RemoteEnvironment(Ip, UserName, Password, PsToolPath)) { // Copy nUnit test to Guest PC operatingSystem.CopyFileFromHostToGuest( _pathToUinUnitTest + @"\ReSharperUITests.zip", @"C:\_work"); // Unzip nUnit test on Guest PC operatingSystem.WindowsShellInstance.DetachElevatedCommandInGuestNoRemoteOutput( @"7z.exe x -aoa -oc:\_work\Output c:\_work\ReSharperUITests.zip", TimeSpan.FromSeconds(1)); // Execute nUnit test on Guest PC operatingSystem.WindowsShellInstance.DetachElevatedCommandInGuestNoRemoteOutput( @"nunit3-console --work=c:\_work\Output c:\_work\Output\ReSharperUITest.dll", TimeSpan.FromSeconds(1)); // Verify that nunit execution test result (TestResult.xml) exist in "c:\_work\Output" Assert.True(operatingSystem.FileExistsInGuest(@"c:\_work\Output\TestResult.xml")); // Remove previously copied test result if (File.Exists(_pathToUinUnitTest + @"\TestResult.xml")) { File.Delete(_pathToUinUnitTest + @"\TestResult.xml"); } // Copy Test Result from Guest to Host operatingSystem.CopyFileFromGuestToHost( @"c:\_work\Output\TestResult.xml", _pathToUinUnitTest); // TestContext.AddTestAttachment(_pathToUinUnitTest + @"\TestResult.xml", "NUnit Test Result on remote host"); } }
static void Main(string[] args) { using (var operatingSystem = new RemoteEnvironment(Ip, UserName, Password, @"c:\Users\Eugene\source\repos\PSTools\PsExec.exe")) { // Copy nUnit test to Guest PC operatingSystem.CopyFileFromHostToGuest( PathToNUnitTest + @"\ZigZagConversion.zip", @"C:\_work"); // Unzip nUnit test on Guest PC operatingSystem.WindowsShellInstance.DetachElevatedCommandInGuestNoRemoteOutput( @"7z.exe x -aoa -oc:\_work\Output c:\_work\ZigZagConversion.zip", TimeSpan.FromSeconds(1)); // Execute nUnit test on Guest PC operatingSystem.WindowsShellInstance.DetachElevatedCommandInGuestNoRemoteOutput( @"nunit3-console --work=c:\_work\Output c:\_work\Output\ZigZagTest.dll", TimeSpan.FromSeconds(1)); // Verify that nunit execution test result (TestResult.xml) exist in "c:\_work\Output" if (operatingSystem.FileExistsInGuest(@"c:\_work\Output\TestResult.xml")) { // Copy Test Result from Guest to Host operatingSystem.CopyFileFromGuestToHost( @"c:\_work\Output\TestResult.xml", PathToNUnitTest); } } }
/// <inheritdoc/> public void CopyFilesToGuest() { var files = Directory.GetFiles(pathToTests); foreach (var file in files) { operatingSystem.CopyFileFromHostToGuest(file, Path.Combine(guestPathToTests, Path.GetFileName(file))); } }