0
votes

I am attempting to automate entering in values on a html page using Microsoft's coded UI. When I use the normal method (i.e. the hardcoded values gotten through the action recording) everything works fine but if I use the params method and pass it an explicit value it doesn't work at all; worse yet, the test does not fail at this point, it just seems to skip over that step. I'm hoping someone can give me an idea of what I'm missing (if anything) when I set up the data driven aspect of the test or if there's something else I can try out. Thanks erik

Here is the Data Connection string from the test itself [DeploymentItem("PFChecks\Data\Company.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\Company.xml", "Iteration", DataAccessMethod.Sequential), TestMethod]

and the line of code trying to use the params method to set the value on the field. usEnterSSN.methodUserSyncEnterSSNParams.UISsnoEditText = "012831444";

There is only one object in this method to be used, the UISsnoEditText object. The object name is correct in the UI Map and matches what it is named on the web page itself. The params method fails to work if I explicity set the value (as above) or if I use TestContext.DataRow method. Any ideas would be welcome and let me know if I can provide any further information to help answer this question. Thanks erik

2
Can you clarify "it doesn't work at all"? What does it do and what does it not do? Does it, for example, enter the value entered when the test was recorded? - AdrianHHH
If I use... usEnterSSN.methodUserSyncEnterSSN(); then it enters the correct information and the test proceeds as normal. If I use... usEnterSSN.methodUserSyncEnterSSNParams.UISsnoEditText = "012831444"; then nothing gets entered on the field but the test still passes. Incidentally, the value specified here (012831444) is the same as would be entered when using usEnterSSN.methodUserSyncEnterSSN(); - user2201221

2 Answers

0
votes

There are 2 things I can think of.

  1. Are you moving the code to the UIMap.cs file before editing and then working from there? if not you should do that.

  2. Try removing Certain Search Properties and Filter Properties from the UIMap.uitest file.

If this didn't help I'll need more info, perhaps even a Screen Cap.

0
votes

Three things occur.

(1) Is the assignment above in the correct place? The uimap...xxxParams.yyyEdit = ...; should be before the call of the method that uses it.

(2) You can use the Visual Studio debugger to set breakpoints and to step through a Coded UI test. (You need to right-click in the codeduitest.cs file and select Debug tests.

(3) From the comment clarifying the question. You need to have both the assignment and the call. So the general form is uimap...xxxParams.yyyEdit = ...; uimap...xxx();. The method call reads values from the ...Params, the default value there is the value entered when recording the test. The assignment overwrites the default value of the ...Params item.

There are some good discussion of data driven testing linked from http://blogs.msdn.com/b/mathew_aniyan/archive/2010/02/11/content-index-for-coded-ui-test.aspx , as well as many other items about Coded UI tests.