{"id":5173,"date":"2012-04-13T14:26:28","date_gmt":"2012-04-13T14:26:28","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2012\/04\/13\/acceptance-testing-ui-using-visual-studio-2010-microsoft-test-manager-and-fit-style-tables\/"},"modified":"2022-07-26T01:09:54","modified_gmt":"2022-07-26T09:09:54","slug":"acceptance-testing-ui-using-visual-studio-2010-microsoft-test-manager-and-fit-style-tables","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/acceptance-testing-ui-using-visual-studio-2010-microsoft-test-manager-and-fit-style-tables\/","title":{"rendered":"Acceptance Testing UI using Visual Studio 2010 Microsoft Test Manager and Fit style tables"},"content":{"rendered":"<p>A while back I was sitting in a class by Rod Claar and he introduced the concept of using Fit tables for improving collaboration in software development.<\/p>\n<p>The way Fit tables do this is by enabling stakeholders and business analysts to enter expected input and the proper output in a tool they are comfortable with \u2013 like excel.<\/p>\n<p>A simple example might look like the following table:<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/4578.image_thumb_10.png\" width=\"379\" height=\"170\" \/><\/p>\n<p>The developer can then run through these tables using test automation to verify the application is doing what is expected.\u00a0<\/p>\n<p>Data bound coded UI tests makes doing a piece of cake with Visual Studio 2010.\u00a0<\/p>\n<p>**So how do you create a data bound Coded UI Test? **<\/p>\n<p>1&#46; Create a Test Case in Microsoft Text Manager.\u00a0\u00a0 Note the name of the Test Steps such as \u201cEnter First Number\u201d\u2026as they are important later on.<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/8204.image_thumb.png\" width=\"361\" height=\"271\" \/><\/p>\n<p>2&#46; Record the actions in the test case<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/1016.image_thumb_1.png\" width=\"322\" height=\"164\" \/><\/p>\n<p>3&#46; Create a Coded UI Test (Test > New Test)<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/0456.image_thumb_2.png\" width=\"266\" height=\"232\" \/><\/p>\n<p>4&#46; Create the CodeUI Test from the test case<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/5557.image_thumb_3.png\" width=\"345\" height=\"213\" \/><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/8360.image_thumb_4.png\" width=\"264\" height=\"210\" \/><\/p>\n<p>Below is the resultant test.\u00a0<\/p>\n<blockquote>\n<p><strong>&lt;CodedUITest()><br \/>\n  Public Class CodedUITest1<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0 Public Sub CodedUITestMethod1()<br \/>\n  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216; To generate code for this test, select &#8220;Generate Code for Coded UI Test&#8221; from the shortcut menu and select one of the menu items.<br \/>\n  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216; For more information on generated code, see **<a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=179463\">http:\/\/go.microsoft.com\/fwlink\/?LinkId=179463<\/a><br \/>\n  **\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Me.UIMap.Enterfirstnumber()<br \/>\n  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Me.UIMap.Entersecondnumber()<br \/>\n  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Me.UIMap.PressAdd()<\/strong><\/p>\n<p><strong>\u00a0 End Sub<\/strong><\/p>\n<\/blockquote>\n<p>5&#46; Open the Coded UI Properties.<\/p>\n<p>You do this by opening the Test View window (Text > Windows > Test<br \/>\nView) and choosing properties.<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/7380.image_thumb_5.png\" width=\"175\" height=\"364\" \/><\/p>\n<p>6&#46; Data bind the Coded UI Test.\u00a0 Under properties choose connection string. (See image above)<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/7612.image_thumb_6.png\" width=\"260\" height=\"238\" \/><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/5633.image_thumb_7.png\" width=\"260\" height=\"238\" \/><\/p>\n<p>This decorates the Coded UI method definition with a data source attribute you can access from the test context object.<\/p>\n<blockquote>\n<p><strong>Public Class CodedUITest1<\/strong><\/p>\n<p><strong>&lt;DataSource(&#8220;Microsoft.VisualStudio.TestTools.DataSource.CSV&#8221;, &#8220;|DataDirectory|addnumber.csv&#8221;, &#8220;addnumber#csv&#8221;, DataAccessMethod.Sequential)> &lt;DeploymentItem(&#8220;TestProject1addnumber.csv&#8221;)> &lt;TestMethod()><br \/>\n  Public Sub CodedUITestMethod1()<\/strong><\/p>\n<\/blockquote>\n<p>7&#46;\u00a0 In the Coded UI Test use the built in \u201cParams\u201d object to set the input value from the datasource.\u00a0<\/p>\n<p>For this test case it looks like:<\/p>\n<blockquote>\n<p><strong>Me.UIMap.EnterfirstnumberParams.UITextBox1EditText = TestContext.DataRow(&#8220;firstnumber&#8221;)<\/strong><\/p>\n<\/blockquote>\n<p>NOTE: For your specific Test case the param object will take its name from the Test Case.<\/p>\n<p>8&#46;\u00a0 Now when you run your test you will see it sequentially runs through every row in the data source.\u00a0<\/p>\n<p>You can change this from sequentially to random in the same properties list you set the data connection string.<\/p>\n<p><img decoding=\"async\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/04\/1016.image_thumb_8.png\" width=\"377\" height=\"180\" \/><\/p>\n<p>*<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A while back I was sitting in a class by Rod Claar and he introduced the concept of using Fit tables for improving collaboration in software development. The way Fit tables do this is by enabling stakeholders and business analysts to enter expected input and the proper output in a tool they are comfortable with [&hellip;]<\/p>\n","protected":false},"author":81,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,252],"tags":[],"class_list":["post-5173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-testing"],"acf":[],"blog_post_summary":"<p>A while back I was sitting in a class by Rod Claar and he introduced the concept of using Fit tables for improving collaboration in software development. The way Fit tables do this is by enabling stakeholders and business analysts to enter expected input and the proper output in a tool they are comfortable with [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/5173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=5173"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/5173\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=5173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=5173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=5173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}