Object Mentor Blog: Observations on Test-Driving User Interfaces http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces en-us 40 Observations on Test-Driving User Interfaces <p>Test driving user interface development has always been a challenge. Recently, I&#8217;ve worked with two projects where most of the work has been on the user-interface components.</p> <p>The first project is using Adobe Flex to create a rich interface. The team decided to adopt <a href="http://funfx.rubyforge.org/">FunFX</a> for acceptance testing. You write your tests in Ruby, typically using <a href="http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a> or <a href="http://rspec.info/">RSpec</a>.</p> <p>FunFX places some constraints on your Flex application. You have to define the <span class="caps">GUI</span> objects in <span class="caps">MXML</span>, the <span class="caps">XML</span>-based file format for Flex applications, rather than ActionScript, and you need to add ids to all elements you want to reference.[1]</p> <p>These are reasonable constraints and the first constraint promotes better quality, in fact. The <span class="caps">MXML</span> format is more succinct (despite the <span class="caps">XML</span> &#8220;noise&#8221;) and declarative than ActionScript code. This is almost always true of UI code in most languages (with notable exceptions&#8230;). Declarative <em>vs.</em> imperative code tends to improve quality because less code means fewer bugs, less to maintain, and it frees the implementor of the declarative &#8220;language&#8221; to pick the best implementation strategies, optimizations, <em>etc.</em> This characteristic is typical of Functional Languages and well-designed Domain Specific Languages, as well.</p> <p>I don&#8217;t think you can underestimate the benefit of writing <strong>less</strong> code. I see too many teams whose problems would diminish considerably if they just got rid of duplication and learned to be <em>concise</em>.</p> <p>The second project is a wiki-based application written in Java. To make deployment as simple as possible, the implementors avoided the Servlet <span class="caps">API</span> (no need to install Tomcat, <em>etc.</em>) and rolled their own web server and page rendering components. (I&#8217;m not sure I would have made these decisions myself, but I don&#8217;t think they are bad, either&#8230;)</p> <p>The rendering components are object-oriented and use a number of design patterns, such as page factories with builder objects that reflect the &#8220;widgets&#8221; in the UI, <span class="caps">HTML</span> tags, <em>etc.</em> This approach makes the UI very testable with JUnit and <a href="http://www.fitnesse.org">FitNesse</a>. In fact, the development process was a model of test-driven development.</p> <p>However, the final result is flawed! It is much too difficult to change the <em>look and feel</em> of the application, which is essential for most UI&#8217;s, especially web UI&#8217;s. The project made the wrong tradeoffs; the design choices met the requirements of <span class="caps">TDD</span> very well, but they made maintenance and enhancement expensive and tedious. The application is now several years old and it has become dated, because of the expense of &#8220;refreshing&#8221; the <em>look and feel</em>.</p> <p>What should have been done? These days, most dynamic web UI&#8217;s are built with templating engines, of which there are many in the most common programming languages. Pages defined in a templating engine are very declarative, except for the special tags where behavior is inserted. The pages are easy to change. It is mostly obvious where a particular visual element is generated, since most of the &#8220;tags&#8221; in the template look exactly like the tags in the rendered page. &#8220;Declarative&#8221; templates, like good <span class="caps">DSL</span>&#8217;s, can be read, understood, and even edited by the <em>stakeholders</em>, in this case the graphical designers.</p> <p>But how do you test these page templates? When test-driving UI&#8217;s it is important to decide what to test and what <strong>not</strong> to test. The general rule for <span class="caps">TDD</span> is to <em>test anything that can break</em>. The corollary, especially relevant for UI&#8217;s, is <em>don&#8217;t test anything when you don&#8217;t care if it changes</em>.</p> <p>It is usually the <em>dynamic behavior</em> of the UI that can break and should be tested. Templating engines provide special tags for inserting dynamic behavior in the underlying language (Java, Ruby, <em>etc.</em>). <em>This</em> is what you should test. It is usually best to keep the <em>scripts</em> in these tags as small as possible; the scripts just delegate to code, which can be test-driven in the usual way.</p> <p>I see too many UI tests that compare long strings of <span class="caps">HTML</span>. These tests break whenever someone makes a minor <em>look and feel</em> or other inconsequential change. Part of the art of <span class="caps">UI TDD</span> is knowing how to test just what can break and nothing more. In the second project, incidental changes to the UI break tests that should be <em>agnostic</em> to such changes.</p> <p>To conclude, keep your UI&#8217;s as <em>declarative</em> as you can. Only test the &#8220;declarations&#8221; (<i>e.g.</i>, templates) in areas where they might <em>break</em>, meaning if it changes, it&#8217;s a bug. You&#8217;ll get the full benefits of <span class="caps">TDD</span> and the freedom to change the UI easily and frequently, as needed.</p> <p id="fn1"><sup>1</sup> Disclaimer: my information on FunFX is second hand, so I might not have the details exactly correct; see the <a href="http://funfx.rubyforge.org/">FunFX</a> documentation for details.</p> Sun, 22 Jun 2008 16:52:00 -0500 urn:uuid:107f8948-2e28-48d7-a495-85d56801b376 Dean Wampler http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces Dean's Deprecations Testing GUIs Design Principles TDD gui declarative functional design "Observations on Test-Driving User Interfaces" by ray ban rb4105 <p>Persol Sunglasses come in a variety of styles and <a href="http://www.raybansunglasses-forsale.com/" rel="nofollow"><strong>ray ban rb4105</strong></a> colors to give you the look that you desire. The <a href="http://www.raybansunglasses-forsale.com/clubmaster-sunglasses_c5" rel="nofollow"><strong>ray ban club master</strong></a> flawless finish and excellent craftsmanship are <a href="http://www.raybansunglasses-forsale.com/" rel="nofollow"><strong>sunglasses</strong></a> what make people across the globe crave Persol Sunglasses.</p> Tue, 15 May 2012 22:57:42 -0500 urn:uuid:5cc16934-9cfa-4514-88f0-775a85269dd9 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-224827 "Observations on Test-Driving User Interfaces" by Group golf holidays <p>Your article is extremely impressive. I never considered that it was feasible to accomplish something like that until after I looked over your post . Please visit our website for more information .</p> Tue, 01 May 2012 12:26:17 -0500 urn:uuid:4a069917-8db0-455d-8d20-cc10c3028b3f http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-221068 "Observations on Test-Driving User Interfaces" by medical billing georgia <p>Test driven development is one of the central techniques in Extreme Programming.. and Test-driven development of GUIs is currently very difficult&#8230; Test Driven Development is a software development technique in which programmers writing failed test that will define the functionality before writing the actual code&#8230; <a href="http://www.medicalbillinggeorgia.com/" rel="nofollow">medical billing georgia</a></p> Thu, 08 Mar 2012 06:28:26 -0600 urn:uuid:349463cc-4ddb-47b7-908a-04836eada8e7 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-209040 "Observations on Test-Driving User Interfaces" by Backup iPhone sms <p>well. your article is very useful for all the programmer and it can help me have a better code.</p> Fri, 10 Feb 2012 03:03:14 -0600 urn:uuid:5cb26961-20f6-4476-bff5-d9d1348dd2c0 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-202790 "Observations on Test-Driving User Interfaces" by snow-http://www.timeadmin.org <p><a href="http://www.timeadmin.org/Tissot-Ladies-Classic-Watches_15_1.htm" rel="nofollow">Tissot Classic Dream Watch</a> will be a happy life style. Do not hesitate to choose <a href="http://www.timeadmin.org/" rel="nofollow">tissot ladies watches</a> and <a href="http://www.timeadmin.org/" rel="nofollow">tissot gents watches</a> to add your charming and beauty everytime.</p> Fri, 06 Jan 2012 23:54:31 -0600 urn:uuid:b8f05c53-1769-4a8b-8fe9-4eb264b7ef3c http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-195724 "Observations on Test-Driving User Interfaces" by Breguet watches <p>you go to bed</p> Fri, 23 Dec 2011 21:22:19 -0600 urn:uuid:dcd7e1a2-a9b6-4b43-bf2e-f9e35e9277dc http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-190986 "Observations on Test-Driving User Interfaces" by tv show <p>thanks a lot for sharing. great stuff as always!</p> Sun, 27 Nov 2011 04:29:38 -0600 urn:uuid:2c0fa07b-21b3-47eb-8cc7-7000e39c8272 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-178873 "Observations on Test-Driving User Interfaces" by Bantningsmetoder <p>Seems great! Thanks. Observations of interfaces are very good.</p> Mon, 31 Oct 2011 13:01:32 -0500 urn:uuid:d775a3aa-ab25-4923-a1d3-469e35d568e4 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-166306 "Observations on Test-Driving User Interfaces" by ysbearing <p>Slewing bearing called slewing ring bearings, is a comprehensive load to bear a large bearing, can bear large axial, radial load and overturning moment.</p> Wed, 19 Oct 2011 03:41:16 -0500 urn:uuid:a78ea098-56fc-4bf8-a846-62f78eb0128c http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-159547 "Observations on Test-Driving User Interfaces" by seo <p>building rich interfaces which are supported by lighter code is good practice, no more sluggish flash stuff</p> Thu, 22 Sep 2011 03:13:56 -0500 urn:uuid:be6eedc5-f919-41b4-aba0-0c2810d26f10 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-144313 "Observations on Test-Driving User Interfaces" by Windows 8 <p>user interface is very important feature to make things and website alive and easy to use..</p> Mon, 22 Aug 2011 06:22:09 -0500 urn:uuid:1ee6eb9c-5722-48c1-a97c-f8e38b1cc232 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-131260 "Observations on Test-Driving User Interfaces" by oferta simyo <p>Nice observations</p> Tue, 10 May 2011 06:14:34 -0500 urn:uuid:ad391428-ab5d-4f44-8793-74a3112076d1 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-97648 "Observations on Test-Driving User Interfaces" by okey oyunu oyna <p>yes it is true</p> <p>internette görüntülü olarak <a href="http://www.okeyoyunu-oyna.com" rel="nofollow">okey oyunu oyna</a>, gerçek kisilerle tanis, turnuva heyecanini yasa.</p> Wed, 27 Apr 2011 13:12:55 -0500 urn:uuid:9cfb2fc6-e52d-4e04-95ab-9e65ec10584a http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-91855 "Observations on Test-Driving User Interfaces" by nike shoes clearance <p>give you the method to move songs, video and so on backup to Mac from iPhone. nice tips.</p> Thu, 24 Mar 2011 20:44:22 -0500 urn:uuid:f330f1a3-9866-495d-8875-764e6b6b7528 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-75224 "Observations on Test-Driving User Interfaces" by Sanford NC Workers Compensation Attorneys <p>User interface is really important&#8230; it will be easy for us to see how its look ;)</p> Thu, 10 Mar 2011 14:55:05 -0600 urn:uuid:06e0cd2a-8065-4a24-915b-859bb76a33ef http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-71683 "Observations on Test-Driving User Interfaces" by iPad Video Converter for Mac <p>very useful information for me! I&#8217;ll come here everyday</p> Wed, 09 Mar 2011 19:40:51 -0600 urn:uuid:5852c6b5-4135-4cd5-a89b-d055270fc63b http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-71243 "Observations on Test-Driving User Interfaces" by lv <p>V</p> Mon, 07 Mar 2011 23:29:00 -0600 urn:uuid:2260b324-176b-4293-af58-e2f093e10c0c http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-70379 "Observations on Test-Driving User Interfaces" by Criminal Records <p>The pages are easy to change. It is mostly obvious where a particular visual element is generated, since most of the “tags” in the template look exactly like the tags in the rendered page.</p> Mon, 14 Feb 2011 15:59:18 -0600 urn:uuid:11d04d50-b17a-4316-a2d0-fd39601fee68 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-62747 "Observations on Test-Driving User Interfaces" by Apartments for rent Bucharest <p>Making tests independend of changes in look and feel makes them less fragile and thus more valuable</p> Thu, 03 Feb 2011 07:54:23 -0600 urn:uuid:884b7499-d357-48e7-88f2-b8ecaaa504d8 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-60847 "Observations on Test-Driving User Interfaces" by TactFit Commando Review <p>I found it very interesting and enjoyed reading all of it&#8230;keep it up, lovely job..Thank you for posting the great content.I was looking for something like this.I found it quiet interesting, hopefully you will keep posting such blogs..Keep sharing</p> Thu, 03 Feb 2011 07:52:39 -0600 urn:uuid:9a79de92-34e3-4d6b-b6d3-5c1ca7c54665 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-60845 "Observations on Test-Driving User Interfaces" by electric winch <p>This article is very usefull for me! I can see that you are putting a lots of efforts into your blog. I will keep watching in your blog, thanks.</p> Mon, 24 Jan 2011 02:01:07 -0600 urn:uuid:fabe8863-aece-44e0-80dc-2d96e7f3ae35 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-58934 "Observations on Test-Driving User Interfaces" by accounting services <p>Awesome article!Thanks for ur nice sharing..<a href="http://www.admgroupllc.com/" rel="nofollow">accounting services</a></p> Sun, 16 Jan 2011 11:04:00 -0600 urn:uuid:62297dda-5d9b-44a6-854b-7aaa8fd800b1 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-57296 "Observations on Test-Driving User Interfaces" by ugg australia uk <p>can be worn with any outfit, be that a glamorous and sexy skirt, a business suit or a casual pair of jeans Any shoe store collection display whether online or otherwise will not be complete without offering their brand This is quite</p> Wed, 05 Jan 2011 22:58:44 -0600 urn:uuid:1ec166a2-e3d8-4874-a5f6-b60f7559c8f7 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-54606 "Observations on Test-Driving User Interfaces" by replica watch rado <p>Hey ,boys and girls,nice to talk with you if you can see my message,and also it’s our fate to share my idea with you.what do you think of it?</p> Wed, 05 Jan 2011 04:30:00 -0600 urn:uuid:728cec3d-0c4a-49c4-a3e5-24c4b0d7ae28 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-54377 "Observations on Test-Driving User Interfaces" by belstaff bag 556 <p><a href="http://www.belstaffdiscount.com/belstaff-bag-s" rel="nofollow">http://www.belstaffdiscount.com/belstaff-bag-s</a> Hey ,boys and girls,nice to talk with you if you can see my message,and also it&#8217;s our fate to share my idea with you.what do you think of it?</p> Tue, 07 Dec 2010 03:52:56 -0600 urn:uuid:60ebfc10-6bc7-4357-823b-a4c6ec90cf69 http://blog.objectmentor.com/articles/2008/06/22/observations-on-test-driving-user-interfaces#comment-46985