VS 2010 codeD UI测试 - 启动引用应用 [英] VS 2010 Coded UI Test - Launch Referenced Application

查看:183
本文介绍了VS 2010 codeD UI测试 - 启动引用应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visuial Studio的codeD UI测试运行在一个WPF应用程序的自动化UI测试每次构建我的TFS服务器上运行。我正在为基于它刚建成的道路,包括配置(86,64)上推出动态可执行文件的问题。

I'm using Visuial Studio's Coded UI Tests to run Automated UI tests on a WPF Application everytime a build runs on my TFS server. The problem I am running into is dynamically launching the executable based on the path where it was just built to, including the configuration(x86, x64).

有没有什么办法让一个引用的项目的路径,一个可执行文件,这样我可以从我的测试项目动态启动的应用程序?

Is there any way to get the path to an executable in a referenced project so that I can launch the application dynamically from my test project?

推荐答案

MSTest的:


  1. 打开您的.testsettings文件,并检查在部署一节启用部署。

  2. 在您的测试项目中右键单击并选择添加现有的项目。

  3. 浏览到您的应用程序来测试的生成位置。

  4. 找到你的可执行文件,并选择添加链接(确保你要么包括所有的应用程序依赖的DLL,如果他们不是已经被你的测试项目中引用。)

  5. 右键单击该链接到可执行文件并选择复制始终(这将.exe文件的新版本复制到时候它是建立在你的测试bin目录)

  6. 在你的 [TestInitialize] 添加下列启动应用程序:

  1. Open your .testsettings file and check the "Enable Deployment" under the deployment section.
  2. In your test project right-click and select Add Existing Item.
  3. Browse to the build location of your application to test.
  4. Find your executable and select "Add as link" (make sure you either include all of your apps dependent DLL's if they are not already referenced by your test project.)
  5. Right click the link to the executable and select "Copy Always" (this will copy a new version of the .exe to your tests bin directory when it is built)
  6. In your [TestInitialize] add the following to launch your app:

_yourApp = ApplicationUnderTest.Launch(Path.Combine(Directory.GetCurrentDirectory(), "yourexecutablename.exe"));


  • 在你的 [TestCleanup] 添加以下内容:

    _yourApp.Close();


  • NUnit的:(你将需要引用和使用Microsoft.VisualStudio.TestTools.UITesting)

    NUnit: (you will need to reference and use Microsoft.VisualStudio.TestTools.UITesting)


    1. 在您的测试项目中右键单击并选择添加现有的项目。

    2. 浏览到您的应用程序来测试的生成位置。

    3. 找到你的可执行文件,并选择添加链接(确保你无论是包含所有应用程序的依赖
      DLL如果尚未按你的测试项目中引用的。)

    4. 右键单击该链接到可执行文件并选择复制始终(这将.exe文件的新版本复制到时候它是建立在你的测试bin目录)

    5. 在你的 [设置] 添加下列启动应用程序:

    1. In your test project right-click and select Add Existing Item.
    2. Browse to the build location of your application to test.
    3. Find your executable and select "Add as link" (make sure you either include all of your apps dependent DLL's if they are not already referenced by your test project.)
    4. Right click the link to the executable and select "Copy Always" (this will copy a new version of the .exe to your tests bin directory when it is built)
    5. In your [Setup] add the following to launch your app:

    _yourApp = ApplicationUnderTest.Launch("yourexecutablename.exe"));


  • 在你的 [拆解] 添加以下内容:

    _yourApp.Close();


  • 请注意:我还没有验证NUnit的执行

    note: I have not verified the NUnit implementation

    这篇关于VS 2010 codeD UI测试 - 启动引用应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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