开发者

Coded UI Test - How to change the exe it runs

开发者 https://www.devze.com 2022-12-29 05:49 出处:网络
I created a Coded UI Test from a Microsoft Test Manager recording.The exe it runs is the one the tester recorded against.

I created a Coded UI Test from a Microsoft Test Manager recording. The exe it runs is the one the tester recorded against.

I want this to be a test I run with my build. How do I change the exe that the coded UI test uses to be the output of:

  1. The TFS Build when a TFS Build is being run
  2. The local build when the test is being run on my machine.

I do NOT need help adding my Coded UI test to my TFS Build. There are several great posts on that already.

I don't have ApplicationUnderTest.Launch. I have this.UIMap.Star开发者_JAVA百科tApplication(); which then runs generated code (in CodedUI.Designer.cs). Best Practices for Coded UI tests says "Do not edit the UIMap.designer.cs file directly. If you do so, the changes to the file will be overwritten."


You could add a build configuration to the test project. In that configuration, add a preprocessor definition, PRIVATE_BUILD.

Then, you can use #IFDEF to determine which build to launch:

#ifdef PRIVATE_BUILD
ApplicationUnderTest.Launch(pathToPrivateBuild, "", args);
#else
ApplicationUnderTest.Launch(pathToOfficialBuild, "", args);
#endif // PRIVATE_BUILD

Make sure you don't add that local-only configuration as a flavor for TFS to build during the official build.


You can use the Coded UI Test Editor in Visual Studio Feature Pack 2 to visually update the parameter without any coding.

See the following blog post for a tutorial and info on obtaining the extension: http://windotnet.blogspot.com/#!/2011/07/coded-ui-test-editor-is-visual-studio.html

-Paul

0

精彩评论

暂无评论...
验证码 换一张
取 消