I am able to execute MSTest with WinAppDriver from a command line with
mstest /testcontainer:C:\Users\...\dev\WinAppDriver\Samples\C#\AlarmClockTest\bin\Debug\AlarmClockTest.dll
Now I have to do the same from another UWP application. I am attempting to do it with Process class. My code:
string filename = @"C:\Users\...\dev\WinAppDriver\Samples\C#\AlarmClockTest\bin\Debug\AlarmClockTest.dll";
try
{
using (Process process = new Process())
{
process.StartInfo.Verb = "runas";
process.StartInfo.FileName = "CMD.exe";
process.StartInfo.Arguments = "mstest /testcontainer:" + filename;
process.StartInfo.UseShellExecute = false;
_ = process.Start();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
When I am executing this code, I am getting cmd prompt opened at my UWP project's directory's bin/x86/Debug/projectname
directory. The command to trigger a test had not been executed. I got same results when I replaced an argument with @ECHO OFF ECHO Hello World!
.