<?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/"
	>

<channel>
	<title>Thought Nursery &#187; code</title>
	<atom:link href="http://blog.jeffreyfredrick.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jeffreyfredrick.com</link>
	<description>Big ideas start small.</description>
	<lastBuildDate>Sat, 20 Feb 2010 23:33:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>OSTATLI: Safari &amp; Firefox with Watir</title>
		<link>http://blog.jeffreyfredrick.com/2009/02/17/ostatli-safari-firefox-with-watir/</link>
		<comments>http://blog.jeffreyfredrick.com/2009/02/17/ostatli-safari-firefox-with-watir/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 09:08:47 +0000</pubDate>
		<dc:creator>Jtf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[watir]]></category>

		<guid isPermaLink="false">http://blog.jeffreyfredrick.com/?p=84</guid>
		<description><![CDATA[I went to Elisabeth&#8216;s Open Source Testing Automation Tools Love In with a very clear mission: &#8220;Get SafariWatir testing my local WordPress instance the right way&#8220;, where the right way meant using a single script that would also run against IE and Firefox without modifications. I&#8217;m not sure I was a good OSTATLI participant because I [...]]]></description>
			<content:encoded><![CDATA[<p>I went to <a href="http://www.qualitytree.com">Elisabeth</a>&#8216;s <a href="http://testobsessed.com/2009/02/16/ostatli-update/">Open Source Testing Automation Tools Love In</a> with a very clear mission: &#8220;Get SafariWatir testing my local WordPress instance <em>the right way</em>&#8220;, where <em>the right way</em> meant using a single script that would also run against IE and Firefox without modifications. I&#8217;m not sure I was a good OSTATLI participant because I spent most of my time in the corner trying to get my goal met while other people were talking about cool stuff (which is why Watir/FireWatir/SafariWatir didn&#8217;t make the list of tools; I didn&#8217;t know we were making a list). But I had a blast anyway and was able to meet my modest goal.</p>
<p>My starting point wasn&#8217;t quite ground zero but it was close. I used Ruby on a project for a couple of months a couple of years ago but I haven&#8217;t used it since. And I&#8217;ve never used Watir. The last time I wrote tests to drive a browser it was 2002 and I was using WinRunner.</p>
<p>My motivation for this project came as a side-effect of my recent change from full-time to consulting/contract work. I&#8217;ve been working out of <a href="http://nextspace.us/">NextSpace</a>, a coworking operation in Santa Cruz, and that has given me a different set of colleagues than I&#8217;ve had in the past. I&#8217;m now daily rubbing shoulders with a range of interesting people, but a bunch of them churn out websites for a range of clients. The technologies vary — WordPress, Drupal, Flash, Ruby/Rails, etc — but one common factor is there seems to little in the way of automated testing, even for sites that involve a lot of custom coding. I&#8217;ve wanted to know if some of the tools from enterprise IT and product development could be applied in their context.</p>
<p>I was interested in using Watir for a few different reasons. One seeming motivation is that I&#8217;ve done some consulting for <a href="http://www.watircraft.com/">WatirCraft</a>, but that&#8217;s getting things out of order: I was <a href="http://blog.jeffreyfredrick.com/2008/06/23/watircraft-announced/">interested in what they&#8217;re doing</a> before I started working with them. What really attracts me to Watir is the philosophy that they want to take maximum advantage of Ruby as a language, as opposed to having a language neutral API like Selenium. I enjoyed Ruby when I worked with it and I&#8217;d like to do more of it. I also really like the idea of Ruby as a language for testers. Testers have long done more coding than they get credit for; switching that coding to Ruby should offer more opportunities for collaboration with developers and more credit and status from the coding they were doing already.</p>
<p>I was also interested in doing this experiment with Ruby because <a href="http://www.pettichord.com/">Bret</a>/WatirCraft have been working on a new <a href="http://www.io.com/~wazmo/blog/archives/2009_02.html#000291">WatirCraft framework</a>, with <a href="http://github.com/bret/watircraft/tree/master">the source available in GitHub</a>, and one of the enabling changes in Watir was to allow browser independent scripts by using <a href="http://wiki.openqa.org/display/WTR/Browser.new">Watir::Browser.new</a>. All the references I&#8217;ve seen to this reference IE and Firefox, but since I&#8217;m on OS X (and because I&#8217;m a bit of an Mac fanboi) anything that doesn&#8217;t work with Safari is a non-starter. I went so far as to ask for Safari support on the WatirCraft <a href="http://watir.uservoice.com/pages/general/suggestions/74932-combine-safariwatir-into-watir">UserVoice page</a> only to be told it was already there. Oh. Okay then&#8230;</p>
<p>So here&#8217;s what I actually did. I installed the very awesome <a href="http://www.mamp.info">MAMP</a>, an all-in-one installer for Macs to run an Apache, MySQL and PHP stack. Next was WordPress 2.7. Ruby 1.8.7 came via the also awesome <a href="http://www.macports.org/">MacPorts</a>. Then began the fun that started &#8220;sudo gem install &#8230;&#8221;:</p>
<ul>
<li>safariwatir</li>
<li>firewatir</li>
<li>rspec</li>
<li>cucumber</li>
</ul>
<p>I didn&#8217;t actually use <a href="http://cukes.info/">Cucumber</a>, but there was talk of it in the air and the <a href="http://github.com/bret/framework-examples/tree/master">examples</a> look interesting so I gave into the peer pressure. (Maybe in a future OSTATLI&#8230;)</p>
<p>Honestly I struggled a bit getting started from that point, trying to run the Watir tests against <a href="http://safariwatir.rubyforge.org/">SafariWatir</a>&#8230; or even the SafariWatir tests on itself! But here <a href="http://twitter.com/Jtf/status/1184274982">the power of Twitter</a> came in handy, with Dave Hoover stepping up from behind the <a href="http://twitter.com/SafariWatir">SafariWatir twitter account</a> and updating the directions for running the Watir tests in GitHub in real time. Dave likewise <a href="http://twitter.com/SafariWatir/status/1185053020">saved me from the rathole</a> of the old SafariWatir tests. In the midst of my struggles I did come to appreciate GitHub. It was trivially easy for me to fork SafariWatir and send a couple of minor tweaks back to Dave. After years of taking submission to CruiseControl via patch files and working with CVS and SVN, I&#8217;m jealous!</p>
<p>Eventually I was able to sort our some basic RSpec syntax and some basic Watir syntax and put together <a href="http://pastie.org/391522">this script</a> which met my goal. If you have the default WordPress 2.7 site running on port 8080 (and you have the same admin password that I left hardcoded in the script) then this script will open Safari, log into WordPress, post a message and logout. Change Watir::Browser.default = &#8216;safari&#8217; to Watir::Browser.default = &#8216;firefox&#8217; (and <a href="http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-3%29InstalltheJSSHFirefoxExtension">install JSSH</a>) and the script will run against Firefox instead. This setting is in script for connivence; if I were testing in anger I would be setting it with an environment variable from Rake as I ran the tests.</p>
<p>My plan for the future it to take this a step farther and try running the same tests from <a href="http://celerity.rubyforge.org/">Celerity</a>. My vision is a system where we run tests in Celerity for fast feedback and then run across browsers to surface compatibility issues.</p>
<p>I would love to do more work doing cross-browser testing with Watir (and fix some of the incompatibilities in the process). If you know of anyone with a contract for that kind of work they can <a href="http://ci-guys.com/">contact me via The CI Guys website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jeffreyfredrick.com/2009/02/17/ostatli-safari-firefox-with-watir/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A Quick AlphaLabelIncrementer</title>
		<link>http://blog.jeffreyfredrick.com/2008/07/10/a-quick-alphalabelincrementer/</link>
		<comments>http://blog.jeffreyfredrick.com/2008/07/10/a-quick-alphalabelincrementer/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 23:54:57 +0000</pubDate>
		<dc:creator>Jtf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[cruisecontrol]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://blog.jeffreyfredrick.com/?p=10</guid>
		<description><![CDATA[On the CruiseControl users mailing list Adam asked for a simple label incrementer that would work with a single character in a series (&#8220;a&#8221;, &#8220;b&#8221;, &#8220;c&#8221;, etc.). Simple enough, but not worth adding to the project, so here it is, test (first) and code. (Suggestions for better sites for sharing code snippets?)]]></description>
			<content:encoded><![CDATA[<p>On the CruiseControl users mailing list Adam asked for a simple label incrementer that would work with a single character in a series (&#8220;a&#8221;, &#8220;b&#8221;, &#8220;c&#8221;, etc.). Simple enough, but not worth adding to the project, so here it is, <a href="http://jtf.tumblr.com/post/41816713/alphalabelincrementertest">test</a> (first) and <a href="http://jtf.tumblr.com/post/41816834/alphalabelincrementer">code</a>.</p>
<p>(Suggestions for better sites for sharing code snippets?)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jeffreyfredrick.com/2008/07/10/a-quick-alphalabelincrementer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
