<?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>just in ram &#187; Ruby</title>
	<atom:link href="http://justinramel.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://justinramel.com</link>
	<description>A list of stuff I should remember but never do</description>
	<lastBuildDate>Sat, 24 Jul 2010 10:14:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SAP Enterprise Portal + Automated Functional Testing &#8211; Part 7 of &#8230;</title>
		<link>http://justinramel.com/2006/12/05/sap-enterprise-portal-automated-functional-testing-part-7-of/</link>
		<comments>http://justinramel.com/2006/12/05/sap-enterprise-portal-automated-functional-testing-part-7-of/#comments</comments>
		<pubDate>Tue, 05 Dec 2006 14:42:36 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[SAP Enterprise Portal]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Watir]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/12/05/sap-enterprise-portal-automated-functional-testing-part-7-of/</guid>
		<description><![CDATA[In anticipation of posting about a new topic I&#8217;m going to wrap up my Watir Automated testing posts with a few more top tips.
TOP TIP &#8211; How do I run a single test?
So you have lots of tests in your test suite but only want to run one? No need to create an ad-hoc test [...]]]></description>
			<content:encoded><![CDATA[<p>In anticipation of posting about a new topic I&#8217;m going to wrap up my Watir Automated testing posts with a few more top tips.</p>
<p><b>TOP TIP &#8211; How do I run a single test?</b></p>
<p>So you have lots of tests in your test suite but only want to run one? No need to create an ad-hoc test case, simply pass in the <b>&#8211;name</b> parameter when running the test:</p>
<p><code>ruby test_mytestcase.rb --name test_just_this_method</code></p>
<p><b>TOP TIP &#8211; How do I run the test in background mode?</b></p>
<p>Running the test so you can see what is going on in the browser is sometimes useful but most of the time you&#8217;ll want to run the tests in the background and just see the results. This is easily done by passing the <b>-b</b> parameter on the command line:</p>
<p><code>ruby test_mytestcase.rb -b</code></p>
<p><b>TOP TIP &#8211; Helper methods</b></p>
<p>I have a couple of helper methods which I use in most of my test cases:<br />
<code><br />
def should_find(find_me)<br />
  assert(@ie.contains_text(find_me), "*\n*\n*\nText not found: #{find_me}\n*\n*\n*")<br />
end</p>
<p>def should_not_find(find_me)<br />
  assert_nil(@ie.contains_text(find_me), "*\n*\n*\nFound text which should not be present: #{find_me}\n*\n*\n*")<br />
end<br />
</code><br />
No clever code here it just means I can write tests which are easier to read:<br />
<code><br />
should_not_find("Portal Runtime Error")<br />
should_find("Success")<br />
</code><br />
<b>FIN</b><br />
Well I&#8217;m running out of content about testing as you can probably tell! So I guess that&#8217;s a wrap. I&#8217;ll no doubt re-visit automated testing again at some point but for now that&#8217;s my lot.</p>
<p><b>NEXT TIME</b><br />
I&#8217;ve been working on creating web services for Enterprise Portal and calling those web services from Microsoft .Net. I&#8217;ve taken lots of notes, so expect a series of EP web services posts real soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/12/05/sap-enterprise-portal-automated-functional-testing-part-7-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby unit testing &#8211; run only one test</title>
		<link>http://justinramel.com/2006/12/05/ruby-unit-testing-run-only-one-test/</link>
		<comments>http://justinramel.com/2006/12/05/ruby-unit-testing-run-only-one-test/#comments</comments>
		<pubDate>Tue, 05 Dec 2006 12:25:16 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/12/05/ruby-unit-testing-run-only-one-test/</guid>
		<description><![CDATA[If you don&#8217;t wish to run all the unit tests in your test case you can tell ruby to run only one by passing in the name of the test:

  ruby test_mytestcase.rb --name test_just_this_method

]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t wish to run all the unit tests in your test case you can tell ruby to run only one by passing in the name of the test:</p>
<pre>
  ruby test_mytestcase.rb --name test_just_this_method
</pre>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/12/05/ruby-unit-testing-run-only-one-test/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ruby testing &#8211; setup project folders</title>
		<link>http://justinramel.com/2006/12/05/ruby-testing-setup-project-folders/</link>
		<comments>http://justinramel.com/2006/12/05/ruby-testing-setup-project-folders/#comments</comments>
		<pubDate>Tue, 05 Dec 2006 12:24:58 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/12/05/ruby-testing-setup-project-folders/</guid>
		<description><![CDATA[Its a good idea to keep your test cases seperate from your production code:

  myproject
      lib/
          workomatic.rb
      test/
          test_workomatic.rb

When you have your project setup in this [...]]]></description>
			<content:encoded><![CDATA[<p>Its a good idea to keep your test cases seperate from your production code:</p>
<pre>
  myproject
      lib/
          workomatic.rb
      test/
          test_workomatic.rb
</pre>
<p>When you have your project setup in this way add the following line to the top of your test cases:</p>
<p>Inside test_workomatic.rb</p>
<pre>
  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
  require workomatic.rb
</pre>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/12/05/ruby-testing-setup-project-folders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Enterprise Portal &#8211; Automated Functional Testing &#8211; Part 6 of &#8230;</title>
		<link>http://justinramel.com/2006/10/27/automated-functional-testing-part-6-of/</link>
		<comments>http://justinramel.com/2006/10/27/automated-functional-testing-part-6-of/#comments</comments>
		<pubDate>Fri, 27 Oct 2006 10:58:26 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[SAP Enterprise Portal]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Watir]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/10/27/automated-functional-testing-part-6-of/</guid>
		<description><![CDATA[Time for some more tips. I had a comment on my last post asking how to navigate around the portal so lets start there.
TOP TIP &#8211; How to navigate the portalSo how do you navigate around the portal using the menu? Simple you don&#8217;t! I found there are lots of problems using the portal menus [...]]]></description>
			<content:encoded><![CDATA[<p>Time for some more tips. I had a comment on my last post asking how to navigate around the portal so lets start there.</p>
<p><b>TOP TIP &#8211; How to navigate the portal</b><br />So how do you navigate around the portal using the menu? Simple you don&#8217;t! I found there are lots of problems using the portal menus due to the number of frames used so I simply jump directly to the URL of the PAR file I am testing. Here is a typical test:<br /> <code>def test_typical<br />&nbsp;&nbsp;&nbsp; # My Helper method which logs in using the given user id and password<br />&nbsp;&nbsp;&nbsp; logon("myuserid", "mypassword") </p>
<p>&nbsp;&nbsp;&nbsp; # Go directly to the URL of the PAR I want to test<br />&nbsp;&nbsp;&nbsp; @ie.goto('http://portal:50000/irj/servlet/prt/portal/prtroot/uk.ac.ncl.testing.ISRPageProcessor')</p>
<p>&nbsp;&nbsp;&nbsp; # do tests here<br />end</code><br />Ok that&#8217;s fine but how do you find the direct URL of the PAR file you want to test? Ahh thats were my next top tip comes in.</p>
<p><b>TOP TIP &#8211; How to find the direct URL of a PAR file</b><br />Open up the SAP Netweaver Developer Studio</p>
<p>Open your project</p>
<p>Open the file:<br /><code>MyPortalProject<br />&nbsp;&nbsp;&nbsp; dist<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PORTAL-INF<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Portalapp.xml</code><br />You should now see a &#8220;Run…&#8221; button for each portal component in your project</p>
<p>Click the &#8220;Run…&#8221; button and the dev studio will open up a new browser window with the URL of your PAR file. Now simply use this URL in your test scripts.</p>
<p><b>COMING UP IN PART SEVEN</b><br />Short and sweet but at least I&#8217;m posting more often. Next time&#8230; You guessed it more top tips!</p>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/10/27/automated-functional-testing-part-6-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Enterprise Portal &#8211; Automated Functional Testing &#8211; Part 5 of &#8230;</title>
		<link>http://justinramel.com/2006/10/18/sap-enterprise-portal-functional-testing-part-5-of/</link>
		<comments>http://justinramel.com/2006/10/18/sap-enterprise-portal-functional-testing-part-5-of/#comments</comments>
		<pubDate>Wed, 18 Oct 2006 11:13:13 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[SAP Enterprise Portal]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Watir]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/10/18/sap-enterprise-portal-functional-testing-part-5-of/</guid>
		<description><![CDATA[Ok last time I promised some hints and tips so lets begin. I&#8217;m going to keep the hints and tips posts fairly short in the hope it will encourage me to post more often. I received a comment on my last post asking how I find the ID/Name attributes of my forms so I though [...]]]></description>
			<content:encoded><![CDATA[<p>Ok last time I promised some hints and tips so lets begin. I&#8217;m going to keep the hints and tips posts fairly short in the hope it will encourage me to post more often. I received a comment on my last post asking how I find the ID/Name attributes of my forms so I though that would be a good place to start.</p>
<p><b>TOP TIP &#8211; How to find ID/Name attributes of a form<br /></b>To save me having to sifting through the html code of a page for the ID/Name of a control I use the <a target="_blank" href="http://www.mozilla.com/firefox/">FireFox</a> browser with the <a target="_blank" href="https://addons.mozilla.org/firefox/60/">Web Developer Toolbar</a> extension installed. The <a target="_blank" href="https://addons.mozilla.org/firefox/60/">Web Developer Toolbar</a> is a great time saver not only for finding out form details but it has lots of other features too, I strongly recommend you check it out.</p>
<p>When you have the <a target="_blank" href="https://addons.mozilla.org/firefox/60/">Web Developer Toolbar</a> installed under the <b>Forms menu</b> you have the <b>Display Form Details</b> option, simply select this option and the page will be highlighted with yellow tags showing the ID/Name attributes of each item on the form.</p>
<p><b>NOTE:</b> Forms items which are created using HTMLB do not get a static ID/Name attribute these attributes appear to be generated each time the page is created. If this is the case how do we write tests against HTMLB forms? That&#8217;s were the next top tip comes in&#8230;</p>
<p><b>TOP TIP &#8211; Writing Watir test against HTMLB forms</b><br />As I mentioned above HTMLB forms do not have a static ID/Name attribute, they are generated each time the page is created so you will find your HTMLB form controls will have an ID/Name of something along the lines of &#8220;htmlb_18528_htmlb_9998_3&#8243; if you then reload the page the ID/Name attributes will have changed i.e. &#8220;htmlb_18328_htmlb_9991_1&#8243;. This means the following Watir test code would not work as each time the page reloaded the <i>:id</i> attribute would be different.</p>
<p><code>@ie.text_field(:id, 'htmlb_18528_htmlb_9998_3').set('test me')</code></p>
<p>So how do we get around this? Well the best way I have found is to use Watir&#8217;s <i>:index</i> parameter when accessing form controls. The <i>:index</i> parameter works by sequentially counting form controls from left to right top to bottom. So to set the text of the second control on the page we use the following code:</p>
<p><code>@ie.text_field(:index, 2).set('test me')</code></p>
<p>This is not an ideal solution due to the fact if you change the layout of the page your index&#8217;s will also change and break your tests. However I&#8217;ve been using this method for a while now and it&#8217;s never been a major problem, besides I&#8217;m not sure how else it could be done!</p>
<p><b>COMING UP IN PART SIX</b><br />Well that post turned out to be slightly longer than I planned, so much for keeping these tips short. Next time more of the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/10/18/sap-enterprise-portal-functional-testing-part-5-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SDN Blog</title>
		<link>http://justinramel.com/2006/10/17/sdn-blog/</link>
		<comments>http://justinramel.com/2006/10/17/sdn-blog/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 09:15:33 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[SAP Enterprise Portal]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Watir]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/10/17/sdn-blog/</guid>
		<description><![CDATA[I was recently invited to start a blog on the SAP Software Developers Network (SDN). So I&#8217;ve written a series of posts about Automated Functional testing the SAP Portal using Watir:
SDN Blog
IntroductionAutomated Functional Testing &#8211; Part 1 of &#8230;Automated Functional Testing &#8211; Part 2 of &#8230;Automated Functional Testing &#8211; Part 3 of &#8230;Automated Functional Testing [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently invited to start a blog on the SAP Software Developers Network (SDN). So I&#8217;ve written a series of posts about Automated Functional testing the SAP Portal using Watir:</p>
<p><a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/251690007">SDN Blog</a></p>
<p><a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4050">Introduction</a><br /><a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4103">Automated Functional Testing &#8211; Part 1 of &#8230;</a><br /><a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4138">Automated Functional Testing &#8211; Part 2 of &#8230;</a><br /><a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4236">Automated Functional Testing &#8211; Part 3 of &#8230;</a><br /><a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4426">Automated Functional Testing &#8211; Part 4 of &#8230;</a></p>
<p>IMHO worth a look if your interested in testing your SAP Portal. I&#8217;ll start posting the rest of the series on here from now.</p>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/10/17/sdn-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby script to rename windows subversion files .svn to _svn</title>
		<link>http://justinramel.com/2006/05/04/ruby-script-to-rename-windows-subversion-files-svn-to-_svn/</link>
		<comments>http://justinramel.com/2006/05/04/ruby-script-to-rename-windows-subversion-files-svn-to-_svn/#comments</comments>
		<pubDate>Thu, 04 May 2006 21:46:34 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">https://justinram.wordpress.com/2006/05/04/ruby-script-to-rename-windows-subversion-files-svn-to-_svn/</guid>
		<description><![CDATA[
Dir["**/.svn"].each do &#124;folder&#124;
	File.rename(folder, folder.sub('.svn', '_svn'))
end

]]></description>
			<content:encoded><![CDATA[<pre>
Dir["**/.svn"].each do |folder|
	File.rename(folder, folder.sub('.svn', '_svn'))
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/05/04/ruby-script-to-rename-windows-subversion-files-svn-to-_svn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting Ruby on Rails to Microsoft SQL Server</title>
		<link>http://justinramel.com/2006/04/07/connecting-ruby-on-rails-to-microsoft-sql-server/</link>
		<comments>http://justinramel.com/2006/04/07/connecting-ruby-on-rails-to-microsoft-sql-server/#comments</comments>
		<pubDate>Fri, 07 Apr 2006 20:39:21 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">https://justinram.wordpress.com/2006/04/07/connecting-ruby-on-rails-to-microsoft-sql-server/</guid>
		<description><![CDATA[NOTE: These instructions are now seriously out of date. You may want to check out my always up to date *cheap* ebook instead. Connecting Ruby on Rails to Microsoft SQL Server eBook

It appears rails does not connect to MS SQL Server right out of the box.  You need to do the following to get [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: These instructions are now seriously out of date. You may want to check out my always up to date *cheap* ebook instead. <a href="/rails2ms-sql/">Connecting Ruby on Rails to Microsoft SQL Server eBook</a></strong></p>
<p><center><a href="/rails2ms-sql/"><img src="/rails2ms-sql/images/banner.png" /></a></center></p>
<p>It appears rails does not connect to MS SQL Server right out of the box.  You need to do the following to get the connection to work:</p>
<p>Get the latest source distribution of <a href="http://rubyforge.org/projects/ruby-dbi/" target="_blank">Ruby-DBI</a> and copy the file:</p>
<pre>bdi-0.1.0/lib/dbd/ADO.rb</pre>
<p>to:</p>
<pre>c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb</pre>
<p><strong>NOTE: The ADO directory does not exist on a standard install, you will need to create it.</strong></p>
<p>Then simply set up your railsapp/config/database.yml</p>
<p>Here’s an example for reference:</p>
<pre>
development:
  adapter: sqlserver
  database: database_name
  host: server_name
  username: user_name
  password: your_pw_here
</pre>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/04/07/connecting-ruby-on-rails-to-microsoft-sql-server/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Migrations &#039;Zombie State&#039; and MS SQL</title>
		<link>http://justinramel.com/2006/04/04/migrations-zombie-state-and-ms-sql/</link>
		<comments>http://justinramel.com/2006/04/04/migrations-zombie-state-and-ms-sql/#comments</comments>
		<pubDate>Tue, 04 Apr 2006 13:28:44 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/04/04/migrations-zombie-state-and-ms-sql/</guid>
		<description><![CDATA[Getting &#8216;Zombie State&#8217; errors with migrations and MS SQL Server? Add the following to your config/enviroment.rb:

ActiveRecord::Base.connection.instance_variable_get("@connection")["AutoCommit"] = false

]]></description>
			<content:encoded><![CDATA[<p>Getting &#8216;Zombie State&#8217; errors with migrations and MS SQL Server? Add the following to your config/enviroment.rb:</p>
<pre>
ActiveRecord::Base.connection.instance_variable_get("@connection")["AutoCommit"] = false
</pre>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/04/04/migrations-zombie-state-and-ms-sql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pluralize table names &#8211; no thanks!</title>
		<link>http://justinramel.com/2006/04/04/pluralize-table-names-no-thanks/</link>
		<comments>http://justinramel.com/2006/04/04/pluralize-table-names-no-thanks/#comments</comments>
		<pubDate>Tue, 04 Apr 2006 13:05:19 +0000</pubDate>
		<dc:creator>Justin Ramel</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://justinram.wordpress.com/2006/04/04/pluralize-table-names-no-thanks/</guid>
		<description><![CDATA[Sorry I just can&#8217;t live with plural table names, I just can&#8217;t get my head around it! Luckily it is easily turned off. In RadRails there is a simple tick box when creating the project which simply adds the following line to the end of your applications config/environment.rb file:

# Include your application configuration below
ActiveRecord::Base.pluralize_table_names = [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry I just can&#8217;t live with plural table names, I just can&#8217;t get my head around it! Luckily it is easily turned off. In RadRails there is a simple tick box when creating the project which simply adds the following line to the end of your applications config/environment.rb file:</p>
<pre>
# Include your application configuration below
ActiveRecord::Base.pluralize_table_names = false
</pre>
<p>I may live to regret not embracing plural table names but I doubt it!</p>
]]></content:encoded>
			<wfw:commentRss>http://justinramel.com/2006/04/04/pluralize-table-names-no-thanks/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
