Coded UI Test – Tip of the Day#7 – Generate Code

After recording a series of action, you need to click on the Generate Code  button, give a name for the Recorded method and generate code for the recorded actions.

Similarly, after adding assertions, you need to click on the Generate Code button, give a name for the Assertion Method and generate code for the assertions.

image

Sometimes, you may just add controls (and not add assertions or record actions). In this case, you don’t need to give a method name.

image

 

If you click on the Generate Code button without performing any action, you can regenerate the code for the UI Test File. This is useful if you have modified the UI Test File outside Coded UI Test Builder.

image

 

Note that in all scenarios described above, Designer.cs file will be completely overwritten. You should not make any code changes in the Designer.cs. Al code customizations should be done in the .cs file attached to the UITest File.