Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing parameters to a Coded UI Test which is run from command line with MSTest.exe

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"?

like image 873
i know nothing Avatar asked Oct 21 '22 13:10

i know nothing


1 Answers

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.

like image 163
chaliasos Avatar answered Oct 24 '22 04:10

chaliasos