Question

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.StartApplication(); 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."

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top