<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>Joe Walker - announcement tag</title>
  <link>http://directwebremoting.org/blog/joe/tags/announcement/</link>
  <description>Thoughts on Web Development</description>
  <language>en</language>
  <copyright>Joe Walker</copyright>
  <lastBuildDate>Wed, 23 Jul 2008 11:00:41 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>Embedded Web Testing</title>
    <link>http://directwebremoting.org/blog/joe/2007/08/20/embedded_web_testing.html</link>
    
      
        <description>
          &lt;p&gt;The web testing puzzle is a jigsaw with 3 pieces, and for a long time the 3rd piece has been hiding down the side of the sofa, but I think Simon Stewart just &lt;a href=&#034;http://www.pubbitch.org/blog/2007/08/11/introducing_webdriver&#034;&gt;found it&lt;/a&gt;. He&#039;s called it &lt;a href=&#034;http://code.google.com/p/webdriver/&#034;&gt;WebDriver&lt;/a&gt; - it needs dusting off, but it&#039;s looking like it&#039;s going to be the right fit.&lt;/p&gt;

&lt;p&gt;The problem with testing websites is that it has always been messy. It&amp;#39;s bound to be hard coordinating 3 tasks (browser, server, set of tests) across at least 2 processes on different hardware setups, and maybe even different platform architectures.&lt;/p&gt;

&lt;p&gt;The set-of-tests piece of the puzzle is well understood; JUnit, TestNG, &lt;a href=&#034;http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks&#034;&gt;blah blah&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The well behaved server piece is solved for Java by Jetty - you can fire up an embedded server as easy as &lt;code&gt;new Server();&lt;/code&gt; (&lt;a href=&#034;http://fisheye5.cenqua.com/browse/dwr/demo/org/getahead/dwrdemo/cli/JettyLauncher.java?r=MAIN&#034;&gt;example&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Now we can make browsers be as well behaved - we can remote control web browsers from within a Java program. WebDriver currently supports Internet Explorer, Firefox and HtmlUnit for totally embedded work.&lt;/p&gt;

&lt;pre&gt;
WebDriver driver = new FirefoxDriver();
driver.get(&#034;http://localhost:8080/dwr/simpletext/index.html&#034;);

driver.selectElement(&#034;id=demoName&#034;).setValue(&#034;World&#034;);
driver.selectElement(&#034;id=demoSend&#034;).click();

// Give the browser a chance to do the onclick
Thread.sleep(500);

WebElement reply = driver.selectElement(&#034;id=demoReply&#034;);
assertEquals(&#034;Hello, World&#034;, reply.getText());
&lt;/pre&gt;

&lt;p&gt;Scott McMaster &lt;a href=&#034;http://softwaredevscott.spaces.live.com/Blog/cns!1A9E939F7373F3B7!414.entry&#034;&gt;has some more examples&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Just to be clear &lt;a href=&#034;http://htmlunit.sourceforge.net/&#034;&gt;HtmlUnit&lt;/a&gt; has existed for a while, and it&amp;#39;s great for testing the sunny day case where browsers work according to a spec. It&amp;#39;s complete enough to be able to run DWR for example, but it won&amp;#39;t help you test the weird corner cases. WebDriver helps by reusing the weirdness directly from the browsers.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;: Patrick Lightbody points out that &lt;A href=&#034;http://www.openqa.org/selenium-rc/java.html&#034;&gt;Selenium Remote Control&lt;/a&gt; does something similar. The core &lt;a href=&#034;http://release.openqa.org/selenium-remote-control/0.9.0/doc/java/com/thoughtworks/selenium/Selenium.html&#034;&gt;Selenium&lt;/a&gt; controller class actually looks to be more capable than the &lt;a href=&#034;http://webdriver.googlecode.com/svn/trunk/common/src/java/com/thoughtworks/webdriver/WebElement.java&#034;&gt;WebDriver version&lt;/a&gt;, I try it out to see if it embeds as well.&lt;/p&gt;


        </description>
      
      
    
    
    
    <comments>http://directwebremoting.org/blog/joe/2007/08/20/embedded_web_testing.html#comments</comments>
    <guid isPermaLink="true">http://directwebremoting.org/blog/joe/2007/08/20/embedded_web_testing.html</guid>
    <pubDate>Mon, 20 Aug 2007 11:43:41 GMT</pubDate>
  </item>
  
  </channel>
</rss>
