从独立应用程序执行编码的UI测试 [英] Executing coded UI test from a standalone application

查看:315
本文介绍了从独立应用程序执行编码的UI测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一些有关如何执行使用MSTest的实用代码UI测试几个博客帖子,但我需要从我的C#应用​​程序执行。我想最简单的事情:我创建了一个控制台应用程序,添加到

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

和我想从我的应用程序中调用UI测试方法。我得到了以下错误:

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.



我想引用这是有关UI测试其他组件,但误差保持不变。也许有东西,我要补充的App.config才能够运行测试?

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?

推荐答案

我执行编码的UI测试用一个bat文件,你可以在CUIT测试.dll文件简单地复制到你的应用程序,并通过一个bat文件来执行调用它。
甚至可以使用测试代理从不同的机器,在那里你
没有Visual Studio中运行代码UI测试。

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:

运行DLL的所有测试方法:

Run All Test methods from DLL :


"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" /testcontainer:"DLL_Location\CUIT_03.dll" /resultsfile:"ResultFile_Location\result.trx"

运行单一测试方法从DLL:

Run Single Test Method From DLL:


"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" /testcontainer:"DLL_Location\CUIT_03.dll" /test:"TestMethodName" /resultsfile:"ResultFile_Location\result.trx"

这篇关于从独立应用程序执行编码的UI测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆