<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>The Testing Blog &#187; open source</title>
	<atom:link href="http://thetestingblog.com/category/tools/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://thetestingblog.com</link>
	<description>Why, testing, of course!</description>
	<lastBuildDate>Tue, 31 Aug 2010 23:16:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='thetestingblog.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5bc883277a9e573ad056d2ccd360a439?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Testing Blog &#187; open source</title>
		<link>http://thetestingblog.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://thetestingblog.com/osd.xml" title="The Testing Blog" />
	<atom:link rel='hub' href='http://thetestingblog.com/?pushpress=hub'/>
		<item>
		<title>Have you heard about NUnit Attributes and how they&#8217;re awesome?</title>
		<link>http://thetestingblog.com/2010/08/31/have-you-heard-about-nunit-attributes-and-how-theyre-awesome/</link>
		<comments>http://thetestingblog.com/2010/08/31/have-you-heard-about-nunit-attributes-and-how-theyre-awesome/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 23:16:50 +0000</pubDate>
		<dc:creator>Daniel Brown</dc:creator>
				<category><![CDATA[NUnit]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[test automation]]></category>

		<guid isPermaLink="false">http://thetestingblog.com/?p=425</guid>
		<description><![CDATA[VERY IMPORTANT!!! Some attributes in this article are only available in NUnit 2.5 and later. I would strongly recommend upgrading your NUnit to the newest version. Okay, so, have you heard about NUnit attributes, and how they&#8217;re awesome? Sure you&#8217;ve heard of Setup, Test, TestFixture, and TearDown? But how about Values? How about Range? The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thetestingblog.com&amp;blog=8467555&amp;post=425&amp;subd=thetestingblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>VERY IMPORTANT!!! Some attributes in this article are only available in NUnit 2.5 and later.  I would strongly recommend upgrading your NUnit to the newest version.</strong></p>
<p>Okay, so, have you heard about NUnit attributes, and how they&#8217;re awesome?<br />
Sure you&#8217;ve heard of Setup, Test, TestFixture, and TearDown?  But how about Values?  How about Range?</p>
<p>The Values attribute allows you to run the same test several times with different values.  It makes it where you&#8217;re not doing something crazy like copy and pasting the same test, over and over again!  I was close to that situation, but it hurt my soul too much to do that.  So, in order to save my soul, I had to seek a path for redemption.  Here&#8217;s what I found:</p>
<p>Okay, to try this, you may need to set up a sample test.  If you need to start from scratch, check out my End-to-End Example: http://thetestingblog.com/2009/09/10/selenium-rc-in-c-using-nunit-an-end-to-end-example/</p>
<p>My example test verifies that the text &#8220;Daniel Brown&#8221; is present on the main testing blog page&#8211;a simple pass or fail.  But imagine we wanted to run the test 3 times, each time verifying the presence of a different Testing Blog author.  Here&#8217;s how we would do it using the Values attribute:</p>
<pre class="brush: csharp;">
        [Test]
        public void ValuesTest([Values(&quot;Daniel Brown&quot;, &quot;Marisa Seal&quot;, &quot;Josh Carroll&quot;)] string textPresent)
        {
            selenium.Open(&quot;http://www.google.com&quot;);
            selenium.Type(&quot;q&quot;, &quot;thetestingblog.com&quot;);
            selenium.Click(&quot;btnI&quot;);
            selenium.WaitForPageToLoad(&quot;60000&quot;);
            Assert.IsTrue(selenium.IsTextPresent(textPresent));
        }
</pre>
<p>As you can see, we&#8217;re basically passing the argument &#8220;textPresent&#8221; into the method.  The values are what you want the argument to be.  For each value, run the test once with &#8220;textPresent&#8221; = to that value:<br />
<code>[Values("Daniel Brown", "Marisa Seal", "Josh Carroll")] string stringPresent</code></p>
<p>So, in the case of this test; here&#8217;s how it would run:<br />
SetupTest();<br />
ValuesTest(&#8220;Daniel Brown&#8221;);<br />
TeardownTest();<br />
SetupTest();<br />
ValuesTest(&#8220;Marisa Seal&#8221;);<br />
TeardownTest();<br />
SetupTest();<br />
ValuesTest(&#8220;Josh Carroll&#8221;);<br />
TeardownTest();</p>
<p>This is how it looks in the test runner:<br />
<a href="http://thetestingblog.files.wordpress.com/2010/08/49.jpg"><img class="aligncenter size-full wp-image-435" title="49" src="http://thetestingblog.files.wordpress.com/2010/08/49.jpg?w=336&#038;h=128" alt="" width="336" height="128" /></a></p>
<p>Okay, that wasn&#8217;t too bad.  Now, let&#8217;s go a crazy.  Let&#8217;s get nuts.  Potentially throwing best practices to the wind.  We&#8217;re going make this example where it pulls the values from a text file instead of hard coding them.  To do that, let&#8217;s add a text file to our project:</p>
<p>Right click on your project (&#8220;TestingBlogSeleniumRc&#8221;) in the Solution Explorer -&gt; <strong>Add </strong>-&gt; <strong>New Item&#8230; </strong></p>
<p>Select Text File and call it ValueList.txt</p>
<p>Open the file in your editor and type the three values into the text file.  One per line:</p>
<div id="_mcePaste">Daniel Brown</div>
<div id="_mcePaste">Marisa Seal</div>
<div id="_mcePaste">Josh Carroll</div>
<div><a href="http://thetestingblog.files.wordpress.com/2010/08/60.jpg"><img class="aligncenter size-full wp-image-440" title="60" src="http://thetestingblog.files.wordpress.com/2010/08/60.jpg?w=544&#038;h=224" alt="" width="544" height="224" /></a></div>
<p>Next we want to make sure that the text file is copied over into the bin folder on build.</p>
<p>Right click on your project (&#8220;TestingBlogSeleniumRc&#8221;) in the Solution Explorer and select <strong>Properties</strong>.  Then select <strong>Build Events</strong>.  Under the <strong>Pre-build event command line: </strong>(or post-build; it doesn&#8217;t matter) paste in:</p>
<p><code>copy "$(ProjectDir)ValueList.txt" "$(TargetDir)"</code></p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/08/59.jpg"><img class="aligncenter size-full wp-image-438" title="59" src="http://thetestingblog.files.wordpress.com/2010/08/59.jpg?w=544&#038;h=272" alt="" width="544" height="272" /></a></p>
<p>Our test is going to be looking for ValueList.txt so that copy command assures that it&#8217;s in the same folder as the test dll.</p>
<p><strong>(FULL CODE EXAMPLE BELOW)</strong></p>
<ul>
<li>We need to add a reference to System.IO</li>
<li>Next we&#8217;re going to add a global string array to our class called <strong>textPresentList</strong></li>
<li>We are going to read the ValueList.txt file into an array in our setup.  As coded, it should only be read in the first time the SetupTest() method is run.  If you&#8217;re a Unit Test purist, you could easily change it to read the file in every time, but I thought it seemed like a waste.</li>
<li>Next we need to add the <span style="color:#33cccc;">Range </span>attribute to a copied and renamed version of our first test.  The range should be hard coded from 0 to 2.  (I tried to do something clever like put it from 0 to textPresentList.Length-1, but the compile wouldn&#8217;t have it.  These NUnit attribute values, it appears have to be somewhat static.  This kludge that I&#8217;m showing is way to get around the static nature if only a little bit.  This way the values can be dynamic even if the number of values can&#8217;t be.  By the way, if anyone has a better idea to make it more dynamic, please post it.)</li>
<li>Change the <strong>selenium.IsTextPresent(textPresent)</strong> to <strong>selenium.IsTextPresent(textPresentList[i])</strong>.</li>
<li>Then Compile and Run.</li>
</ul>
<p><a href="http://thetestingblog.files.wordpress.com/2010/08/63.jpg"><img class="aligncenter size-full wp-image-441" title="63" src="http://thetestingblog.files.wordpress.com/2010/08/63.jpg?w=328&#038;h=136" alt="" width="328" height="136" /></a></p>
<p>You won&#8217;t be able to see the values from the file in the Test Runner, but you could write the value translations to the console so that you could see which index corresponds to which value:<br />
<code>Console.WriteLine("Index " + i +": " + textPresentList[i]);</code></p>
<p>In the Test Runner, select the <strong>Text Output</strong> tab to view the output:</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/08/66.jpg"><img class="aligncenter size-full wp-image-444" title="66" src="http://thetestingblog.files.wordpress.com/2010/08/66.jpg?w=544&#038;h=262" alt="" width="544" height="262" /></a></p>
<p>The whole point of this post is not to show you what to do, but instead to open up your mind to possibilities.  NUnit has some cool functionality, and most of us never scrape the surface of it&#8217;s potential.  I challenge you to go and explore the various attributes available for yourself.  Here&#8217;s the link: <a href="http://nunit.org/index.php?p=attributes&amp;r=2.5.7">http://nunit.org/index.php?p=attributes&amp;r=2.5.7</a></p>
<p><strong>Remember upgrade your NUnit to the newest version.  Chances are that you&#8217;re not current.</strong></p>
<p><strong>FULL CODE:</strong></p>
<pre class="brush: csharp;">
using System;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;

namespace TestingBlogSeleniumRc
{
	[TestFixture]
	public class FirstTest
	{
		private ISelenium selenium;
        private string[] textPresentList;

		[SetUp]
		public void SetupTest()
		{
            if (textPresentList == null)
                textPresentList = File.ReadAllLines(&quot;ValueList.txt&quot;);
			selenium = new DefaultSelenium(&quot;localhost&quot;, 4444, &quot;*iexplore&quot;, &quot;http://www.google.com/&quot;);
			selenium.Start();
		}

		[TearDown]
		public void TeardownTest()
		{
		    selenium.Stop();
		}

        [Test]
        public void DynamicValuesTest([Range(0,2)] int i)
		{
			selenium.Open(&quot;http://www.google.com&quot;);
			selenium.Type(&quot;q&quot;, &quot;thetestingblog.com&quot;);
			selenium.Click(&quot;btnI&quot;);
			selenium.WaitForPageToLoad(&quot;60000&quot;);
            Console.WriteLine(&quot;Index &quot; + i +&quot;: &quot; + textPresentList[i]);
            Assert.IsTrue(selenium.IsTextPresent(textPresentList[i]));
		}
        [Test]
        public void ValuesTest([Values(&quot;Daniel Brown&quot;, &quot;Marisa Seal&quot;, &quot;Josh Carroll&quot;)] string textPresent)
        {
            selenium.Open(&quot;http://www.google.com&quot;);
            selenium.Type(&quot;q&quot;, &quot;thetestingblog.com&quot;);
            selenium.Click(&quot;btnI&quot;);
            selenium.WaitForPageToLoad(&quot;60000&quot;);
            Assert.IsTrue(selenium.IsTextPresent(textPresent));
        }
	}
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thetestingblog.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thetestingblog.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thetestingblog.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thetestingblog.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thetestingblog.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thetestingblog.wordpress.com/425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thetestingblog.wordpress.com/425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thetestingblog.wordpress.com/425/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thetestingblog.com&amp;blog=8467555&amp;post=425&amp;subd=thetestingblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thetestingblog.com/2010/08/31/have-you-heard-about-nunit-attributes-and-how-theyre-awesome/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43a80f3d05753a9af40a3725839bf178?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aubrownds</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/08/49.jpg" medium="image">
			<media:title type="html">49</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/08/60.jpg" medium="image">
			<media:title type="html">60</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/08/59.jpg" medium="image">
			<media:title type="html">59</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/08/63.jpg" medium="image">
			<media:title type="html">63</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/08/66.jpg" medium="image">
			<media:title type="html">66</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium RC In C# as a Console App: Another End-To-End Example</title>
		<link>http://thetestingblog.com/2010/02/02/selenium-rc-in-console-app/</link>
		<comments>http://thetestingblog.com/2010/02/02/selenium-rc-in-console-app/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:26:10 +0000</pubDate>
		<dc:creator>Daniel Brown</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[test automation]]></category>

		<guid isPermaLink="false">http://thetestingblog.com/?p=364</guid>
		<description><![CDATA[The purpose of this post is to show people how to wrap a Selenium RC test up into a console app (*.exe) so can been executed from the command line.  This is a solution makes it where you don&#8217;t have to have NUnit involved. Déjà vu all over again! Another basic Selenium example. What the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thetestingblog.com&amp;blog=8467555&amp;post=364&amp;subd=thetestingblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The purpose of this post is to show people how to wrap a Selenium RC test up into a console app (*.exe) so can been executed from the command line.  This is a solution makes it where you don&#8217;t have to have NUnit involved.</p>
<p>Déjà vu all over again!  Another basic Selenium example.  What the  heck!?  Can&#8217;t this guy do anything else?</p>
<p>Well, I agree this is somewhat repetitive, but I hope that this sequel will be in the league of Empire Strikes Back or Star Trek: The Wrath of Khan.  Both movies, though they were sequels, were arguably greater than the originals. These sequels introduce us to the likes of Ricardo Montalban playing &#8220;Khan&#8221; and Billy Dee Williams playing &#8220;Lando Calrissian&#8221;.  And of course,  a muppet playing &#8220;Yoda&#8221;.</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/collage1.jpg"><img class="aligncenter size-full wp-image-366" title="collage" src="http://thetestingblog.files.wordpress.com/2010/02/collage1.jpg?w=544&#038;h=450" alt="" width="544" height="450" /></a></p>
<p>Of course, many sequels start off with the desire to be Empire, and instead they end up being:</p>
<ul>
<li>Caddyshack II</li>
<li>Beastmaster 2: Through the Portal of Time</li>
<li>Speed 2: Cruise Control</li>
<li>Batman and Robin (No, we don&#8217;t need nipples on the Batman suit, Joel Schumacher.  But thanks for asking.)</li>
<li>Mannequin: On the Move.</li>
<li>Or the biggest sacrileges of all time Godfather III</li>
<li>And Episode I (Empire, it is not!).</li>
</ul>
<p>My hope is that this post doesn&#8217;t suck like those movies.  At the very least it&#8217;s nipple and Clooney free.</p>
<hr />First off, you need to get all these things (if you don&#8217;t have them):</p>
<ul>
<li><a href="http://release.seleniumhq.org/selenium-remote-control/1.0.1/selenium-remote-control-1.0.1-dist.zip">Selenium RC</a></li>
<li><a href="http://www.mozilla.com/products/download.html?product=firefox-3.5.2&amp;os=win&amp;lang=en-US">Firefox</a></li>
<li><a href="http://release.openqa.org/selenium-ide/1.0.2/selenium-ide-1.0.2.xpi">Selenium IDE</a></li>
<li><a href="http://www.java.com/en/download/index.jsp">Java Runtime Environment</a> (You should already have this)</li>
<li><a href="http://www.microsoft.com/express/Downloads/#2008-Visual-CS">Visual C# 2008 Express Edition </a> (Only get this if you don&#8217;t have a full version of Visual Studio)</li>
</ul>
<hr /><strong>Install instructions for the downloads:</strong></p>
<p><strong>Selenium RC</strong><br />
-No installation necessary. Just find a permanent location and unzip it there. I unzipped mine at <span style="color:#0000ff;">C:\</span> just to make things simple</p>
<p><strong>Firefox, Visual Studio Express, and Java</strong><br />
-Just run the respective installs with all defaults selected.</p>
<p><strong>Selenium IDE</strong><br />
-To install, right click on the file and select &#8220;Open With&#8230;&#8221;<br />
-Select Firefox in the programs list. If it&#8217;s not in the immediate menu, browse to it. (default location should be &#8220;<span style="color:#0000ff;">C:\Program Files\Mozilla Firefox\firefox.exe</span>&#8220;<br />
-When Firefox launches, click button in the dialog box that says &#8220;Install Now&#8221;.<br />
-After the install of the plug-in, hit the &#8220;Restart Firefox&#8221; button when you see it.</p>
<hr /><strong>Phase One: Record a Test using Selenium IDE</strong></p>
<p>Okay, so, now that you have the tools, we&#8217;re going to record a simple test in Selenium IDE. Even though we want to eventually run the test in Selenium RC, Selenium IDE is a great tool for getting the basic test recorded since it&#8217;s all UI point and click.</p>
<ul>
<li>Start up Firefox.</li>
<li>Click on the &#8220;Tools&#8221; menu and click on &#8220;Selenium IDE&#8221;</li>
<li><em>(Take your time to explore the Selenium IDE form)</em></li>
<li>Notice that it&#8217;s already recording.  The red circle button on the right side is pressed in:</li>
<li>Type &#8220;<span style="color:#0000ff;">www.google.com</span>&#8221; the main Firefox browser address bar and navigate to it.</li>
<li>In the search box, type in &#8220;<span style="color:#0000ff;">thetestingblog.com</span>&#8221; and hit the &#8220;I&#8217;m Feeling Lucky&#8221; button.</li>
<li><em>Notice in your Selenium IDE window that steps are being recorded.</em></li>
<li><em>With any luck, you hopefully landed on this blog&#8217;s home page.</em></li>
<li>Highlight the text &#8220;Daniel Brown&#8221; on the page, right click.  You should select the option that says &#8220;VerifyTextPresent Daniel Brown&#8221;.  See below:</li>
</ul>
<p><img class="aligncenter size-full wp-image-194" title="Screenshot_VerifyTextPresent" src="http://thetestingblog.files.wordpress.com/2009/09/screenshot_verifytextpresent.jpg?w=544&#038;h=378" alt="Screenshot_VerifyTextPresent" width="544" height="378" /></p>
<ul>
<li><em>Okay, we got our test recorded.  Now let&#8217;s run it to make sure it passes.</em></li>
<li>Unclick the red circle button to turn off recording.</li>
<li>Click on the green play triangle with the single bar to run the test</li>
</ul>
<p><img class="aligncenter size-full wp-image-197" title="Screenshot_PassedIDETest" src="http://thetestingblog.files.wordpress.com/2009/09/screenshot_passedidetest2.jpg?w=398&#038;h=517" alt="Screenshot_PassedIDETest" width="398" height="517" /></p>
<ul>
<li>All green, it passed.  Good.</li>
<li>Now we want to convert this test to C#.</li>
<li>Select &#8220;Options -&gt;Format -&gt; C# &#8211; Selenium RC&#8221; from the Selenium IDE window.</li>
</ul>
<p><img class="aligncenter size-full wp-image-198" title="Screenshot_ConvertToCSharp" src="http://thetestingblog.files.wordpress.com/2009/09/screenshot_converttocsharp.jpg?w=444&#038;h=517" alt="Screenshot_ConvertToCSharp" width="444" height="517" /></p>
<ul>
<li>Next select all the C# code and copy it.</li>
</ul>
<hr /><strong>Phase Two: Setup the C# Console App</strong></p>
<ul>
<li>Open up Visual Studio</li>
<li>Select &#8220;File -&gt;New -&gt;Project&#8221;</li>
<li>In the New Project window under project types, select &#8220;Visual C# -&gt;Windows&#8221;</li>
<li>Select the &#8220;Console Application&#8221; Template and name it something like &#8220;TestingBlogSeleniumTest&#8221; and click &#8220;Ok&#8221;.</li>
<li>It will create the project along with a file called &#8220;Program.cs&#8221;.  Paste your SeleniumIDE test into Notepad.  You&#8217;re going to take pieces out of the test and put it in &#8220;Program.cs&#8221;.</li>
</ul>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/toppart2.jpg"><img class="aligncenter size-full wp-image-374" title="TopPart" src="http://thetestingblog.files.wordpress.com/2010/02/toppart2.jpg?w=544&#038;h=214" alt="" width="544" height="214" /></a></p>
<ol>
<li>Add the using references from the SeleniumIDE test.  Replace any that are there.</li>
<li>Add the &#8220;ISelenium&#8221; and &#8220;StringBuilder&#8221; object references inside the Main() method.  As you see, I removed the &#8220;private&#8221; access control prefixes.  We don&#8217;t need them.</li>
<li>Add the body of the SetupTest() method after the object references.  (I put a comment to designate that it was part of the setup.)</li>
<li>Change &#8220;*chrome&#8221; to &#8220;*iexplore&#8221; for Internet Explorer.  Use &#8220;*firefox&#8221; for Firefox.  (There are other browser options, but those work best.)</li>
<li>Change the URL to the site you start your test on.  In this case, change that URL to &#8220;http://www.google.com/&#8221; since we&#8217;re starting from Google.</li>
</ol>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/paste-in-bodies2.jpg"><img class="aligncenter size-full wp-image-375" title="Paste in Bodies" src="http://thetestingblog.files.wordpress.com/2010/02/paste-in-bodies2.jpg?w=544&#038;h=412" alt="" width="544" height="412" /></a></p>
<p>6. Paste body of the TheUntitledTest() method into the Main() method.</p>
<p>7. Paste body of the TeardownTest() method into the Main() method.</p>
<p>8.  Get rid of the Try/Catch blocks on Teardown.</p>
<p>9. Get rid of the StringBuilder references.</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/replacebodytext1.jpg"><img class="aligncenter size-full wp-image-376" title="ReplaceBodyText" src="http://thetestingblog.files.wordpress.com/2010/02/replacebodytext1.jpg?w=544&#038;h=317" alt="" width="544" height="317" /></a></p>
<p>10.  Get rid of the Try/Catch block in the test body, replacing it with an if statement that writes to the console window if true (See my code below).  Notice that I have to cast the Selenium.IsTextPresent statement as a boolean.  I don&#8217;t understand why it doesn&#8217;t work without it because the return type for that method should be boolean.  But whatever.  I&#8217;m just dummy tester; what do I know?</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/closeup.jpg"><img class="aligncenter size-full wp-image-372" title="closeup" src="http://thetestingblog.files.wordpress.com/2010/02/closeup.jpg?w=544&#038;h=120" alt="" width="544" height="120" /></a></p>
<ul>
<li>Next we need to add all the references so this thing will run.</li>
<li>Go to the solution explorer, and right click on the &#8220;References&#8221; and select &#8220;Add Reference&#8230;&#8221;</li>
<li>Hit the &#8220;Browse&#8221; tab and navigate to where you unzipped your SeleniumRC files.  Look in the dotnet client driver folder.  Here&#8217;s the path to mine:</li>
</ul>
<p><span style="color:#0000ff;">C:\selenium-remote-control-1.0.1\selenium-dotnet-client-driver-1.0.1\</span></p>
<ul>
<li>Once you navigate to where the proper *.dlls are, select all of them and click &#8220;OK&#8221; to add them to the project.  (I know you can probably get away with adding less, but let&#8217;s keep it simple.)</li>
</ul>
<p><img class="aligncenter size-full wp-image-203" title="Add References" src="http://thetestingblog.files.wordpress.com/2009/09/add-references1.jpg?w=544&#038;h=292" alt="Add References" width="544" height="292" /></p>
<ul>
<li>Build the project to see if it works.  (Mine worked.  Hopefully yours did too.)</li>
</ul>
<hr /><strong>Phase Three: Running the Selenium RC test Console App</strong></p>
<ul>
<li>In order to run the Selenium RC test, you first have to have the Selenium RC server running.  The Selenium RC server folder should be in the files you unzipped.  Normally, I have a batch file on my desktop created to run the Selenium Server, but for our purposes, we&#8217;ll just run this from the &#8220;Start -&gt; Run&#8221; commandline, using this command:</li>
</ul>
<p><span style="color:#0000ff;">java -jar C:\selenium-remote-control-1.0.1\selenium-server-1.0.1\selenium-server.jar</span></p>
<ul>
<li>You should see some a dos window popup, and you will see something like the screenshot below.  DON&#8217;T CLOSE IT WHILE TESTING; IT NEEDS TO STAY RUNNING.  If you don&#8217;t have Java installed, this won&#8217;t work.  But most people should already have Java.</li>
</ul>
<p><img class="aligncenter size-full wp-image-205" title="SeleniumServer" src="http://thetestingblog.files.wordpress.com/2009/09/seleniumserver.jpg?w=544&#038;h=272" alt="SeleniumServer" width="544" height="272" /></p>
<p>Next you need to select Debug from your Visual Studio menu and select &#8220;Start Without Debugging&#8221;. (I&#8217;m choosing this option because it doesn&#8217;t close the console window after the end of execution.  The debug option does.)</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/start.jpg"><img class="aligncenter size-full wp-image-377" title="Start" src="http://thetestingblog.files.wordpress.com/2010/02/start.jpg?w=544&#038;h=306" alt="" width="544" height="306" /></a></p>
<p>You should see the Selenium window(s) pop-up.  And it should do it&#8217;s thing.  When it&#8217;s finished, you should see something like this:</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/19.jpg"><img class="aligncenter size-full wp-image-378" title="19" src="http://thetestingblog.files.wordpress.com/2010/02/19.jpg?w=544&#038;h=274" alt="" width="544" height="274" /></a></p>
<p>So, where is my test executable?  Well, it&#8217;s in the bin\debug folder of the project.  For me, the path to it looks like this:</p>
<p>C:\Documents and Settings\dbrown\My Documents\Visual Studio 2008\Projects\TestingBlogSeleniumTest\TestingBlogSeleniumTest\bin\Debug\</p>
<p>So, what do I need to run the program?  Just take the executable file and the dll&#8217;s.  Make sure the dll&#8217;s are in the same folder as the test when you execute it, otherwise you will get a big fat error.  If you send the executable to someone, make sure you send the dll&#8217;s too.</p>
<p><a href="http://thetestingblog.files.wordpress.com/2010/02/debugfolder.jpg"><img class="aligncenter size-full wp-image-380" title="debugfolder" src="http://thetestingblog.files.wordpress.com/2010/02/debugfolder.jpg?w=544&#038;h=265" alt="" width="544" height="265" /></a></p>
<p>Remember if you port that executable to another computer, it needs to be a Windows box with the .NET framework installed and Selenium server needs to be running.  I hope this actually helps someone.  I&#8217;m going to post some tricks to &#8220;sex up&#8221; your console app.  Be looking for them shortly. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Sorry, I still haven&#8217;t figured out Selenium GRID good enough to post on it.  Maybe Marisa could post on it?  She&#8217;s awesome like that.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thetestingblog.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thetestingblog.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thetestingblog.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thetestingblog.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thetestingblog.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thetestingblog.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thetestingblog.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thetestingblog.wordpress.com/364/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thetestingblog.com&amp;blog=8467555&amp;post=364&amp;subd=thetestingblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thetestingblog.com/2010/02/02/selenium-rc-in-console-app/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43a80f3d05753a9af40a3725839bf178?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aubrownds</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/collage1.jpg" medium="image">
			<media:title type="html">collage</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2009/09/screenshot_verifytextpresent.jpg" medium="image">
			<media:title type="html">Screenshot_VerifyTextPresent</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2009/09/screenshot_passedidetest2.jpg" medium="image">
			<media:title type="html">Screenshot_PassedIDETest</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2009/09/screenshot_converttocsharp.jpg" medium="image">
			<media:title type="html">Screenshot_ConvertToCSharp</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/toppart2.jpg" medium="image">
			<media:title type="html">TopPart</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/paste-in-bodies2.jpg" medium="image">
			<media:title type="html">Paste in Bodies</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/replacebodytext1.jpg" medium="image">
			<media:title type="html">ReplaceBodyText</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/closeup.jpg" medium="image">
			<media:title type="html">closeup</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2009/09/add-references1.jpg" medium="image">
			<media:title type="html">Add References</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2009/09/seleniumserver.jpg" medium="image">
			<media:title type="html">SeleniumServer</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/start.jpg" medium="image">
			<media:title type="html">Start</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/19.jpg" medium="image">
			<media:title type="html">19</media:title>
		</media:content>

		<media:content url="http://thetestingblog.files.wordpress.com/2010/02/debugfolder.jpg" medium="image">
			<media:title type="html">debugfolder</media:title>
		</media:content>
	</item>
		<item>
		<title>What I Learned by Contributing to FitNesse</title>
		<link>http://thetestingblog.com/2010/01/04/contributing-to-fitnesse/</link>
		<comments>http://thetestingblog.com/2010/01/04/contributing-to-fitnesse/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 07:52:17 +0000</pubDate>
		<dc:creator>Marisa Seal</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[testing tools]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://thetestingblog.com/?p=353</guid>
		<description><![CDATA[by Marisa Seal As of today, I am officially a contributor to FitNesse. I contributed a new feature idea and its implementation (the initial idea was borrowed from FitLibrary&#8217;s SequenceFixture but morphed a bit based on suggestions from Bob Martin), and also worked on Slim version detection. I am not a developer by training nor [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thetestingblog.com&amp;blog=8467555&amp;post=353&amp;subd=thetestingblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>by <a href="http://thetestingblog.com/author/marrrisa/" target="_blank">Marisa Seal</a></p>
<p>As of today, I am officially a <a href="http://fitnesse.org/.FrontPage.FitNesseDevelopment.FitNesseRelease20100103" target="_blank">contributor to FitNesse</a>. I contributed a <a href="http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.TestSequentialArgumentProcessing" target="_blank">new feature</a> idea and its implementation (the initial idea was borrowed from FitLibrary&#8217;s <a href="http://fitnesse.org/FitNesse.UserGuide.FixtureGallery.FitLibraryFixtures.SequenceFixture" target="_blank">SequenceFixture</a> but morphed a bit based on suggestions from Bob Martin), and also worked on Slim version detection. I am not a developer by training nor trade, but armed with basic coding skills and fueled by the guidance and what I can only describe as the graciousness of Uncle Bob, I was successful. The experience was trying, exciting, and actually pretty fun. While I learned an awful lot more than I&#8217;m going to detail here, I think I had three really important realizations while working on the updates.</p>
<h3>TDD Works!</h3>
<p>Given that I am a tester, I have read/learned about, discussed, and even advocated TDD. Given that I do not (usually) write production code, I had never actually tried it. I decided I&#8217;d give it a go since I needed to write unit tests for my updates anyway.</p>
<p>The existing unit tests for the class I updated served as my guide. I wrote a test to verify the simplest case of the new feature. I ran it &#8211; here&#8217;s the interesting thing: it passed. This surprised me, but also informed me that I <em>did not need to make any changes</em> to the code for the simplest case. The update involved implementing a special character to invoke a different processing scheme for function calls in Slim Script tables, so I had figured that I&#8217;d at least need to update the code to ignore the special character in the simplest case&#8230;but as the unit test proved, I did not.</p>
<p>I wrote a second unit test to verify another simple (yet different) case &#8211; this one failed as expected. I added code to the class in question, ran the test, and saw it fail again. But aha &#8211; I also saw <em>why</em> it failed, and that information helped me find my mistake. At this point I&#8217;d like to say that I made the fix, ran the test, and saw it pass &#8211; but it didn&#8217;t happen that way. I went through a few iterations of running the test and fixing my code.</p>
<p>The test finally passed, and I ran the entire suite of tests for the class. They all passed. The most appropriate word I can find to describe that moment is <em>epiphanic</em>. It was then that I truly understood and appreciated two of the benefits of TDD I have often heard:</p>
<ol>
<li>Practicing TDD can help ensure that only necessary code is implemented, since the goal of writing/updating the code is to make one test pass. Remember, I didn&#8217;t even need to write any code to make the first test pass.</li>
<li>Having a suite of unit tests &#8211; a byproduct of practicing TDD &#8211; can provide confidence that updates have not unintentionally changed existing behavior. The bonus is that unit tests are <strong>fast</strong>, so the feedback can be almost instantaneous. For example, the entire suite of 208 unit tests for the class I updated runs in under 1.5 seconds on my machine.</li>
</ol>
<p>Having an understanding of a practice is one thing; having experience implementing the practice is another. Upon reflection, I now find it odd that I could have advocated TDD without having tried it myself.</p>
<h3>Refactoring is more than just &#8220;Changing&#8221;</h3>
<p>I&#8217;m a bit embarrassed to admit this, but up until recently, I used the word &#8220;refactoring&#8221; as a substitute for &#8220;changing,&#8221; since I thought that&#8217;s what refactoring meant. I thought it was just a dev-ified word for &#8220;changing&#8221; or &#8220;improving.&#8221;</p>
<p>Once I submitted the first update to Bob Martin, I asked him for feedback. I was quite proud that the new feature took only about a dozen new and updated lines of code, but I wondered what I could have done better. Uncle Bob told me that since I had added a couple lines of code to an existing function, the function&#8217;s length was getting to the point where he&#8217;d want to extract some of the functionality &#8211; he suggested extracting a particular loop to a &#8220;method object.&#8221; I immediately Googled &#8220;extract to method object&#8221; and found information about it on <a href="http://www.refactoring.com/index.html" target="_blank">refactoring.com</a>. I quickly realized that refactoring actually encompasses specific techniques that address specific scenarios &#8211; refactoring is not just changing code.</p>
<p>I&#8217;m not as embarrassed to admit that I really had no clue how to execute &#8220;extract to method object.&#8221; I ruminated about it for a few days, and finally just told Uncle Bob that I didn&#8217;t know how to get started. He sent me the code, explained step-by-step how he got to the end result, but still allowed me to commit the change myself&#8230;which leads me to my last point.</p>
<h3>I think I know one reason why he&#8217;s called &#8220;Uncle&#8221; Bob</h3>
<p>There were many times throughout the last few weeks that I wondered when Uncle Bob would say to me &#8220;I&#8217;ll just do it myself &#8211; it&#8217;ll be faster that way.&#8221; That certainly would have been a true statement. Being that I am not &#8211; as I stated before &#8211; a developer by training or trade, I was surprised that he even supported the idea of me actually committing code changes when I first contacted him to suggest the new feature. It turns out that my fear and surprise were completely unfounded. Uncle Bob continually offered guidance and encouragement, and always ended his messages with &#8220;Let me know if you need any help.&#8221; Here&#8217;s the kicker: he meant it, too.</p>
<p>I really did feel like I was the lucky recipient of mentoring by a person who has literally &#8220;written the book&#8221; (multiple books, actually) about software craftsmanship.</p>
<p>I hope that some FitNesse users find the new feature valuable, and that I will be able to contribute to FitNesse again in the future. It was a great experience.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thetestingblog.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thetestingblog.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thetestingblog.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thetestingblog.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thetestingblog.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thetestingblog.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thetestingblog.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thetestingblog.wordpress.com/353/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thetestingblog.com&amp;blog=8467555&amp;post=353&amp;subd=thetestingblog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thetestingblog.com/2010/01/04/contributing-to-fitnesse/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f5524b69490657d7297e7dc63c8cad62?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">marrrisa</media:title>
		</media:content>
	</item>
	</channel>
</rss>