passing command line arguments in coded ui tests

2019-06-28 05:57发布

问题:

Is it possible to pass command line arguments in coded ui test ? in normal C# programs we just pass the arguments along with the exe file eg: filename.exe "2" "7" in command prompt.

but can something like this be done in coded ui tests?

Thanks

回答1:

No, you can do that. CodedUi tests are executed through command line through MSTest which does not support it. Check here to see the available command-line options of MSTest.

However, you can create another Project (e.g. console application) to achieve that. The second project has a reference to your CodedUI Project. Then pass the parameters through the .exe file of this Project which calls the appropriate CodedUI Test Method. But I think that this will not work like MSTest does (it will not create Test Results).