<?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>Conceptric &#187; testing</title>
	<atom:link href="http://www.conceptric.co.uk/tag/testing/feed" rel="self" type="application/rss+xml" />
	<link>http://www.conceptric.co.uk</link>
	<description>Ideas and Applications</description>
	<lastBuildDate>Fri, 12 Aug 2011 13:00:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Pipe following equals software tester</title>
		<link>http://www.conceptric.co.uk/pipe-following-equals-software-tester.htm</link>
		<comments>http://www.conceptric.co.uk/pipe-following-equals-software-tester.htm#comments</comments>
		<pubDate>Thu, 14 Oct 2010 14:56:28 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Personal Perspectives]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=434</guid>
		<description><![CDATA[I&#8217;ve always loved pipe following: the practice of getting to know how chemical process plants work. Get yourself a set of process flowsheets, a few engineering drawings and get out on the Plant. You trace the flow of feedstocks as they turn into products through the network of pipes, pressure vessels and other process machinery. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always loved pipe following: the practice of getting to know how chemical process plants work. Get yourself a set of process flowsheets, a few engineering drawings and get out on the Plant. You trace the flow of feedstocks as they turn into products through the network of pipes, pressure vessels and other process machinery.</p>

<p><span id="more-434"></span>This hands-on approach gives you a visceral feel for what&#8217;s going on and whether it&#8217;s working properly. As a aspiring Engineer I found this a great way to see how process plant related to the engineering specifications and mass balances.</p>

<p>Looking back, this practice was a form of testing, applied to both my knowledge and the construction of the plant. In the latter guise it&#8217;s called commissioning, and you&#8217;d be surprised the problems you can find this way, from malfunctioning components to blockages caused by dead animals.</p>

<p>And that&#8217;s reminiscent of the early days of computing, when fixing a problem could mean finding a real dead bug in the system.</p>

<p>It seems that my process engineering background has followed me into software development: I&#8217;m just as fascinated by the use of software test techniques to follow software pipes. Test by test I can find my way around code, checking my understanding of what it does, how it works, and whether it matches the original design intent.</p>

<p>A comprehensive and robust test suite is worth it&#8217;s weight in gold when upgrading or carrying out routine maintenance. It&#8217;s really liberating to find that you can experiment in code without worrying whether, when the time comes to redeploy, nothing unexpected has changed.</p>

<p>So may be I&#8217;m one of life&#8217;s testers rather than an outright developer, but then again every developer show have a little tester in them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/pipe-following-equals-software-tester.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Evolving style after six months on Rails</title>
		<link>http://www.conceptric.co.uk/evolving-style-after-six-months-on-rails.htm</link>
		<comments>http://www.conceptric.co.uk/evolving-style-after-six-months-on-rails.htm#comments</comments>
		<pubDate>Thu, 04 Feb 2010 17:31:08 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=331</guid>
		<description><![CDATA[It's coming up to 6 months since I announced my transition from PHP to Ruby and I'm really getting the hang of my new web development toolkit by working on a personal project.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ruby-lang.org/en/">Ruby</a> which is an interpreted programming language, often called a scripting language, that I&#8217;ve been using alongside BASH for automating tasks on my Mac. Call me slow&#8230; no don&#8217;t, I&#8217;m quite sensitive, but I only recently coupled this with the Rails web <a href="http://en.wikipedia.org/wiki/Software_framework">software framework</a> and started working on a Ruby on Rails web application.</p>

<p>There&#8217;s no better way to learn a new language than to actually use it in real life. My Nature Notes started as a project for my partner in PHP, CodeIgniter actually, but progress was slow due to an enjoyment deficit.</p>

<p>Testing is the main reason that I grew unhappy with PHP, most of the tools were there, but the integration was patchy: the basics are all there in Ruby and it&#8217;s associated development frameworks and integrating new packages via ruby gems or plugins is simple.</p>

<p>I started using the built-in Rails testing tools, but for no particular reason I&#8217;ve moved on to <a href="http://rspec.info/">RSpec</a> for unit and functional Rails model and standalone Ruby code testing coupled with <a href="http://cukes.info/">Cucumber</a> based integration testing. I&#8217;ve found that I need both.</p>

<p>Cucumber tests try to exercise the whole software stack &#8211; views, controllers, models and even the database. The use of natural language makes it easier to translate user stories into the appropriate tests, though it still needs some discipline to ensure that the edge cases are covered: I don&#8217;t think clients could write these as acceptance tests.</p>

<p>Involving the whole stack makes tests a little brittle, how specific is too specific? I&#8217;ve managed to break tests by removing fullstops (periods) from the rendered HTML!</p>

<p>I think that this is where unit and functional testing with RSpec at the model level is indispensable. I test model associations, validations and custom business logic in that order, I draw the limit at all the ActiveRecord <abbr title="Create Read Update Delete">CRUD</abbr> functionality.</p>

<p>I&#8217;ve found that the development environment hasn&#8217;t really changed in the move, the same basic toolkit does PHP and Ruby.</p>

<p>I regularly use several code version control systems including Subversion, Git and Mercurial. Recently though I&#8217;ve increasingly turned to Git and GitHub. Like most good tools the more you use it the more attached you become, so I&#8217;ll have to force myself to use the equally fine Mercurial again soon. I love these distributed tools.</p>

<p>TextMate is my editor of choice for Rails development. I&#8217;ve tried to use Netbeans <abbr title="Integrated Development Environment">IDE</abbr>, I use this for Java, but it seems like overkill. TextMate is quicker, simpler and provides the tools I need via the a range of bundles.</p>

<p>I have to admit that the code syntax highlighting is the most useful feature because I like using the command line too much, but I&#8217;m increasingly using code completion and I&#8217;m going to try the <a href="http://code.google.com/p/zen-coding/">Zen coding</a> bundles for HTML and CSS, I don&#8217;t like the default tools much.</p>

<p>That&#8217;s a round up of my current practice, more about the resulting software once I&#8217;ve decided to move on to a public beta.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/evolving-style-after-six-months-on-rails.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How does behaviour drive development?</title>
		<link>http://www.conceptric.co.uk/how-does-behaviour-drive-development.htm</link>
		<comments>http://www.conceptric.co.uk/how-does-behaviour-drive-development.htm#comments</comments>
		<pubDate>Thu, 12 Nov 2009 13:25:23 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[processes]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=310</guid>
		<description><![CDATA[Behaviour Driven Development (BDD) is an adaptation of earlier Test Driven practices (TDD) that's growing on me, but it's raised an interesting problem: the order in which to describe desired behaviour so that it actually drives development.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve only recently started dabbling in <abbr title="Behaviour Driven Development">BDD</abbr> using <a href="http://railscasts.com/episodes/155-beginning-with-cucumber">Cucumber and RSpec in Rails</a> applications. It feels quite different to the <abbr title="Test Driven Development">TDD</abbr> practices I&#8217;ve adopted before in Java, PHP or Ruby.</p>

<p>It feels like I&#8217;m starting from the top of the software stack and working down from broad specifications, creating code as I go, rather than up from fine grained models based on specific unit tests. Is this a reductionist approach?</p>

<p>When writing my features and scenarios I&#8217;ve noticed a tendency to follow the <abbr title="Create Read Update Delete">CRUD</abbr> acronym common in data access layers: Create Read Update and Delete. The order of these processes is significant and my reasoning goes something like this&#8230;&#8230;</p>

<p>I can&#8217;t really expect to read the contents of an entity before I&#8217;ve generated the code to create it. Now I&#8217;ve created it, I&#8217;m not going to try to edit this same entity unless I can actually read it. I can read what I&#8217;ve got, but I might want to edit those contents, and delete comes last&#8230;&#8230; because it just does, I guess the order of &#8220;UD&#8221; is negotiable, but this way it&#8217;s easier to pronounce.</p>

<p>You get the general picture, but this is just the approach I&#8217;ve adopted through trial and lots of error. It&#8217;s far from perfect, so how do you use behaviour to lead the code?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/how-does-behaviour-drive-development.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching to Rails</title>
		<link>http://www.conceptric.co.uk/switching-to-rails.htm</link>
		<comments>http://www.conceptric.co.uk/switching-to-rails.htm#comments</comments>
		<pubDate>Sun, 30 Aug 2009 18:30:00 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Personal Perspectives]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=302</guid>
		<description><![CDATA[I know that a good developer should choose the best tool for the job in hand, but their own productivity and inspiration must inform the decision in selecting the best tool.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a personal project based on CodeIgniter and it&#8217;s been uphill work. I finally lost patience with both the framework and language and followed the advice given on <a href="http://www.conceptric.co.uk/codeigniter-test-coverage.htm">my last post about code testing</a>.</p>

<p>I&#8217;ve used Ruby for scripting, and deploying PHP applications with custom Capistrano recipes for years now, but I&#8217;ve never tried any of the available web frameworks.</p>

<p>This week I switched to Ruby on Rails, and I&#8217;ve accomplished more in a couple of days than in a couple of months with CodeIgniter.</p>

<p>I&#8217;m not trying to claim that there&#8217;s anything fundamentally wrong with PHP, so don&#8217;t beat me up over it, but I find working with Ruby and Java much more intuitive, enjoyable and productive: it&#8217;s a personal choice, I feel more inspired.</p>

<p>I&#8217;m particularly loving the default support for <a href="http://guides.rubyonrails.org/testing.html">unit, functional and integration testing</a>; I now feel in control of my code and I&#8217;ve yet to explore the full range of testing frameworks and approaches available for Rails.</p>

<p>I know that <a href="http://cakephp.org/">CakePHP</a> mirrors Rails functionality very closely, but I&#8217;m afraid it&#8217;s the PHP language that I find too ugly to love &#8211; personal choice again, don&#8217;t shoot &#8211; consequently this is one developer who may have written his last line of PHP code&#8230;&#8230; maybe.</p>

<p>I&#8217;m now hoping to have the first release of the nature and wildlife recording application I&#8217;ve been promising Clare for&#8230;&#8230; much too long, up and running in the next couple of weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/switching-to-rails.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Testing applications for the Web</title>
		<link>http://www.conceptric.co.uk/testing-applications-for-the-web.htm</link>
		<comments>http://www.conceptric.co.uk/testing-applications-for-the-web.htm#comments</comments>
		<pubDate>Fri, 24 Apr 2009 17:22:21 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=173</guid>
		<description><![CDATA[I'm a fan of Test-Driven Development because I enjoy the freedom that a comprehensive test suite provides: without it I tend to feel that I'm walking through a minefield.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent more time on web development using PHP frameworks recently, and I&#8217;m realising just how difficult it is to provide the sufficient code coverage, avoiding that feeling that I&#8217;m about to step on a mine.</p>

<p>My experiences got me thinking about what I needed to code confidently. As a minimum, I need to know that everything works before committing code to version control, but security comes with regular testing, and this is no use unless everything is covered.</p>

<p>Based on web development frameworks using the nearly ubiquitous <abbr title="Model View Controller">MVC</abbr> design pattern, the logic and side effects at each <a href="http://www.webopedia.com/quick_ref/app.arch.asp">application tier</a> must be tested, and I came up with this list.</p>

<ol>
<li>The Database tier schema, whether <abbr title="Relational Database Management System">RDBMS</abbr>, <abbr title="eXtensible Markup Language">XML</abbr> or anything else.</li>
<li>Data Access logic is usually implemented in models, but often uses built-in features of the framework, such as ActiveRecord.</li>
<li>Business logic is encapsulated in the models, libraries, and sometimes controllers.</li>
<li>Presentation logic at the server comprising controllers and their respective views.</li>
<li>Presentation and business logic at the client tier implemented by <abbr title="Document Object Model">DOM</abbr> scripting, mostly in JavaScript.</li>
<li>The actual data presentation at the client tier based on XHTML and CSS.</li>
</ol>

<p>I&#8217;ve tried to order it from inside the application, working out from the data tier to the client, and it&#8217;s quite a list; I&#8217;d be interested to hear what I&#8217;ve missed.</p>

<p>Since this is a huge topic, I hope to write a series of posts isolating specific areas as I encounter them, and comparing tools and approaches. The first will look at how a few development frameworks in popular languages appear to measure up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/testing-applications-for-the-web.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter test coverage</title>
		<link>http://www.conceptric.co.uk/codeigniter-test-coverage.htm</link>
		<comments>http://www.conceptric.co.uk/codeigniter-test-coverage.htm#comments</comments>
		<pubDate>Fri, 17 Apr 2009 11:27:49 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[simpletest]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=167</guid>
		<description><![CDATA[I'm still not happy with the code coverage I can get even with SimpleTest fully integrated with CodeIgniter.]]></description>
			<content:encoded><![CDATA[<p>I like to use libraries; they move the business logic outside of the CodeIgniter <abbr title="Model View Controller">MVC</abbr> framework, where they and their associated test suites can be made independent. Since libraries can be reused in many CodeIgniter projects this maintains their portability, yet it&#8217;s simple to integrate them into the whole application test suite, where they can be run from the browser using a custom controller.</p>

<p>Unfortunately, testing anything other than libraries and models is difficult because there&#8217;s no way to access the another important type of object: controllers. CodeIgniter positively encourages using controllers to implement business logic, consequently not being able to test them is a serious anomaly.</p>

<p>Integrating a front-end testing framework, such as <a href="http://seleniumhq.org/">Selenium</a>, might be the solution, but does that properly test the controller code? I don&#8217;t think it does; the target there is the presentation tier at the browser.</p>

<p>The lack of good <a href="http://en.wikipedia.org/wiki/Code_coverage">code coverage</a> bothers me a lot, but I continue to struggle on with CodeIgniter because I&#8217;ve found other PHP frameworks to be just as lacking. Is this a general problem with frameworks? I&#8217;m tempted to try <a href="http://rubyonrails.org/">Ruby on Rails</a> next to find out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/codeigniter-test-coverage.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programming from a different angle</title>
		<link>http://www.conceptric.co.uk/programming-from-a-different-angle.htm</link>
		<comments>http://www.conceptric.co.uk/programming-from-a-different-angle.htm#comments</comments>
		<pubDate>Fri, 15 Feb 2008 21:25:52 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[simpletest]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.jameswhinfrey.co.uk/programming-from-a-different-angle.htm</guid>
		<description><![CDATA[I don&#8217;t feel I&#8217;ve got the programming experience I&#8217;d like for my future plans. So, I&#8217;ve got one of those personal project &#8212; the type that you never seem to get round to &#8212; in mind to provide me with a good workout. Which programming platform to use for the server-side application? Whilst I have [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t feel I&#8217;ve got the programming experience I&#8217;d like for my future plans. So, I&#8217;ve got one of those personal project &#8212; the type that you never seem to get round to &#8212; in mind to provide me with a good workout.</p>

<p>Which programming platform to use for the server-side application? Whilst I have to admit that I&#8217;m not the greatest fan of PHP, it&#8217;s definitely the best option. Why? Because I need to run this application locally on a minimal server and PHP is available wherever you find Apache, and the skills should have some commercial value.</p>

<p>I&#8217;ve recently read a great deal about agile development, <abbr title="Test Driven Development">TDD</abbr> and employing software design patterns. As part of this project I&#8217;d like to apply some of what I&#8217;ve learned.</p>

<h3>A test framework.</h3>

<p>Now I&#8217;m going to need a testing framework, and I&#8217;ve gone for <a href="http://simpletest.org/">SimpleTest</a>. This framework not only provides unit testing, but the ability to create tests for web pages. I prefer to run my test suites from the command line, which is relatively easy to arrange with the TextReporter object. I&#8217;ve combined the whole thing with <a href="http://ant.apache.org/">Apache Ant</a> to automate most of the tasks in the project, including deployment.</p>

<p>Unfortunately, it appears that SimpleTest doesn&#8217;t play particularly well with PHP5, although they&#8217;re in the process of making the transition.</p>

<p>I&#8217;ve encountered the mass of error messages generated as the result of <code>E_STRICT</code>. This is easily solved by using a customised php.ini file as an option at the command prompt when executing the test code. Once this is done you can see the actual test messages!</p>

<p>A more significant problem is that the Mock object code cannot be called as static class methods in the way the documentation suggests. A little snooping through the code leads me to think that it&#8217;s due to PHP4 without the <code>static</code> keyword in the method headers required by PHP5. I don&#8217;t have a work-round for this, and I don&#8217;t want to have to alter all this code. I hope they address this as the transition to PHP5 continues, but at the moment my code is simple enough for me to write my own mocks.</p>

<p>When all is said and done, if you know how to use any of the xUnit test frameworks, SimpleTest is very easy to set-up and use.</p>

<h3>Driving with tests.</h3>

<p>Simple the tests may be, but using them to steer the direction of your coding effort takes a different mindset. The hardest part is learning which questions to ask when developing your tests. Asking the right questions about functionality will result in clean, precise code.</p>

<p>There&#8217;s always a temptation add just a little more functionality, but resist it. The point is to remain in control of the code at all times. When it&#8217;s not working, it must be because you&#8217;ve added new tests describing new functionality. The code should never contain functionality that hasn&#8217;t been demanded by a test. Good refactoring can produce beautiful code without breaking the tests &#8212; still in control.</p>

<p>I think I&#8217;m getting the hang of it in relatively simple cases, but there&#8217;s much more to learn. I&#8217;ve found it a very liberating way to develop software, whilst remaining in total control &#8212; you are using version control?</p>

<h3>Patterns in the code</h3>

<p>Whilst there are loads of <abbr title="Model&#8212;View&#8212;Controller">MVC</abbr> based frameworks out there, I want to know how it works first hand. This topic is worth an article of it&#8217;s own, and that&#8217;s what I&#8217;ll give it.</p>

<p>There&#8217;s a good chance that the core application model will need to implement a facade pattern, but lets not make any assumptions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/programming-from-a-different-angle.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

