How to change the name of a CodedUI method without Feature Pack 2.

 

Problem:

I want to change the name of a method generated by the Coded UI Builder.

Solution:

Modify the UI map and regenerate code.

Explanation:

I would suggest downloading Feature Pack 2. However, if you are not a MSDN subscriber you may not have access to FP2.

When you record using the Coded UI Test Builder or use an Existing Action Recording you may end up with method names you wish you could change.  We have all been taught to never modify a .Designer file because those are generated an may change at any time.  So the key is to update the value in the source of the code generation.

That is the .uitest file.  A .uitest file is an XML representation of the actions taken during the recording.  To change a method name you simply locate the TestStepMarkerAction element with the MarkerInformation attribute with the value of the method you wish to change.  Update the file with the desired method name then save and close the file.  Now we must cause the .Designer file to be regenerated to use the new method names.  From the Solution Explorer right click the .uitest file and select Edit with Coded UI Test Builder.  Once the Coded UI Test Builder opens simply click the Generate Code button and close the builder.  Now the .Designer file will contain the new method names.

 

 

 

Comments are closed