<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Using Selenium to check for the presence of an image</title>
	<atom:link href="http://gayleforce.wordpress.com/2008/12/04/using-selenium-to-check-for-the-presence-of-an-image/feed/" rel="self" type="application/rss+xml" />
	<link>http://gayleforce.wordpress.com/2008/12/04/using-selenium-to-check-for-the-presence-of-an-image/</link>
	<description>This Blog Doesn't Blow</description>
	<lastBuildDate>Sat, 05 Dec 2009 03:25:26 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Gayle</title>
		<link>http://gayleforce.wordpress.com/2008/12/04/using-selenium-to-check-for-the-presence-of-an-image/#comment-91</link>
		<dc:creator>Gayle</dc:creator>
		<pubDate>Thu, 04 Dec 2008 21:01:19 +0000</pubDate>
		<guid isPermaLink="false">http://gayleforce.wordpress.com/?p=54#comment-91</guid>
		<description>Yep, that&#039;s a good point, CSS would be a good option here.  Hmm, other part of our app use CSS for images, but not the part I was working with the other day. I guess that might be a good opportunity for a refactor :)</description>
		<content:encoded><![CDATA[<p>Yep, that&#8217;s a good point, CSS would be a good option here.  Hmm, other part of our app use CSS for images, but not the part I was working with the other day. I guess that might be a good opportunity for a refactor <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peabody</title>
		<link>http://gayleforce.wordpress.com/2008/12/04/using-selenium-to-check-for-the-presence-of-an-image/#comment-90</link>
		<dc:creator>Peabody</dc:creator>
		<pubDate>Thu, 04 Dec 2008 19:50:40 +0000</pubDate>
		<guid isPermaLink="false">http://gayleforce.wordpress.com/?p=54#comment-90</guid>
		<description>OK. I get it. I agree with what you&#039;re saying about ideals.

I think you could use a class attribute on the TD to get the same kind of test so Selenium would look for the class attribute instead of background... and then you wouldn&#039;t need to change tests due to a folder restructuring.

If you get really curious, you could use the CSS to set the background image without needing to explicitly put a background attribute on the td at all, so a folder restructuring would only require a change to the CSS and not what potentially could be multiple pages.</description>
		<content:encoded><![CDATA[<p>OK. I get it. I agree with what you&#8217;re saying about ideals.</p>
<p>I think you could use a class attribute on the TD to get the same kind of test so Selenium would look for the class attribute instead of background&#8230; and then you wouldn&#8217;t need to change tests due to a folder restructuring.</p>
<p>If you get really curious, you could use the CSS to set the background image without needing to explicitly put a background attribute on the td at all, so a folder restructuring would only require a change to the CSS and not what potentially could be multiple pages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gayle</title>
		<link>http://gayleforce.wordpress.com/2008/12/04/using-selenium-to-check-for-the-presence-of-an-image/#comment-89</link>
		<dc:creator>Gayle</dc:creator>
		<pubDate>Thu, 04 Dec 2008 18:50:31 +0000</pubDate>
		<guid isPermaLink="false">http://gayleforce.wordpress.com/?p=54#comment-89</guid>
		<description>Right, it&#039;s checking that the HTML has a specific background image, not checking that it exists.  As with any contrived example it is, well, contrived.  So let me be more specific, hopefully this will help clear it up.

Imagine there&#039;s a page that shows the current contents of the aquarium.  It has a specific list of fish that might or might not be in the fish tank at any given time.  Then, on the server there&#039;s an &quot;if/else&quot; around the &quot;td&quot; tag that decides which image to use for the background image.  Something like this PSEUDOcode:

&lt;code&gt;
   &lt;table&gt;
      &lt;tr&gt;
        &lt;% if aquarium.has_clownfish() %&gt;
          &#160;&lt;td background=&quot;/images/fish/clownfish.jpg&quot; /&gt;
        &lt;% else %&gt;
          &#160;&lt;td background=&quot;/images/fish/no_fish_of_this_type_icon.jpg&quot; /&gt;
        &lt;% end %&gt;
      &lt;/tr&gt;
   &lt;/table&gt;

   &lt;!-- repeat this for all types of fish --&gt; 
&lt;/code&gt;

Then let&#039;s say I have a Selenium test that does the following: 
1. user logs in
2. user adds clown fish to the aquarium
3. user navigates to page that shows contents of aquarium 
4. selenum test asserts that the &quot;clownfish&quot; icon *IS* present in that table cell, not the &quot;no fish of this kind&quot; icon.  The clownfish icon better be there since the user added a clown fish in step 2. 

That&#039;s what this is meant to test.

So if the images folders were restructured, then the code for the &quot;td&quot; would change to:
&lt;code&gt;    
          &lt;td background=&quot;/images/fish/saltwater/clownfish.jpg&quot; /&gt;
 &lt;/code&gt;

Thus the Selenium test would break, because it&#039;s so fragile that it depends on a specific folder structure.  The Selenium test can of course be updated to reflect the folder structure change.  I&#039;m just saying it would be nice to check something like &quot;assert that the background uses clownfish.jpg regardless of what folder the files is in&quot; instead of having to know the whole path.  Because... &quot;ideally&quot;, tests should break if FUNCTIONALITY changes, but not fail for minor stuff like restructuring your directories, if possible.</description>
		<content:encoded><![CDATA[<p>Right, it&#8217;s checking that the HTML has a specific background image, not checking that it exists.  As with any contrived example it is, well, contrived.  So let me be more specific, hopefully this will help clear it up.</p>
<p>Imagine there&#8217;s a page that shows the current contents of the aquarium.  It has a specific list of fish that might or might not be in the fish tank at any given time.  Then, on the server there&#8217;s an &#8220;if/else&#8221; around the &#8220;td&#8221; tag that decides which image to use for the background image.  Something like this PSEUDOcode:</p>
<p><code><br />
   &lt;table&gt;<br />
      &lt;tr&gt;<br />
        &lt;% if aquarium.has_clownfish() %&gt;<br />
          &nbsp;&lt;td background="/images/fish/clownfish.jpg" /&gt;<br />
        &lt;% else %&gt;<br />
          &nbsp;&lt;td background="/images/fish/no_fish_of_this_type_icon.jpg" /&gt;<br />
        &lt;% end %&gt;<br />
      &lt;/tr&gt;<br />
   &lt;/table&gt;</p>
<p>   &lt;!-- repeat this for all types of fish --&gt;<br />
</code></p>
<p>Then let&#8217;s say I have a Selenium test that does the following:<br />
1. user logs in<br />
2. user adds clown fish to the aquarium<br />
3. user navigates to page that shows contents of aquarium<br />
4. selenum test asserts that the &#8220;clownfish&#8221; icon *IS* present in that table cell, not the &#8220;no fish of this kind&#8221; icon.  The clownfish icon better be there since the user added a clown fish in step 2. </p>
<p>That&#8217;s what this is meant to test.</p>
<p>So if the images folders were restructured, then the code for the &#8220;td&#8221; would change to:<br />
<code><br />
          &lt;td background="/images/fish/saltwater/clownfish.jpg" /&gt;<br />
 </code></p>
<p>Thus the Selenium test would break, because it&#8217;s so fragile that it depends on a specific folder structure.  The Selenium test can of course be updated to reflect the folder structure change.  I&#8217;m just saying it would be nice to check something like &#8220;assert that the background uses clownfish.jpg regardless of what folder the files is in&#8221; instead of having to know the whole path.  Because&#8230; &#8220;ideally&#8221;, tests should break if FUNCTIONALITY changes, but not fail for minor stuff like restructuring your directories, if possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peabody</title>
		<link>http://gayleforce.wordpress.com/2008/12/04/using-selenium-to-check-for-the-presence-of-an-image/#comment-88</link>
		<dc:creator>Peabody</dc:creator>
		<pubDate>Thu, 04 Dec 2008 17:52:16 +0000</pubDate>
		<guid isPermaLink="false">http://gayleforce.wordpress.com/?p=54#comment-88</guid>
		<description>This isn&#039;t testing that the image actually exists, does it? It seems that it&#039;s just checking that the background attribute contents match what it expects.

So, if it isn&#039;t verifying that the image exists, restructuring the physical image folders wouldn&#039;t break the Selenium tests. The test would only break if the page&#039;s html was updated to reflect the changed folder structure. Right?</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t testing that the image actually exists, does it? It seems that it&#8217;s just checking that the background attribute contents match what it expects.</p>
<p>So, if it isn&#8217;t verifying that the image exists, restructuring the physical image folders wouldn&#8217;t break the Selenium tests. The test would only break if the page&#8217;s html was updated to reflect the changed folder structure. Right?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
