I have a CodedUiTest which has several test methods. I want to be able to pass a different path to the test each time I execute it from the command line via MSTest. How can I achieve this?
This is how I execute the test now:
{
System.Diagnostics.Process codedUIProcess = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo codedUIStartInfo = new System.Diagnostics.ProcessStartInfo();
codedUIStartInfo.FileName = @"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe";
codedUIStartInfo.Arguments = @"/testcontainer:C:\DailyBuildAutoTest.dll /test:MyUITestAssembly\MyCodedUITest";
codedUIStartInfo.CreateNoWindow = true;
codedUIProcess.StartInfo = codedUIStartInfo;
codedUIProcess.Start();
}
Is there any way to pass parameters like a string to "MyCodedUITest"?
No, unfortunately there is no way to do that. Check the MSTest Command-Line Options
The only possible way I can think is to associate the CodedUi Tests
with the Test Cases
and run them from Microsoft Test Manager.
Then you can easily parameterize the tests by adding parameters to test cases. These parameters are the DataSource
of the associated test and you can read them from your CodedUi Test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With