1
votes

This is my first time tangling with Coded UI and I've hit my first real speed bump. I don't have Microsoft Test Manager which may make this process trivial, but I'm having a heck of a time.

I have a text box, let's call it 'Project Name'. I want to run a small test in several iterations, each one using a different Project Name (the static value is set as 'Castle'). I have my CSV file created and my Data Source set, but I cannot find the right syntax to use TestContext to point the variable to the CSV.

Everything I've found says to use some variation of 'SearchProperties[WpfButton.PropertyNames.SOMETHING] = TestContext.DataRow["ProjectName"].ToString();'.

My issue is I can't find anything in PropertyNames that represents the value of the input string, nor does adding 'value' as a property do anything. The only place in the UImap that I can find the static Value set is in the UI actions tree, in the SetValueActionWrapper properties.

How do I specify the right value? The frustrating thing is this is an extremely trivial task in the other automation tools that I've used, but I'm not a strong coder. Please advise!

1

1 Answers

0
votes

A simple way to do this is to let Coded UI teach you how to do it. In a sandbox project use Coded UI to record the required actions then copy the interesting or useful pieces into your own tests. For entering text into a text box you could just record the displaying of the text box and the typing of the text. For much more on how to data drive with Coded UI see this Stack Overflow answer.

Whilst MTM is a very useful program I believe it would not make the problem you have any easier.