<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Selenium rocks &#8211; and you don&#039;t need it</title>
	<atom:link href="http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/</link>
	<description>The blog of Sam Newman</description>
	<lastBuildDate>Mon, 19 Jul 2010 18:05:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Pedro Sanchez</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3321</link>
		<dc:creator>Pedro Sanchez</dc:creator>
		<pubDate>Wed, 08 Apr 2009 19:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3321</guid>
		<description>We have found that the answer to all these questions and issues is to use Selenium and TestMaker by PushtoTest.  We get the best of both worlds - browser compatibility tests and high speed regression test runs, performance tests and production scripted performance monitoring. All with the same selenium script - we now convert our selenium scripts using the TestMaker &quot;transformer&quot; to python scripts and now have programatic control on our scirpts with data driven.</description>
		<content:encoded><![CDATA[<p>We have found that the answer to all these questions and issues is to use Selenium and TestMaker by PushtoTest.  We get the best of both worlds &#8211; browser compatibility tests and high speed regression test runs, performance tests and production scripted performance monitoring. All with the same selenium script &#8211; we now convert our selenium scripts using the TestMaker &#8220;transformer&#8221; to python scripts and now have programatic control on our scirpts with data driven.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vineet</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3320</link>
		<dc:creator>Vineet</dc:creator>
		<pubDate>Thu, 11 Dec 2008 18:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3320</guid>
		<description>I have used selenium for more than 2 years and I am totally impressed how easy it makes to integration test your application across multiple browsers. I have also used httpunit for 4+ years and the biggest problem that I have faced with that is the javascript incompatility of httpunit and firefox/IE.

Overall I would say that Selenium is the way to go for testing web applications and
&lt;a href=&quot;http://wiki.foochal.org/index.php/Maven_Selenium&quot; rel=&quot;nofollow&quot;&gt;Maven Selenium&lt;/a&gt; for java web applications, but when it comes to load testing I&#039;ve had better luck with JMeter.</description>
		<content:encoded><![CDATA[<p>I have used selenium for more than 2 years and I am totally impressed how easy it makes to integration test your application across multiple browsers. I have also used httpunit for 4+ years and the biggest problem that I have faced with that is the javascript incompatility of httpunit and firefox/IE.</p>
<p>Overall I would say that Selenium is the way to go for testing web applications and<br />
<a href="http://wiki.foochal.org/index.php/Maven_Selenium" rel="nofollow">Maven Selenium</a> for java web applications, but when it comes to load testing I&#8217;ve had better luck with JMeter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3319</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 21 Nov 2008 20:57:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3319</guid>
		<description>I really think you DO need selenium to test your website properly in various browsers. JS that might work for FF does always not work for IE or Safari. True, selenium does not really catch js exceptions, but some exceptions make the entire test fail, so we do get some feedback on this.

Emulating a browser is not the same thing as running it in a browser

I have to agree, it is terribly slow, but we just run it on our dev server every night, and get an email every morning with newly introduced bugs.

It really works perfectly for us.</description>
		<content:encoded><![CDATA[<p>I really think you DO need selenium to test your website properly in various browsers. JS that might work for FF does always not work for IE or Safari. True, selenium does not really catch js exceptions, but some exceptions make the entire test fail, so we do get some feedback on this.</p>
<p>Emulating a browser is not the same thing as running it in a browser</p>
<p>I have to agree, it is terribly slow, but we just run it on our dev server every night, and get an email every morning with newly introduced bugs.</p>
<p>It really works perfectly for us.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3318</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Wed, 12 Nov 2008 08:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3318</guid>
		<description>There is another approach.

It is a bit of a bruteforce:

It is quite possible to test Ajax app with Selenium. I successfully test a complex Ajax app built with Dojo for living. Testing ALL the app functionality and performing stress test using the same techniques.

Imagine a Dojo grid that is running in a separate thread in the browser and updating itself every so often, showing the user bids placed by other users in close to real time. Thus the user in question DOES NOT make any interaction with the page at all. No posts, no mouse clicks nothing. Yet the data is changing on the page and the change has to be tested.

I had to write a harness for Dojo widgets using HTMLParser, UI Declaration and some repeaters. But once written it is quite possible to parse the HTML that Dojo throws in to the browser. The DOM will change under us so testing DOM in Ajax app is rather pointless. We are never guaranteed to see an expected value in a static unit of time in an asynchronus app. Therefore making a single call to find an object and verify its value will not work.

More over, the value in question may be in the DOM but is hidden from the user and therefore not &quot;seen&quot; on in the browser window. Dojo has a lot of stuff like that.

Ajax is fluid so the tests must be fluid too.

The solution is to repeatedly capture the HTML from the browser,

 ... selenium.getHtmlSource(); ...

parse it and interrogate the snapshot with use of a repeater class callback that looks something like this:

class Repeater{

    public final static int TIMEOUT = 10000;
    private static final int PAUSE = 250;

    public static interface RepeaterCallback {
        T whatToRepeat();
    }


    public static  T repeat(long timeout, RepeaterCallback repeater) {
        return repeat(timeout, PAUSE, repeater);
    }


    public static  T repeat(long timeout, long pause, RepeaterCallback repeater) {
        long exitTime = System.currentTimeMillis() + timeout;
        while (true) {
            T result = repeater.whatToRepeat();
            if (result != null) return result;
            if (System.currentTimeMillis() + pause &gt;= exitTime) return null;
            if (pause &gt; PAUSE)
                sleepNoThrow(pause);
            else
                sleepNoThrow(PAUSE);
        }
    }

}

The pattern is: Build, Operate Check.

Fire up the repeater with a given time out. And inside the callback call your test code. The test code will grab the HTML from the page in to an immutable variable and interrogate it. If unsuccessful (the value not found) it will repeat the process again and again until it either finds what you are looking for or times out.


Wrap the test case in to a method and:


  @Test
  public testSomething(){
       MyTestParameters param .....
       setupMyTest(param);
       changeCondition(param);
       assertEquals(&quot;ExpectedValue&quot;, testSomethingInAjax(param));
  }

   private String testSomethingInAjax(final MyTestParameters param) {
        return Repeater.repeat(15000, 0, new Repeater.RepeaterCallback() {
            public String whatToRepeat() {
                return findExpectedValue(param);
            }
        });
    }

  private setupMyTest(MyTestParameters p){
    // build test conditions
  }

  private changeCondition(MyTestParameters p){
    // mock something, perform some actions
  }

  private String findExpectedValue(MyTestParameters p){
       // Test the results in with use of the repeater
       // return pass or fail
  }


With a little code you can test anything in GWT, Dojo, Yahoo tool kit etc etc.
Wrap your UI components in to java classes with use of parser and test the expected value with a repeater, because you can NEVER be sure that the value will be there when you expected :)

Just my $0.02</description>
		<content:encoded><![CDATA[<p>There is another approach.</p>
<p>It is a bit of a bruteforce:</p>
<p>It is quite possible to test Ajax app with Selenium. I successfully test a complex Ajax app built with Dojo for living. Testing ALL the app functionality and performing stress test using the same techniques.</p>
<p>Imagine a Dojo grid that is running in a separate thread in the browser and updating itself every so often, showing the user bids placed by other users in close to real time. Thus the user in question DOES NOT make any interaction with the page at all. No posts, no mouse clicks nothing. Yet the data is changing on the page and the change has to be tested.</p>
<p>I had to write a harness for Dojo widgets using HTMLParser, UI Declaration and some repeaters. But once written it is quite possible to parse the HTML that Dojo throws in to the browser. The DOM will change under us so testing DOM in Ajax app is rather pointless. We are never guaranteed to see an expected value in a static unit of time in an asynchronus app. Therefore making a single call to find an object and verify its value will not work.</p>
<p>More over, the value in question may be in the DOM but is hidden from the user and therefore not &#8220;seen&#8221; on in the browser window. Dojo has a lot of stuff like that.</p>
<p>Ajax is fluid so the tests must be fluid too.</p>
<p>The solution is to repeatedly capture the HTML from the browser,</p>
<p> &#8230; selenium.getHtmlSource(); &#8230;</p>
<p>parse it and interrogate the snapshot with use of a repeater class callback that looks something like this:</p>
<p>class Repeater{</p>
<p>    public final static int TIMEOUT = 10000;<br />
    private static final int PAUSE = 250;</p>
<p>    public static interface RepeaterCallback {<br />
        T whatToRepeat();<br />
    }</p>
<p>    public static  T repeat(long timeout, RepeaterCallback repeater) {<br />
        return repeat(timeout, PAUSE, repeater);<br />
    }</p>
<p>    public static  T repeat(long timeout, long pause, RepeaterCallback repeater) {<br />
        long exitTime = System.currentTimeMillis() + timeout;<br />
        while (true) {<br />
            T result = repeater.whatToRepeat();<br />
            if (result != null) return result;<br />
            if (System.currentTimeMillis() + pause &gt;= exitTime) return null;<br />
            if (pause &gt; PAUSE)<br />
                sleepNoThrow(pause);<br />
            else<br />
                sleepNoThrow(PAUSE);<br />
        }<br />
    }</p>
<p>}</p>
<p>The pattern is: Build, Operate Check.</p>
<p>Fire up the repeater with a given time out. And inside the callback call your test code. The test code will grab the HTML from the page in to an immutable variable and interrogate it. If unsuccessful (the value not found) it will repeat the process again and again until it either finds what you are looking for or times out.</p>
<p>Wrap the test case in to a method and:</p>
<p>  @Test<br />
  public testSomething(){<br />
       MyTestParameters param &#8230;..<br />
       setupMyTest(param);<br />
       changeCondition(param);<br />
       assertEquals(&#8220;ExpectedValue&#8221;, testSomethingInAjax(param));<br />
  }</p>
<p>   private String testSomethingInAjax(final MyTestParameters param) {<br />
        return Repeater.repeat(15000, 0, new Repeater.RepeaterCallback() {<br />
            public String whatToRepeat() {<br />
                return findExpectedValue(param);<br />
            }<br />
        });<br />
    }</p>
<p>  private setupMyTest(MyTestParameters p){<br />
    // build test conditions<br />
  }</p>
<p>  private changeCondition(MyTestParameters p){<br />
    // mock something, perform some actions<br />
  }</p>
<p>  private String findExpectedValue(MyTestParameters p){<br />
       // Test the results in with use of the repeater<br />
       // return pass or fail<br />
  }</p>
<p>With a little code you can test anything in GWT, Dojo, Yahoo tool kit etc etc.<br />
Wrap your UI components in to java classes with use of parser and test the expected value with a repeater, because you can NEVER be sure that the value will be there when you expected <img src='http://www.magpiebrain.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Just my $0.02</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed Ashour</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3317</link>
		<dc:creator>Ahmed Ashour</dc:creator>
		<pubDate>Sat, 11 Oct 2008 15:25:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3317</guid>
		<description>http://htmlunit.sf.net is another powerful java browser emulator</description>
		<content:encoded><![CDATA[<p><a href="http://htmlunit.sf.net" rel="nofollow">http://htmlunit.sf.net</a> is another powerful java browser emulator</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sam</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3316</link>
		<dc:creator>sam</dc:creator>
		<pubDate>Tue, 27 Feb 2007 08:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3316</guid>
		<description>Which was the point of the article - anything (not just Javascript) which manipulates the DOM after the page has been served will require in-browser testing - either manual or automated. But understand when you make that choice (even Javascript heavy apps will serve some static data).

One approach to making Javascript-heavy apps testable using static, outside-browsr verification is to decompose the content of each page into a series of components, each one available on it&#039;s own URL.</description>
		<content:encoded><![CDATA[<p>Which was the point of the article &#8211; anything (not just Javascript) which manipulates the DOM after the page has been served will require in-browser testing &#8211; either manual or automated. But understand when you make that choice (even Javascript heavy apps will serve some static data).</p>
<p>One approach to making Javascript-heavy apps testable using static, outside-browsr verification is to decompose the content of each page into a series of components, each one available on it&#8217;s own URL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.magpiebrain.com/2007/01/28/selenium-rocks-and-you-dont-need-it/comment-page-1/#comment-3315</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 27 Feb 2007 04:18:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/#comment-3315</guid>
		<description>Selenium comes in very handy when your application makes heavy use of Javascript.  For example, HtmlUnit currently chokes on trying to parse the standard Dojo include files, so any application which uses Dojo isn&#039;t testable by HtmlUnit.  Selenium, since it uses the actual browser, doesn&#039;t have this problem.  So for my team at least, it&#039;s Selenium or nothing...</description>
		<content:encoded><![CDATA[<p>Selenium comes in very handy when your application makes heavy use of Javascript.  For example, HtmlUnit currently chokes on trying to parse the standard Dojo include files, so any application which uses Dojo isn&#8217;t testable by HtmlUnit.  Selenium, since it uses the actual browser, doesn&#8217;t have this problem.  So for my team at least, it&#8217;s Selenium or nothing&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
