Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

c# - Executing coded UI test from a standalone application

I found several blog posts about how to execute code UI tests using mstest utility, but I need to execute them from my C# application. I tried the simplest thing: I created a console application, added references to

  • Microsoft.VisualStudio.TestTools.UITest.Logging.dll
  • Microsoft.VisualStudio.TestTools.UITest.Playback.dll
  • Microsoft.VisualStudio.TestTools.UITesting.dll

and I tried calling UI test method from my application. I got the following error:

The following is not a valid technology name: MSAA. To search for a control, you must specify a valid technology name.

I tried referencing other assemblies which are related to UI testing, but the error stays the same. Maybe there's something that I should add to App.config to be able to run the tests?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I am executing the coded UI test with a bat file, you can simply copy the CUIT test .dll file to your application and call it by a bat file to execute. Even you can use Test Agents to run the Code UI Test from different machines, where you don't have Visual Studio.

my bat file looks like this:

Run All Test methods from DLL :


"C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEmstest.exe" /testcontainer:"DLL_LocationCUIT_03.dll" /resultsfile:"ResultFile_Location
esult.trx"

Run Single Test Method From DLL:


"C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEmstest.exe" /testcontainer:"DLL_LocationCUIT_03.dll" /test:"TestMethodName" /resultsfile:"ResultFile_Location
esult.trx"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...