<?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>Xebia Blog &#187; Testing</title>
	<atom:link href="http://blog.xebia.com/category/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:30:00 +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>QA&amp;TEST 2011 Conference Impression</title>
		<link>http://blog.xebia.com/2011/11/02/qatest-2011-conference-impression/</link>
		<comments>http://blog.xebia.com/2011/11/02/qatest-2011-conference-impression/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 20:40:31 +0000</pubDate>
		<dc:creator>Cirilo Wortel</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Quality Assurance]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[conference]]></category>

	<!-- AutoMeta Start -->
	<category>accessibility</category>
	<category>pixels</category>
	<category>accessibility</category>
	<category>pixels</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=7985</guid>
		<description><![CDATA[Last week I joined the QA&#38;TEST conference in the beautiful town of Bilbao. In this post I’ll give an impression of some of the presentations I attended to and the idea’s I picked up. Most valuable sessions I attended were “Pushing the Boundaries of User Experience” by Julien Harty and “Automated Reliability Testing via hardware [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I joined the <a href="http://qatest.org">QA&amp;TEST</a> conference in the beautiful town of <a title="Bilbao" href="http://www.flickr.com/photos/iamroot/sets/72157628030705674/">Bilbao</a>. In this post I’ll give an impression of some of the presentations I attended to and the idea’s I picked up. Most valuable sessions I attended were “Pushing the Boundaries of User Experience” by Julien Harty and “Automated Reliability Testing via hardware interfaces” by Bryan Bakker. Read about it in more detail in the article.<img title="More..." src="http://blog.xebia.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
<p><span id="more-7985"></span>I was so fortunate to be invited to present at the 10th edition of the <a href="http://qatest.org">QA&amp;TEST</a>. The conference focuses on QA and testing for embedded systems, an area I know little about. Though, when I first started testing in the late nineties, I was so lucky to work with a gentleman that had lost his job at Fokker (the airplane manufacturer had just gone bankrupt). At Fokker he used to test instruments used in the airplanes, like altitude meters, speedometers and other fine machinery. He knew very little about computers and was struggling with was to me basic stuff (being a rookie myself), but he was also one of the most structural and detail critical people I ever worked with. Besides loads of test techniques and responsibility for my work, what I learned from that experience is that testing is testing and the same rules apply in most fields. So after contemplating the above I happily accepted the invitation. What I experienced during the conference is that testing embedded systems is about software testing and lucky for me, in this field Agile methodologies and test automation can be applied just the same.</p>
<p><strong>Automated Reliability Testing via hardware interfaces</strong> by <strong>Bryan Bakker</strong></p>
<p>How test automation can successful be applied was highlighted by fellow speaker Bryan Bakker who did a great presentation of a case study on how his team. The team was requested to improve the reliability of a system and call it in an act of rebellion kept on increasing test automation rather than adding new functionality. This resulted in (if I remember the correct figures) a savior of over 1.2 million euro’s on damage that bugs would have otherwise caused in production. The result was so spectacular that they were granted extra budget to continue with their work, but also to apply the approach in other projects. Interesting takeaway from his presentation, that seems a bit more specific for embedded systems but might apply in other area’s as well, was a smart test-scheduler they had introduced. The product under test was a medical x-ray device that under circumstances would get an overheated engine, it took hours for it to cool down again which made it impossible to continue the test run. Whenever this was detected they would automatically switch to other types of tests, that were less dependent on the engine and could run until the engine had cooled down again. A simple but effective time-saver coming from a pragmatic mind.</p>
<p><strong>Continuous Quality Improvement using Root Cause Analysis</strong> by <strong>Ben Linders</strong></p>
<p>A session I unfortunately did not actually attend to, but that I had an interesting discussion about with the presenter, was the conference closing presentation by Ben Linders called “Continuous Quality Improvement using Root Cause Analysis”. He claims that a team can accurately predict the number of bugs it is going to make during a sprint and he has developed a method to help reduce this number using root cause analysis. I found this a fascinating and somewhat controversial idea, I have yet to meet a developer (specially the ones in Agile projects) that can admit let alone predict they’re making bugs. But as I understood it works in a similar way as predicting velocity, you get more accurate as you go, using historic data from previous sprints.</p>
<p><strong>Runaway Test Automation Projects</strong> by <strong>Michael Stahl</strong></p>
<p>The presentation of Michael Stahl titled “Runaway Test Automation Projects” seemed less relevant to Agile environments (at least the once I worked in), he however pointed out lots of valid risks that exist when doing test automation. Main take away for the audience in my opinion was the point that test automation should be treated as “regular” software, creating unit tests, applying quality standards and using version control. Things that in my experience sound like common sense, but never the less very true.</p>
<p><strong>Pushing the Boundaries of User Experience</strong> by <strong>Julien Harty</strong></p>
<p>The presentation that was probably of the most added value to me was called “Pushing the Boundaries of User Experience”, by Ebay’s Julien Harty. He had an enlightening story on automated user experience testing. With crawlers like <a href="http://crawljax.com/">Crawljax</a> analysis of the dynamic (Ajax) behavior of a website can be done. With static analysis accessibility issues can be found, stuff that can be very important if you want to comply to <a href="http://nl.wikipedia.org/wiki/Web_Content_Accessibility_Guidelines">WCAG</a> guidelines, which hardly ever gets proper attention. Accessibility is often seen as something to facilitate a minority, but from a development point of view it helps to improve testability of the product What makes accessibility testing feasible from a business perspective is that it actually helps to improve search engine optimization, which increases the visibility of the site in search engines.<br />
He explained how at Ebay they run automated tests for improving usability and accessibility, but also for finding layout issues and browser dependencies in a cost effective way.<br />
Layout bugs can be found in an extremely simple but effective way using <a href="http://code.google.com/p/fighting-layout-bugs/">FightingLayoutBugs</a>. Let me describe this in a little more detail.<br />
How does this work? First you need to know which pixels belong to text, second you need to know which pixels belong to a horizontal or vertical edge, now if text pixels and edge pixels overlap you have a layout bug. Sounds pretty simple and it actually is!<br />
How is text detected? All text of a page is set to a white font color and a snapshot is taken. All the text on a page is set to black and a snapshot is taken. Now when the two are compared, all different pixels are probably text.<br />
How are horizontal and vertical lines detected? First set all the text on the page to transparent (btw setting the text color is done using jQuery), so now there are only graphics, take a screenshot. Now it’s identified which sequences of pixels have a certain minimal length and the same or very similar color, only those that have a high contrast to the left or to the right are selected. The same approach applies for horizontal lines. Now compare the outcome with the identified text. When text and lines overlap there’s a layout bug (which happens to be automatically reported).</p>
<div>
<dl id="attachment_7978">
<dt><a href="http://blog.xebia.com/wp-content/uploads/2011/11/bla.jpg"><img title="Ebay's test setup" src="http://blog.xebia.com/wp-content/uploads/2011/11/bla-300x188.jpg" alt="Ebay's test setup" width="300" height="188" /></a></dt>
<dd>Ebay&#8217;s test setup</dd>
</dl>
</div>
<p>During a life demo Julian ran some of these tools against the <a href="http://qatest.org">conference</a> website. With <a href="http://code.google.com/p/web-accessibility-testing/">web-accessibility-testing</a> pointed out how bad the accessibility was for people that rely on tabbing to navigate through the screen. Static analysis of the site pointed out the page contained url’s with duplicate or no alt texts. Stuff that seems of minor severity but for disabled people essential. He concluded by revealing a security issue that caused some hilarity. He gave away the most lucrative reduction code for registration. It turned out all reduction codes for the conference were hardcoded in the Javascript in the page source.</p>
<p>All together it has been a valuable learning experience, beside the fact that a visit to Bilbao alone is definitely worth the trip!</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/11/02/qatest-2011-conference-impression/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F11%2F02%2Fqatest-2011-conference-impression%2F&amp;title=QA%26%23038%3BTEST%202011%20Conference%20Impression" id="wpa2a_2"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/11/02/qatest-2011-conference-impression/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Continuous deployment with Atlassian Bamboo and XebiaLabs Deployit</title>
		<link>http://blog.xebia.com/2011/10/20/continuous-deployment-with-atlassian-bamboo-and-xebialabs-deployit/</link>
		<comments>http://blog.xebia.com/2011/10/20/continuous-deployment-with-atlassian-bamboo-and-xebialabs-deployit/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 08:48:42 +0000</pubDate>
		<dc:creator>Vincent Partington</dc:creator>
				<category><![CDATA[Build tools]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Xebia Labs]]></category>

	<!-- AutoMeta Start -->
	<category>bamboo</category>
	<category>atlassian</category>
	<category>continuous</category>
	<category>incompatibility</category>
	<category>push</category>
	<category>xebialabs</category>
	<category>deployit</category>
	<category>scale</category>
	<category>bamboo</category>
	<category>atlassian</category>
	<category>continuous</category>
	<category>incompatibility</category>
	<category>push</category>
	<category>xebialabs</category>
	<category>deployit</category>
	<category>scale</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=7935</guid>
		<description><![CDATA[Over the past five to ten years, continuous integration has become a no-brainer for every medium to large scale software development project. It&#8217;s hard to imagine going back to not having every commit (or push) automatically trigger a build of the code and, most importantly, a test run of of the code. That test run [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.xebialabs.com/wp-content/uploads/2011/10/LOGO_Bamboo_Transparent_Half_Size.png" alt="" title="LOGO_Bamboo_Transparent_Half_Size" width="332" height="98" align="right" /><br />
Over the past five to ten years, <a href="http://martinfowler.com/articles/continuousIntegration.html">continuous integration</a> has become a no-brainer for every medium to large scale software development project. It&#8217;s hard to imagine going back to <em>not</em> having every commit (or <a href="http://gitref.org/remotes/#push">push</a>) automatically trigger a build of the code and, most importantly, a test run of of the code. That test run will surely include <a href="http://www.extremeprogramming.org/rules/unittests.html">unit tests</a>, but setting it up to also run <a href="http://c2.com/cgi/wiki?IntegrationTest">integration tests</a> used to be harder. You&#8217;ll need to automatically deploy the application to the target middleware environment and then run the integration tests against that environment.</p>
<p>The Deployit plugin for the new 3.3 release of <a href="http://www.atlassian.com/software/bamboo/">Atlassian Bamboo</a> adds the enterprise-scale deployment capabilities of <a href="http://www.xebialabs.com/">XebiaLabs Deployit</a> to Bamboo. This allows you to speed up your development process by adding automated deployment to your continuous integration setup and make the the first step towards <a href="http://timothyfitz.wordpress.com/2009/02/08/continuous-deployment/">continuous deployment</a> and <a href="http://continuousdelivery.com/">continuous delivery</a>. Instead of deployment being a bottleneck to your development process, it will be be an integrated part of it. You can test your application on the target platform as soon as possible, find any platform incompatibility and deployment issues early on, and, when it&#8217;s time to deploy to the production environment, your deployment will be quick and reliable.</p>
<p> <a href="http://blog.xebialabs.com/2011/10/20/continuous-deployment-with-atlassian-bamboo-and-xebialabs-deployit/#more-5882" class="more-link">read more</a></p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/10/20/continuous-deployment-with-atlassian-bamboo-and-xebialabs-deployit/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F10%2F20%2Fcontinuous-deployment-with-atlassian-bamboo-and-xebialabs-deployit%2F&amp;title=Continuous%20deployment%20with%20Atlassian%20Bamboo%20and%20XebiaLabs%20Deployit" id="wpa2a_4"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/10/20/continuous-deployment-with-atlassian-bamboo-and-xebialabs-deployit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple server mock for REST services</title>
		<link>http://blog.xebia.com/2011/08/10/simple-server-mock-for-rest-services/</link>
		<comments>http://blog.xebia.com/2011/08/10/simple-server-mock-for-rest-services/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 09:48:00 +0000</pubDate>
		<dc:creator>Michaël van Leeuwen</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mock]]></category>
		<category><![CDATA[play framework]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[soapui]]></category>

	<!-- AutoMeta Start -->
	<category>photocontroller</category>
	<category>9000</category>
	<category>jsonobject</category>
	<category>photo</category>
	<category>restmockserver</category>
	<category>gson</category>
	<category>rendertext</category>
	<category>localhost</category>
	<category>photocontroller</category>
	<category>9000</category>
	<category>jsonobject</category>
	<category>photo</category>
	<category>restmockserver</category>
	<category>gson</category>
	<category>rendertext</category>
	<category>localhost</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/2011/08/simple-server-mock-for-rest-services/</guid>
		<description><![CDATA[When working on a mobile Android application, I was confronted with the fact that the backend server wasn’t available yet to deliver the REST service. But I needed a server or good dummy for testing the Android client against the REST services. So I began my search for a REST mock server. I started out [...]]]></description>
			<content:encoded><![CDATA[<p>When working on a mobile Android application, I was confronted with the fact that the backend server wasn’t available yet to deliver the REST service. But I needed a server or good dummy for testing the Android client against the REST services. So I began my search for a REST mock server.</p>
<p>I started out using the SoapUI REST functionality, but that still lacks a good implementation for my purpose of reacting on REST calls. I ended up with a 10-minute build-your-own REST mock using the Play framework. This blogs describes how this was accomplished.</p>
<p><span id="more-7260"></span></p>
<p>The Play framework crossed my path earlier. It is a very simple yet powerful application framework for web applications. It is almost trivial to set it up for mocking REST services. First make sure you <a href="http://www.playframework.org/">download</a> and unpack the framework. Then execute the following commands to create a new project: </p>
<pre>    play new RestMockServer
    play eclipsify RestMockServer
    play run RestMockServer</pre>
<p>The project is running and now ready to be worked on in eclipse (see ‘play help’ for other IDEs). Changes in code and configuration will be picked up by the framework automatically. Just point your browser to <a href="http://localhost:9000/">http://localhost:9000/</a> to see the application running.</p>
<p>The next step is to add the REST URLs to the routing table. Let us say I ‘m creating a system for storing photos containing meta data and the image URL. Open the file ‘conf/routes’ and add the following lines before the ‘Catch all’ entry:</p>
<pre>    PUT    /photo            PhotoController.create
    POST   /photo            PhotoController.update
    GET    /photo/{id}       PhotoController.read
    DELETE /photo/{id}       PhotoController.delete</pre>
<p>This defines the CRUD actions on a photo object. First in line is the http method on which the framework should react. The second part is the URL with optional parameters which will be mapped onto the method indicated in the first part.</p>
<p>The following action is to define a controller handling the calls. The implementation uses a very simple response technique based on text. The mapping of the id to the actual response is left to the reader to implement. You could for example read a file based on the URL parameter and return the content of it. For now, we just return the identifier specified in the URL.</p>
<p>Save the file below as ‘PhotoController.java’ and call <a href="http://localhost:9000/photo/123">http://localhost:9000/photo/123</a> and see your favorite number showing on screen. Note that the name between curly braces should match the name of the parameter. The mapping on type will be done auto-magically by the framework.</p>
<pre class="brush: java; title: controllers/PhotoController.java; notranslate">
package controllers;
import java.util.Random;
import com.google.gson.JsonObject;
import play.mvc.Controller;

public class PhotoController extends Controller {
    public static void read(int id) {
        try {
            response.contentType = &amp;quot;application/json&amp;quot;;
            renderText(id);
        } catch (Exception e) {
            notFound(e.getMessage());
        }
    }
}
</pre>
<p>The next step is to implement the other methods. Since I’m using JSON as data format, I have to add a specific binder for the JsonObject type, used both by the create and update method. The ‘ok’ just returns a 200 status code. Upon creation of an object I need the identifier of the newly stored data object, so for test purposes I return a random integer.</p>
<p>Add the following method implementations to PhotoController.java:</p>
<pre class="brush: java; title: snippet; notranslate">
    public static void delete(int id) {
        ok();
    }

    public static void update(JsonObject body) {
        ok();
    }

    public static void create(JsonObject body) {
        response.contentType = &amp;quot;application/json&amp;quot;;
        renderText(&amp;quot;\&amp;quot;id\&amp;quot;:&amp;quot;+Math.abs(new Random().nextInt()));
    }
</pre>
<p>The binder is also automatically found by the framework. I’ve created a new package ‘util’ in which I placed the following class:</p>
<pre class="brush: java; title: util/GsonBinder.java; notranslate">
package util;
import java.lang.annotation.*;
import java.lang.reflect.Type;
import com.google.gson.*;
import play.data.binding.*;

@Global
public class GsonBinder implements TypeBinder&lt;jsonobject&gt; {
    @Override
    public Object bind(String name, Annotation[] a, String value, Class c, Type t) throws Exception
    {
        return new JsonParser().parse(value);
    }
}
</pre>
<p>And that is basically all to set up your mock server for REST services using the Play framework! From your favorite REST client, call the URL: <a href="http://localhost:9000/photo">http://localhost:9000/photo</a> with a PUT request and set the entity of the request to some JSON content.</p>
<p>Happy development!</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/08/10/simple-server-mock-for-rest-services/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F08%2F10%2Fsimple-server-mock-for-rest-services%2F&amp;title=Simple%20server%20mock%20for%20REST%20services" id="wpa2a_6"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/08/10/simple-server-mock-for-rest-services/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Robotium: black-box testing for Android apps</title>
		<link>http://blog.xebia.com/2011/07/06/robotium-black-box-testing-for-android-apps/</link>
		<comments>http://blog.xebia.com/2011/07/06/robotium-black-box-testing-for-android-apps/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 15:00:02 +0000</pubDate>
		<dc:creator>Arno den Hond</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Testing]]></category>

	<!-- AutoMeta Start -->
	<category>solo</category>
	<category>robotium</category>
	<category>addapp</category>
	<category>addapp</category>
	<category>android</category>
	<category>getview</category>
	<category>solos</category>
	<category>edittext</category>
	<category>solo</category>
	<category>robotium</category>
	<category>addapp</category>
	<category>addapp</category>
	<category>android</category>
	<category>getview</category>
	<category>solos</category>
	<category>edittext</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=7053</guid>
		<description><![CDATA[As pointed out in an earlier post the importance of testing can not be understated. In this post we will delve into BDD of Android apps. There are a number of other testing tools for Android out there, such as Robolectric and Calculon. Robolectric improves the speed of running the test by executing it outside [...]]]></description>
			<content:encoded><![CDATA[<p>As pointed out in an <a title="Why TDD+ Continuous testing is imperative for mobile apps (part 1 of n)" href="http://blog.xebia.com/2011/03/why-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n/">earlier post</a> the importance of testing can not be understated.<br />
In this post we will delve into <a title="Behaviour Driven Development" href="http://en.wikipedia.org/wiki/Behavior_Driven_Development" target="_blank">BDD</a> of Android apps.<br />
There are a number of other testing tools for Android out there, such as <a href="http://pivotal.github.com/robolectric/" target="_blank">Robolectric</a> and <a href="https://github.com/kaeppler/calculon" target="_blank">Calculon</a>. Robolectric improves the speed of running the test by executing it outside of the emulator. Calculon is a DSL for testing views and activities. As Robotium seems to most mature and reliable, it is my preference.</p>
<p style="text-align: center;"><a href="http://blog.xebia.com/wp-content/uploads/2011/07/logo.png"><img class="alignnone size-full wp-image-7054" title="Robotium" src="http://blog.xebia.com/wp-content/uploads/2011/07/logo.png" alt="" width="51" height="55" /></a> <a title="robotium" href="http://Robotium.org" target="_blank">Robotium.org</a></p>
<p style="text-align: center;"><span id="more-7053"></span></p>
<p style="text-align: left;"><strong>What is Robotium &amp; what does it do?</strong></p>
<blockquote><p>Robotium is a test framework created to make it easy to write powerful and robust automatic black-box test cases for Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.</p></blockquote>
<p>In essence, a Robotium test is a subclass of junit.framework.TestCase (an ActivityInstrumentationTestCase2, in this &#8220;case&#8221;) in which, by use of the Robotium library, a Solo object is created which allows easy access to the views in your activities.<br />
Through the solo object, you can set values in input fields, click on buttons and get results from other UI components. Methods of JUnits Assert class can then be used to check those results.</p>
<p><strong>How to set up Robotium?</strong></p>
<p>After creating an Android Test project in the usual way (I will assume you have done that before), you need to add the robotium JAR to the Libraries on the projects Build Path.</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/07/RobotiumBuildPath.png"><img class="size-medium wp-image-7061 aligncenter" title="Robotium Build Path Eclipse" src="http://blog.xebia.com/wp-content/uploads/2011/07/RobotiumBuildPath-300x194.png" alt="" width="300" height="194" /></a><strong></strong></p>
<p><strong>How to use Robotium?</strong></p>
<p>In the setUp method of your testing class, you can create a Solo object and specify the Activity to be started.<br />
The Solo object can then be used in your testXXX methods to get and set values in/from UI components and click buttons and such.<br />
Many of Solos methods to access UI components take an int representing the index of the component in the UI. This can lead to brittle code so using getView (and the id defined in the layout xml) is a much safer alternative.<br />
Do keep in mind that changing values and performing clicks is not allowed from outside of the thread that originally created the views, these things must still be done through Solos methods such as setXXX, EnterText and clickOnXXX.</p>
<p>The values to be asserted can then be retrieved through Solos methods isXXX, getCurrentXXX, searchText and others.<br />
Solos finalize method should be called from the tests tearDown method.</p>
<p>An example:</p>
<pre class="brush: java; title: ; notranslate">
package xebia.addapptesting;

import xebia.addapp.AddApp;
import xebia.addapp.R;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.EditText;

import com.jayway.android.robotium.solo.Solo;

public class AddTest extends ActivityInstrumentationTestCase2&lt;AddApp&gt; {

    private Solo solo;

    public AddTest() {
        super(&quot;xebia.addapp&quot;, AddApp.class);
    }

    @Override
    protected void setUp() throws Exception {
        solo = new Solo(getInstrumentation(), getActivity());
    }

    public void testAdd() {
        int one = 1;
        int other = 2;

        solo.enterText((EditText) solo.getView(R.id.one), Integer.toString(one));
        solo.enterText((EditText) solo.getView(R.id.other), Integer.toString(other));
        solo.clickOnView(solo.getView(R.id.calcbutton));

        assertTrue(solo.searchText(Integer.toString(one + other)));
    }

    @Override
    public void tearDown() throws Exception {
        try {
            solo.finalize();
        } catch (Throwable e) {
            e.printStackTrace();
        }
        getActivity().finish();
        super.tearDown();
    }
}
</pre>
<p>When running the test case on the emulator or an actual device, you will see the values being entered into the UI components or see them being clicked as if you were doing it yourself. After the tests are completed, the JUnit view in Eclipse will show which tests have failed and passed.</p>
<p><a title="Robotium Test Run" href="http://www.youtube.com/watch?v=rz_Z_wmMGe8" target="_blank"><img class="size-medium wp-image-7080 aligncenter" title="Robotium Test Run" src="http://blog.xebia.com/wp-content/uploads/2011/07/videopreview-300x182.png" alt="" width="300" height="182" /></a><strong></strong></p>
<p><strong>Conclusion</strong></p>
<p>I think it looks pretty cool to see the app being run and the values being entered. This kind black-box behavior testing on the emulator is much more realistic than just a unit test.</p>
<p>Stay tuned for my next post on a surprise topic, soon!</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/07/06/robotium-black-box-testing-for-android-apps/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F07%2F06%2Frobotium-black-box-testing-for-android-apps%2F&amp;title=Robotium%3A%20black-box%20testing%20for%20Android%20apps" id="wpa2a_8"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/07/06/robotium-black-box-testing-for-android-apps/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Writing and testing data structures and algorithms in JavaScript</title>
		<link>http://blog.xebia.com/2011/06/23/writing-and-testing-data-structures-and-algorithms-in-javascript/</link>
		<comments>http://blog.xebia.com/2011/06/23/writing-and-testing-data-structures-and-algorithms-in-javascript/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 17:07:07 +0000</pubDate>
		<dc:creator>Maarten Winkels</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[js_cols]]></category>
		<category><![CDATA[YUI]]></category>

	<!-- AutoMeta Start -->
	<category>tagcounter</category>
	<category>tagcounts</category>
	<category>js_cols</category>
	<category>assertsame</category>
	<category>areequal</category>
	<category>linkedhashmap</category>
	<category>tags</category>
	<category>javascript</category>
	<category>tagcounter</category>
	<category>tagcounts</category>
	<category>js_cols</category>
	<category>assertsame</category>
	<category>areequal</category>
	<category>linkedhashmap</category>
	<category>tags</category>
	<category>javascript</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=6969</guid>
		<description><![CDATA[Tonight in one of our knowledge exchange sessions, one of my colleagues challenged us to writing a TagCloud in JavaScript. He had prepared a nice setup with a server producing twitter hashtags over a WebSocket to the browser and using Processing.js to produce a graphical representation of the tags zooming by on twitter. Since he [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight in one of our knowledge exchange sessions, one of my colleagues challenged us to writing a TagCloud in JavaScript. He had prepared a nice setup with a server producing twitter hashtags over a WebSocket to the browser and using Processing.js to produce a graphical representation of the tags zooming by on twitter. Since he had already done all the heavy lifting in integrating all these fancy new frameworks, what was left to do, you might ask. Well, we still needed to implement the algorithm to count the number of tags on the continuous stream, sorting this list on the bases of the counts and making sure the system wouldn&#8217;t run out of memory by removing less used tags in some smart way. His point to all of this was, that although JavaScript is being prophesized in some circles as the new-old-new language of the future, writing and testing a non-trivial algorithm in it is a big challenge.<br />
<span id="more-6969"></span><br />
In the remainder of the hour, we tried in several pairs to implement the missing algorithm and it has to be said that we all failed miserably. It has to be said that none of us were JavaScript experts, but I (for one) felt (in the beginning&#8230;) that I should have enough experience in IT in general and a little in JavaScript to make this work. But alas&#8230;</p>
<p>Driving back home, I decided not to give in so easily and to try and use some decent frameworks to overcome this challenge.</p>
<h3>JavaScript testing: <a href="http://developer.yahoo.com/yui/3/">YUI</a></h3>
<p>I turned to finding a testing framework first. Sure enough, most javascript testing frameworks focus on fancy UI stuff like asynchronous testing, integration testing or automated multi-browser testing. I was looking for none of that, but a simple xUnit like framework, that I could run in a browser to test the functionality of a number of JavaScript classes. After a few minutes I found <a href="http://developer.yahoo.com/yui/3/">YUI</a> which seemed to fit the bill. Setting up was easy enough:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;title&gt;Testing TagCounter with YUI&lt;/title&gt;
&lt;/head&gt;
  &lt;body class=&quot;yui-skin-sam&quot;&gt;
    &lt;div id=&quot;yui-main&quot;&gt;&lt;div id=&quot;testReport&quot;&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js_cols/base.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;TagCounter.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;TagCounter_Test.js&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
 &lt;/html&gt;
</pre>
<p>This static html file is all that is neede to run my tests. The tests themselves are written in the TagCounter_Test.js file:</p>
<pre class="brush: jscript; title: ; notranslate">
/**
 * Unit Tests for TagCounter
 */
YUI({
  combine: true,
  timeout: 10000
}).use(&quot;node&quot;, &quot;console&quot;, &quot;test&quot;, function (Y) {
  var assert = Y.Assert;

  var TagCounterTestCase = new Y.Test.Case({
    // test case name - if not provided, one is generated
    name: &quot;TagCounter Tests&quot;,

    &quot;test should increment count&quot;: function () {
      var tc = new TagCounter();
      tc.add(&quot;my-tag&quot;);
      assert.areEqual(1, tc.map().get(&quot;my-tag&quot;));
      tc.add(&quot;my-tag&quot;);
      assert.areEqual(2, tc.map().get(&quot;my-tag&quot;));
    }
  });

  //create the console
  var r = new Y.Console({
    newestOnTop : false,
    style: 'block'
  });

  r.render(&quot;#testReport&quot;);
  Y.Test.Runner.add(TagCounterTestCase);
  Y.Test.Runner.run();
});</pre>
<p>Opening the HTML file in FireFox shows the picture below.<br />
<img src="http://blog.xebia.com/wp-content/uploads/2011/06/Screen-shot-2011-06-22-at-2.46.10-AM.png" alt="" title="Screen shot 2011-06-22 at 2.46.10 AM" width="396" height="537" class="alignright size-full wp-image-6974" /><br />
It seems like I&#8217;m ready to implement the TagCounter TDD style!</p>
<h3>Implementation: <a href="http://code.google.com/p/jscols/">js_cols</a></h3>
<p>To make this simple test pass, all I need is a simple HashMap with some basic features, like contains, get and remove, but&#8230; this is not java! After some googling, I found <a href="http://code.google.com/p/jscols/">js_cols</a>, a neat JavaScript collections framework, that basically had all the support that I wanted, including a <a href="http://download.oracle.com/javase/1,5.0/docs/api/java/util/LinkedHashMap.html">LinkedHashMap</a> implementation that can be used to implement a <a href="http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used">LRU cache</a>, just like good old java! The LRU feature is going to help me to remove &#8220;old&#8221; tags, keeping the memory required to process the tags within reasonable limits.</p>
<p>To make the first test succeed, only a few lines of code are needed:</p>
<pre class="brush: jscript; title: ; notranslate">
js_cols.require('js_cols.LinkedHashMap');
function TagCounter(maxSize) {
	this.tagCounts = new js_cols.LinkedHashMap(maxSize, true);
};
TagCounter.prototype.add = function (tag) {
	if (this.tagCounts.contains(tag)) {
		this.tagCounts.insert(tag, this.tagCounts.get(tag) + 1);
	} else {
		this.tagCounts.insert(tag,1);
	}
};
TagCounter.prototype.map = function () {
	return this.tagCounts;
};
</pre>
<p>In the end, however, we want the map method to return only the most popular tags, while our counter should keep track of a longer list. To implement this, we need two steps:</p>
<ol>
<li>First we need to sort the tags by their number of appearances in descending order, keeping in mind that multiple tags can have the same number.</li>
<li>Then we need to take the top x most popular tags.</li>
</ol>
<p>The test:</p>
<pre class="brush: jscript; title: ; notranslate">
...
    &quot;test should return limited sized map&quot;: function () {
    	var tc = new TagCounter(3);
    	tc.add(&quot;my-old-tag&quot;);
    	tc.add(&quot;my-old-tag&quot;);
    	tc.add(&quot;my-old-tag&quot;);
    	assertSame(tc.map(2), [[&quot;my-old-tag&quot;, 3]]);
    	tc.add(&quot;my-first-tag&quot;);
    	tc.add(&quot;my-first-tag&quot;);
    	assertSame(tc.map(2), [[&quot;my-old-tag&quot;, 3], [&quot;my-first-tag&quot;, 2]]);
    	tc.add(&quot;my-second-tag&quot;);
    	assertSame(tc.map(2), [[&quot;my-old-tag&quot;, 3], [&quot;my-first-tag&quot;, 2]]);
    	tc.add(&quot;my-third-tag&quot;);
    	assertSame(tc.map(2), [[&quot;my-first-tag&quot;, 2], [&quot;my-third-tag&quot;, 1]]);
    }
  });

  function assertSame(map, expected) {
	  var keys = map.getKeys();
	  assert.areEqual(expected.length, keys.length);
	  for(var i=0,len=expected.length; value=expected[i], i&lt;len; i++) {
		  assert.areEqual(value[0], keys[i]);
		  assert.areEqual(value[1], map.get(value[0]));
	  }
  };
...
</pre>
<p>In the test we now add a method assertSame to make it easier to express our expectations of the map method: The map should contain the expected number of tags with their counts in the right order. Therefor the expectation is a list of [tag, count]-tuples.</p>
<p>We can again use the collection library classes to implement this: The RedBlackMultiMap class implements a key-sorted map that allows multiple values for the same key. </p>
<pre class="brush: jscript; title: ; notranslate">
TagCounter.prototype.map = function (opt_size) {
	var orderedMap = new js_cols.RedBlackMultiMap(function (a,b) {return b-a;});
	this.tagCounts.forEach(orderedMap.insert, orderedMap);
	var result = new js_cols.LinkedHashMap();
	if (opt_size) {
		var i = 0;
		orderedMap.forEach(function (value, key) {
			if (i &lt; opt_size) {
				result.insert(value, key);
			}
			i++;
		});
	} else {
		orderedMap.forEach(result.insert, result);
	}
	return result;
};
</pre>
<p>On line 2 the RedBlackMultiMap constructor is used with a comparator function that will invert the natural ordering of numbers. This way we sort in descending order.<br />
On line 3 all items of the tagCount map are inserted into the orderedMap reversing the key-value relation. The fact that the forEach method take a function that has the value as the first and the key as the second argument (which would usually be confusing) now appears a handy feature!<br />
On lines 4 to 7, the key-value relation is again reversed, making sure to only take the top opt_size items from the map (when set).</p>
<h3>Conclusion</h3>
<p>Looking at the simplicity of the code and the tests, I would say that it is definitely possible to write well tested and documented JavaScript algorithms and data structures. I completely agree with my colleague, however, that such code is not often found in your run-of-the-mill web application project. Maybe it is time to start treating the JavaScript code in our projects more as Java code and make sure that it is properly structured and tested.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/06/23/writing-and-testing-data-structures-and-algorithms-in-javascript/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F06%2F23%2Fwriting-and-testing-data-structures-and-algorithms-in-javascript%2F&amp;title=Writing%20and%20testing%20data%20structures%20and%20algorithms%20in%20JavaScript" id="wpa2a_10"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/06/23/writing-and-testing-data-structures-and-algorithms-in-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What happened to the Open Source performance monitoring and analysis tools</title>
		<link>http://blog.xebia.com/2011/06/22/what-happened-to-the-open-source-performance-monitoring-and-analysis-tools/</link>
		<comments>http://blog.xebia.com/2011/06/22/what-happened-to-the-open-source-performance-monitoring-and-analysis-tools/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 19:33:59 +0000</pubDate>
		<dc:creator>Mark Bakker</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Middleware]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Uncategorized]]></category>

	<!-- AutoMeta Start -->
	<category>glassbox</category>
	<category>infrared</category>
	<category>tavant</category>
	<category>appdynamics</category>
	<category>jxinsight</category>
	<category>binil</category>
	<category>6rc1</category>
	<category>glassbox</category>
	<category>infrared</category>
	<category>tavant</category>
	<category>appdynamics</category>
	<category>jxinsight</category>
	<category>binil</category>
	<category>6rc1</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=6988</guid>
		<description><![CDATA[In my current position as Performance Engineer and in my past position as a Middleware Architect I did quite some work with closed source performance monitoring and analysis tools (i.g. CA Wily and later AppDynamics). These tools are both expensive but also do quite a good job most of the times. In the same field [...]]]></description>
			<content:encoded><![CDATA[<p>In my current position as Performance Engineer and in my past position as a Middleware Architect I did quite some work with closed source performance monitoring and analysis tools (i.g. CA Wily and later AppDynamics).<br />
These tools are both expensive but also do quite a good job most of the times. In the same field there are more tools, but all in the same price range for as far as I know.<br />
To name some: Foglight, Dynatrace, Newrelic, JXInsight, Tivoli Performance Viewer, Compuware Gomez.</p>
<p>Around 2006 several initiatives to create open source performance monitoring tools for java production environments started to appear.</p>
<p>This was mainly because AOP (Aspect Oriented Programming), the technology used in most of these products, was getting attention in the market and there were quite some developments in that area at the time.</p>
<p>I am interested to see how the open source community around these kind of products is evolving. The outcome is quite surprising…</p>
<p><span id="more-6988"></span></p>
<p>The main reason I am interested in tools in this area is to be able to pinpoint problems in an Acceptance or Production environments very quickly, because this saves (big) enterprises a lot of money.</p>
<p>The main reason I am interested in <em>open source</em> tools is to see if we are able to create a complete open source java hosting stack which is enterprise production ready.</p>
<p>Without adding a lot of extra license and/or support costs we don’t have to consolidate IT anymore. We will be able to do application hosting for each specific business unit separately and focus on the continuous improvement for that business unit alone. Without big boundaries between the business unit and IT. This kind of boundaries are most times created because of cost efficiency. Think about consolidation and architecture guidelines. Not having to think about licencing costs will help us in helping enterprises to become agile.</p>
<p>During a knowledge exchange session (XKE) at Xebia we first created a requirements list to select tools in the same area to be able to compare them.</p>
<p>The requirements so far:</p>
<ol>
<li>The tool should measure production and acceptance environments with low (&lt;= 5%) resource usage overhead.</li>
<li>The tool should be able to pinpoint (potential) problems in the running applications as quickly as possible.</li>
<li>The problems that should be detected: high resource consumption of particular code blocks, memory leaks and the location of the leak, blocking code blocks which block other threads, slow calls to back ends (i.e. web services, databases).</li>
<li>The environments the tools should run in are the following application servers: IBM Websphere, Oracle Weblogic, JBoss, Tomcat, Glassfish.</li>
<li>The problems should be made visible in such a way that the root cause can be found as quickly as possible. The most valuable will be to see complete business transaction flows over all JVM’s, with real-time flow states and measurement readings.</li>
<li>The tool should be easy to install, i.g. just use a simple agent that connects it to a server. The goal should be to leave the code base unchanged.</li>
</ol>
<p>Before the session I did some homework and I searched the internet for these kind of monitoring tools. During our knowledge exchange session we had a brainstorm session and came to the following list of Open Source tools:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="49" valign="top"><em>Type</em></td>
<td width="165" valign="top"><em>Name</em></td>
<td width="112" valign="top"><em>Active development</em></td>
<td width="105" valign="top"><em>Possible usability?</em></td>
<td width="98" valign="top"><em>Costs</em></td>
<td width="88" valign="top"><em>Commercial support possible?</em></td>
</tr>
<tr>
<td width="49" valign="top">OS</td>
<td width="165" valign="top">Glassbox</td>
<td width="112" valign="top">No (last in nov. 2008)</td>
<td width="105" valign="top">Yes</td>
<td width="98" valign="top">-</td>
<td width="88" valign="top">Maybe</td>
</tr>
<tr>
<td width="49" valign="top">OS</td>
<td width="165" valign="top">Infrared</td>
<td width="112" valign="top">No (last in jan. 2010, between 2006 – 2010 none)</td>
<td width="105" valign="top">Yes</td>
<td width="98" valign="top">-</td>
<td width="88" valign="top">Maybe</td>
</tr>
<tr>
<td width="49" valign="top">OS</td>
<td width="165" valign="top">Profiler4j</td>
<td width="112" valign="top">No (last in 2006)</td>
<td width="105" valign="top">No, more are profiler</td>
<td width="98" valign="top">-</td>
<td width="88" valign="top">No</td>
</tr>
<tr>
<td width="49" valign="top">OS</td>
<td width="165" valign="top">JAMon/ JARep</td>
<td width="112" valign="top">No (last in 2010)</td>
<td width="105" valign="top">No, no runtime aspects, code has to change</td>
<td width="98" valign="top">-</td>
<td width="88" valign="top">No</td>
</tr>
<tr>
<td width="49" valign="top">OS</td>
<td width="165" valign="top">VisualVM + BTrace</td>
<td width="112" valign="top">Yes</td>
<td width="105" valign="top">No, does only run in JDK6 and higher, no complete visual integration.</td>
<td width="98" valign="top"></td>
<td width="88" valign="top">Yes</td>
</tr>
<tr>
<td width="49" valign="top">Closed SourceFree in dev. env.</td>
<td width="165" valign="top">OpenCore</td>
<td width="112" valign="top">Yes</td>
<td width="105" valign="top">Yes, but is not open source, only low cost in development environment.</td>
<td width="98" valign="top">None for development environment, commercial for production environment, see JXInsight.</td>
<td width="88" valign="top">No</td>
</tr>
</tbody>
</table>
<p>This list is as complete as we were able to come up with, if you know more and eventual better open source tools please let us know!</p>
<p>After evaluating all products on the lists (just a paper evaluation) we only see Glassbox and Infrared as a real Open Source solution in this area. But both (at least Glassbox) are not actively developed anymore. Of course because both products are open source it will be possible to restart development on one of the products.</p>
<p>It is interesting why both projects are not active anymore. I spent some time to find out why. This is what I found out:</p>
<p>What happened to Glassbox; the first developer mentioned is the VP of Engineering at Glassbox David Pickering. He has left the Glassbox company in 2009. And is now VP of Engineering at iWin, a company with a different focus. The second one mentioned is Ron Bodkin, he left Glassbox in 2007 and was the founder of the Glassbox company, he became VP of Engineering at Quantcast, so also his focus has moved. This looks like the main reason there is no active development on Glassbox anymore.</p>
<p>What happened to Infrared; the first developer mentioned on the project member list at SourceForge is Binil Thomas, he worked for Tavant Technologies at the time Infrared was created. Other members on the same list also worked for Tavant in that time. Most are now working for different companies. It looks that Tavant Technologies was no longer interested in this space. The last 2.6RC1 release from Infrared was created in 2010, at a time Binil was working for Ronin Capital. Since 2011 he is working for AppDynamics, this is a commercial vendor in this area and looks like the main reason the 2.6RC1 release never came to a full release, but this is something I am guessing of course.</p>
<p><strong>What’s next</strong></p>
<p>We will test both Infrared and Glassbox to see if one of them is still a good choice. We will start with Infrared because this one has been the most active project in the past and it has been maintained the longest, until 2010. After this we will see if one of these products can be a competitor for the commercial products in this area.</p>
<p>Many thanks to my colleagues Adriaan Thomes and Sander Hautvast for helping me with the brainstorm session.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/06/22/what-happened-to-the-open-source-performance-monitoring-and-analysis-tools/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F06%2F22%2Fwhat-happened-to-the-open-source-performance-monitoring-and-analysis-tools%2F&amp;title=What%20happened%20to%20the%20Open%20Source%20performance%20monitoring%20and%20analysis%20tools" id="wpa2a_12"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/06/22/what-happened-to-the-open-source-performance-monitoring-and-analysis-tools/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Get your webtests in FitNesse with Xebium</title>
		<link>http://blog.xebia.com/2011/06/01/get-your-webtests-in-fitnesse-with-xebium/</link>
		<comments>http://blog.xebia.com/2011/06/01/get-your-webtests-in-fitnesse-with-xebium/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 05:37:09 +0000</pubDate>
		<dc:creator>Arjan Molenaar</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Xebium]]></category>
		<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile Testing]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Webtesting]]></category>

	<!-- AutoMeta Start -->
	<category>xebium</category>
	<category>selenium</category>
	<category>fitnesse</category>
	<category>fixture</category>
	<category>verifytext</category>
	<category>login</category>
	<category>password</category>
	<category>john</category>
	<category>xebium</category>
	<category>selenium</category>
	<category>fitnesse</category>
	<category>fixture</category>
	<category>verifytext</category>
	<category>login</category>
	<category>password</category>
	<category>john</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=6904</guid>
		<description><![CDATA[In the first installment on Xebium, Cirilo explained the ideas behind this FitNesse fixture: Xebium creates a simple way to use Selenium IDE (low learning curve) and FitNesse (ease of maintenance) to it&#8217;s fullest when it comes to maintaining a web application test suites. Xebium is using the same keywords as Selenium IDE. This has [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="/2011/05/introduction-to-xebium/">first installment on Xebium</a>, Cirilo explained the ideas behind this <a href="http://fitnesse.org">FitNesse</a> fixture:</p>
<blockquote><p><i><br />
<a href="http://xebia.github.com/Xebium">Xebium</a> creates a simple way to use Selenium IDE (low learning curve) and FitNesse (ease of maintenance) to it&#8217;s fullest when it comes to maintaining a web application test suites.<br />
</i></p></blockquote>
<p>Xebium is using the same keywords as Selenium IDE. This has the huge advantage that no person should learn another DSL. Since tests are stated this way, they can be copied between Selenium IDE and FitNesse without a hassle (the FitNesse formatter for Selenium IDE is rather trivial). And to be honest: as long as there are XPath and Regular Expressions in the code, it makes no sense to come up with a substitute for <quote>verifyText</quote>.</p>
<p><span id="more-6904"></span></p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2011/05/ide-to-fitnesse.png" alt="Copy test output directly in SeIDE" /></p>
<p>So now it is possible to move our Selenium IDE test case in a FitNesse page. Nice. It&#8217;s easier to set up tests, since FitNesse is quite flexible in that. On the other hand, just playing back you recorded tests is not the most flexible way to work. There can be a huge maintenance burden on this.  It would be a shame not to use the full power of FitNesse in this case. <a href="http://fitnesse.org/FitNesse.UserGuide.SliM.ScenarioTable">Scenario tables</a> for example can make a nice abstraction where some common action, like logging in, only have to be defined (and maintained) in one place. By moving the login code out of the test and into a scenario, we add another level of indirection. The tests themselves become more readable, as they only state the business requirement and the low level details are directly editable by the tester. This is a lot more flexible than creating Selenium fixtures for every scenario.</p>
<blockquote><pre>| log in user | <i>user</i> | with password | <i>password</i> |
| open | http://example.com/login |
| type | name-field | <i>@user</i> |
| type | password-field | <i>@password</i> |
| click | login |
</pre>
</blockquote>
<p>and in your tests, instead of repeating the above, just mention:</p>
<blockquote><pre>| script |
| log in user | <i>john</i> | with password | <i>secret</i> |
| ensure | do | verifyText | on | #userid | with | John |</pre>
</blockquote>
<p>Sure, we&#8217;re back at creating our own DSL, but we do it 100% in FitNesse. Selenium commands can be added where needed (e.g. assertions). No Java (fixture) code, no developers required to change one line because the templates have changed and, foremost, detailed feedback.</p>
<p>But FitNesse can help out even more. Consider data driven testing. Selenium has (by default) no option for that. Using the same scenario table fixture it&#8217;s easy to test logins for a bunch of users.</p>
<p>But we claimed you can copy stuff from FitNesse to Selenium IDE as well and that&#8217;s getting harder when you move everything inro scenarios. To overcome this issue the formatter in Selenium IDE can parse tab separated data as well. So after a test has run, the output as provided by FitNesse can be copied back. This is a useful aid for analyzing failed tests.</p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2011/05/fitnesse-to-ide.png" alt="Copy tests from SeIDE to FitNesse" /></p>
<p>I tend to make my Xebium commands easely available. First of all the fixture needs to be imported. After that the fixture can be assigned as library:</p>
<blockquote><pre>| import |
| com.xebia.incubator.xebium |

| library |
| selenium driver fixture |</pre>
</blockquote>
<p>A note for Windows users, though. When performing a lot of tests, Windows tends to run out of sockets. There is a way to <a href="http://twit88.com/blog/2008/07/28/jmeter-exception-javanetbindexception-address-already-in-use-connect/">configure your machine</a> to work around those silly limitations (at your own risk!).</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/06/01/get-your-webtests-in-fitnesse-with-xebium/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F06%2F01%2Fget-your-webtests-in-fitnesse-with-xebium%2F&amp;title=Get%20your%20webtests%20in%20FitNesse%20with%20Xebium" id="wpa2a_14"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/06/01/get-your-webtests-in-fitnesse-with-xebium/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introduction to Xebium</title>
		<link>http://blog.xebia.com/2011/05/04/introduction-to-xebium/</link>
		<comments>http://blog.xebia.com/2011/05/04/introduction-to-xebium/#comments</comments>
		<pubDate>Wed, 04 May 2011 15:28:42 +0000</pubDate>
		<dc:creator>Cirilo Wortel</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Xebium]]></category>
		<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile Testing]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Webtesting]]></category>

	<!-- AutoMeta Start -->
	<category>xebium</category>
	<category>selenium</category>
	<category>selenesse</category>
	<category>fitnium</category>
	<category>fitnesse</category>
	<category>substitution</category>
	<category>dsl’s</category>
	<category>playback</category>
	<category>xebium</category>
	<category>selenium</category>
	<category>selenesse</category>
	<category>fitnium</category>
	<category>fitnesse</category>
	<category>substitution</category>
	<category>dsl’s</category>
	<category>playback</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=6806</guid>
		<description><![CDATA[Introduction When testing web interfaces, it’s convenient to use an intuitive tool like Selenium IDE, it’s easy to use and can be used by non-technical people, but it is solely meant for record and playback of test-scripts. One of its limitations is that it misses sufficient options for documenting and managing tests. Furthermore it misses [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>When testing web interfaces, it’s convenient to use an intuitive tool like <a title="Selenium IDE" href="http://seleniumhq.org/projects/ide/">Selenium IDE</a>,  it’s easy to use and can be used by non-technical people, but it is  solely meant for record and playback of test-scripts. One of its  limitations is that it misses sufficient options for documenting and  managing tests. Furthermore it misses an interface with the backend of  the system under test (SUT), to setup preconditions for a test or for  instance to manipulate or read from a database.<br />
<a title="FitNesse" href="http://fitnesse.org/">Fitnesse</a> is a great tool to do just that, it has the Wiki to manage tests and it  by default has a setup and teardown mechanism, it’s easy to add non  invasive testfixtures to interface directly with your SUT. The downside  is that it is incapable of doing webtests.</p>
<p>We now have the glue that combines the two, it&#8217;s called <a title="Xebium" href="http://xebia.github.com/Xebium/">Xebium</a>!</p>
<p><span id="more-6806"></span></p>
<p><img title="More..." src="http://blog.xebia.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" />On  several projects I’ve tried to find a way to combine the two, because  both tools are free of use and both have their individual charm, but it  seems combined they would master practically any situation. As a tester I  miss the development skills to come up with a satisfying solution and I  never convinced my team members to help me out in a satisfactory  manner.</p>
<p>At our company we recently started <a title="app-incubator" href="http://app-incubator.xebia.com/">app-incubator</a>,  a new form of knowledge exchange, in the form of mini projects, anyone  can pitch a project idea and when enough colleagues sponsor the project,  we can spend up to three days collaborating on it.  My pitch caught  fire and with about five people we brainstormed on the solution. For me a  prerequisite was that it should be possible to use the test scripts two  directional, so record them with Selenium IDE, run and edit them in  Fitnesse and playback from Selenium IDE again. During this first project  session we came up with additional requirements, it should support  data-driven testing and variable substitution. We wanted to keep it as  simple as possible, no new DSL’s should be introduced and it should not  require conversions between the two products. We explored some existing  solutions such as <a title="Fitnium" href="http://sourceforge.net/projects/fitnium/">Fitnium</a> and <a title="Selenesse" href="https://github.com/cdombroski/selenesse">Selenesse</a> but came to the conclusion these (at the time) were fully based on their own DSL’s and did not support exchanging  files between Selenium IDE and Fitnesse. So we decided to created  something far more simple.</p>
<p><strong>The Result</strong></p>
<p>After several attempts we discovered that Webdriver (Selenium 2.0) would  be the best engine for running our tests. It seems more future proof,  turned out to be a lot more stable than Selenium Testrunner and its  commands are more compatible with Selenium IDE than Selenium RC.<br />
We introduced a Selenium IDE formatter which output can be directly  copied into the Wiki. We created a Fitnesse fixture that is capable of  running the pre-formatted scripts without additional interpretations of  the Selenium commands.</p>
<p>The additional features we had in mind, the data-driven testing and  variable substitution turned out to be standard Fitnesse features. What  we did not realize when we started was that Fitnesse would introduce a  mechanism which, in my opinion, added mind-blowing power to project:  Scenario tables, which now enables us to create abstractions on top of  our testscripts.</p>
<p><strong>Conclusion</strong><a title="Xebium" href="http://xebia.github.com/Xebium/"></a></p>
<p><a title="Xebium" href="http://xebia.github.com/Xebium/">Xebium</a> enables us to use both Selenium IDE (low learning curve) and  FitNesse (ease of maintenance) to it&#8217;s fullest and provides a complete  solution when it comes to automated web testing.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/05/04/introduction-to-xebium/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F05%2F04%2Fintroduction-to-xebium%2F&amp;title=Introduction%20to%20Xebium" id="wpa2a_16"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/05/04/introduction-to-xebium/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iOS + XCode 4 + GHUnit = Mobile TDD+Continuous testing part 2 of n</title>
		<link>http://blog.xebia.com/2011/03/23/ios-xcode-4-ghunit-mobile-tddcontinuous-testing-part-2-of-n/</link>
		<comments>http://blog.xebia.com/2011/03/23/ios-xcode-4-ghunit-mobile-tddcontinuous-testing-part-2-of-n/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 10:51:07 +0000</pubDate>
		<dc:creator>Robert van Loghem</dc:creator>
				<category><![CDATA[ios]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>

	<!-- AutoMeta Start -->
	<category>ghunit</category>
	<category>xcode</category>
	<category>ghunitios</category>
	<category>simulator</category>
	<category>iphone</category>
	<category>ocunit</category>
	<category>gabriel</category>
	<category>nsstring</category>
	<category>ghunit</category>
	<category>xcode</category>
	<category>ghunitios</category>
	<category>simulator</category>
	<category>iphone</category>
	<category>ocunit</category>
	<category>gabriel</category>
	<category>nsstring</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=6482</guid>
		<description><![CDATA[Last time I explained why I think doing TDD for mobile is imperative, and why I do it. But now it&#8217;s time to get technical, and explain to you how to set up, GHUnit in XCode 4 and run unit tests, not only in the iPhone and iPad simulator but also on your own physical [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.xebia.com/2011/03/09/why-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n/">Last time</a> I explained why I think doing TDD for mobile is imperative, and why I do it. But now it&#8217;s time to get technical, and explain to you how to set up, <a href="http://gabriel.github.com/gh-unit/">GHUnit</a> in XCode 4 and run unit tests, not only in the iPhone and iPad simulator but also on your own physical device!, it&#8217;s in text and images but also in <a href='http://www.youtube.com/watch?v=zk2PXso_WHQ'>video form on YouTube</a>.</p>
<p><a href="http://www.youtube.com/watch?v=zk2PXso_WHQ"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/youtubeScreenshot-300x183.png" alt="" title="Video on how to setup GHUnit in XCode 4 on YouTube" width="300" height="183" class="aligncenter size-medium wp-image-6533" /></a></p>
<p><em>Note, if you want to know why i chose GHUnit over OCUnit, just scroll down to the end of the post.</em></p>
<p><span id="more-6482"></span></p>
<p><strong>But wait….</strong></p>
<p>Before I begin, I want to make one thing very clear, the difference between <em>code</em> unit testing and <em>UI</em> testing. Unfortunately, UI development can be hard to do in a TDD fashion. Especially when you want to test UI components. e.g. When I send a TouchEvent will the View respond and trigger my method in my controller.<br />
My advice; don&#8217;t do UI testing with a Unit testing framework (OCUnit, JUnit, GHUnit), do it with for example the <a href="http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40004652">iOS automation API</a>, which has been created specifically to test those UI components. I&#8217;ll also get back to you in a later post on how to do UI testing on Android.</p>
<p>What do you test with Unit testing frameworks? Well you test just the code, nothing more. Model and Controller code, not the View! You might need the help of a mocking framework to make it testable, because the view is missing and needs to be wired up for the controller and model to work properly, or it might need other controllers etc..</p>
<p><strong>Let&#8217;s begin setting up!</strong></p>
<p>With that in mind, let&#8217;s set up our own iPhone XCode 4 project! add GHunit, create a test and run it in the simulator or your own iOS device, iPhone, iPod Touch or iPad.</p>
<p><em>1.</em> First of all download the GHUnitIOS version (0.4.28 at this time) at <a href="https://github.com/gabriel/gh-unit/archives/master">https://github.com/gabriel/gh-unit/archives/master</a><br />
<em>2.</em> Unpack the downloaded zip file somewhere in your home directory, you should get the GHUnitIOS.framework directory</p>
<blockquote><p>NOTE; I first placed it in /Developer/Library/Frameworks but XCode 4 didn&#8217;t like it and when compiling it could not find the header files, therefore I placed them somewhere in my home directory (e.g. /Users/rvanloghem/Development/Frameworks/GHUnitIOS.framework)</p></blockquote>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/ghunitFrameworkDir.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/ghunitFrameworkDir-150x150.png" alt="" title="Place where my GHUnitIOS.framework dir is located" width="150" height="150" class="aligncenter size-thumbnail wp-image-6498" /></a></p>
<p><strong>Right, you are now ready to set up your GHUnit ready XCode 4 project.</strong></p>
<p><em>3.</em> For example purposes, I&#8217;m choosing a normal, navigation-based application but you might have an existing project.<br />
- NOTE; Don&#8217;t check the Include Unit Tests, because we are going to supply our own unit testing framework and not rely on OCUnit, which is supplied by default in XCode</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/selectNewProjectTemplate.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/selectNewProjectTemplate-150x150.png" alt="" title="Select XCode 4 project template" width="150" height="150" class="aligncenter size-thumbnail wp-image-6491" /></a></p>
<p><em>4.</em> In your XCode project settings (blue root icon in the tree browser) add a Target which you can call Tests, i usually base the project on a simple View-based Application (a Target named Tests will be added + a folder named Tests with all the Tests target files in them)</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/addTestsTarget.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/addTestsTarget-150x150.png" alt="" title="Click to add a new target named Tests" width="150" height="150" class="aligncenter size-thumbnail wp-image-6514" /></a></p>
<p><em>5.</em> Next go back to the Tests target (click on the Tests Target) and add the GHUnitIOS.framework which you downloaded and unpacked in step 1 and 2. (click on the Build Phases tab, open up the Link Binary with Libraries, hit the + button, click Add Other and navigate+select the GHUnitIOS.framework directory on your filesystem)<br />
<em>6.</em> Optional, but nice, move the GHUnitIOS.framework in your Tree to the Frameworks folder, to tidy things up</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/addFrameworkToTestsTarget.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/addFrameworkToTestsTarget-150x150.png" alt="" title="Adding the GHUnitIOS framework to the Tests target" width="150" height="150" class="aligncenter size-thumbnail wp-image-6516" /></a></p>
<p>7. Set the -ObjC and -all_load in the other linker flags on the Tests Target (Select the Tests Target, select the Build Settings, search for other linker flags, and add the 2 flags)</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/setOtherLinkerFlags.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/setOtherLinkerFlags-150x150.png" alt="" title="Setting -ObjC and -all_load on the other linker flags in the Tests target" width="150" height="150" class="aligncenter size-thumbnail wp-image-6518" /></a></p>
<p>8. Now you can delete some files which are not necessary, all the files in the Tests folder. (Note, Not! the Supporting Files folder as well, just the files!)<br />
9. Delete the main.m file in the Supporting Files folder</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/deleteTestsFiles.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/deleteTestsFiles-150x150.png" alt="" title="Delete unneeded files from your Tests target" width="150" height="150" class="aligncenter size-thumbnail wp-image-6520" /></a></p>
<p>10. In the Tests-Info.plist file (again, in the Supporting Files folder), clear out the Main nib file base name value</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/clearMainNibName.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/clearMainNibName-150x150.png" alt="" title="Clear value of man nib file base name in the ?-Info.plist file" width="150" height="150" class="aligncenter size-thumbnail wp-image-6519" /></a></p>
<p><strong>Time to create the GHUnit test runner, which will scan for our Unit Test Cases and run them.</strong></p>
<p>11. Create an Objective-C class in the Tests folder named GHUnitIOSTestMain and make sure it is only! added to the Tests target</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/createTestRunner.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/createTestRunner-150x150.png" alt="" title="Create the GHUnitTestRunner main which will run your test cases" width="150" height="150" class="aligncenter size-thumbnail wp-image-6521" /></a></p>
<p>12. You can delete the GHUnitIOSTestMain.h file<br />
13. Copy and paste source code from (http://github.com/gabriel/gh-unit/blob/master/Project-IPhone/GHUnitIOSTestMain.m) in your GHUnitIOSTestMain.m file</p>
<p><strong>And now it&#8217;s time to create our own test case which will fail <img src='http://blog.xebia.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </strong></p>
<p>14. Again create an Objective-C class in the Tests folder and as this is an example, name it ExampleTest, also make sure it is added to the Tests Target only!<br />
15. You can delete the ExampleTest.h file<br />
15. Copy and paste the next piece of code which is 99% copy/pasted from the example code from GHUnit (http://gabriel.github.com/gh-unit/_examples.html)</p>
<pre class="brush: cpp; title: ; notranslate">// For iOS
#import &lt;GHUnitIOS/GHUnit.h&gt;
// For Mac OS X
//#import &lt;GHUnit/GHUnit.h&gt;

@interface ExampleTest : GHTestCase { }
@end

@implementation ExampleTest

- (BOOL)shouldRunOnMainThread {
    // By default NO, but if you have a UI test or test dependent on running on the main thread return YES
    return NO;
}

- (void)setUpClass {
    // Run at start of all tests in the class
}

- (void)tearDownClass {
    // Run at end of all tests in the class
}

- (void)setUp {
    // Run before each test method
}

- (void)tearDown {
    // Run after each test method
}  

- (void)testFoo {
    NSString *a = @&quot;foo&quot;;
    GHTestLog(@&quot;I can log to the GHUnit test console: %@&quot;, a);

    // Assert a is not NULL, with no custom error description
    GHAssertNotNULL(a, nil);

    // Assert equal objects, add custom error description
    NSString *b = @&quot;bar&quot;;
    GHAssertEqualObjects(a, b, @&quot;A custom error message. a should be equal to: %@.&quot;, b);
}

- (void)testBar {
    GHAssertTrue(TRUE, @&quot;Yes it worked&quot;);
}

@end
</pre>
<p><strong>Right, ready to run!</strong></p>
<p>16. Launch your Tests target (iTunes-like play button arrow) and run it against the simulator-scheme and your Unit test app should start</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/readyToRunGHUnit.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/readyToRunGHUnit-150x150.png" alt="" title="Selecting the scheme to run your unit test case and hitting run in XCode 4" width="150" height="150" class="aligncenter size-thumbnail wp-image-6528" /></a></p>
<p>17. Now in the app in the simulator hit the blue run button and your tests will execute. (and testFoo will fail!, you can click on it to see why it failed)</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/runningTheTest.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/runningTheTest-150x150.png" alt="" title="Running the GHUnit test in the iOS iPhone simulator" width="150" height="150" class="aligncenter size-thumbnail wp-image-6529" /></a></p>
<p><strong>And now it&#8217;s time to fix it&#8230;</strong></p>
<p>18. Change the <code>NSString *b = @"bar";</code> in the testFoo method to <code>NSString *b = @"foo";</code><br />
19. Run the Test app again and re-run the test and they should be green or in this case black, which means your tests are ok</p>
<p><strong>Showing the power of GHUnit</strong></p>
<p>20. Run the app against your own iOS device-scheme. (Select iOS-device-scheme and click the iTunes like run button)</p>
<p><a href="http://blog.xebia.com/wp-content/uploads/2011/03/testsRunningActuallyOnThePhone.png"><img src="http://blog.xebia.com/wp-content/uploads/2011/03/testsRunningActuallyOnThePhone-150x150.png" alt="" title="GHUnit running on an actual iPhone 4" width="150" height="150" class="aligncenter size-thumbnail wp-image-6530" /></a></p>
<p><strong>Why i chose GHUnit over OCUnit</strong></p>
<p>IMHO, this shows the real power of the GHUnit testing framework, not only does it run in the simulator but it also runs on your own iPhone, iPad, etc. Whereas OCUnit can only run as part of your build on your own machine, not on your phone and not in the simulator, this for me, is a big dealbreaker.<br />
The closer you can get your unit tests running against a real-world environment the better it will be. Why? Because you are making use of the real devices processor (not the intel x86), real memory management, or lack there-of, the real API&#8217;s etc. If my Unit tests run on my phone, i&#8217;m 99.999% certain that the code under test will actually run on, yes, you guessed it, my phone.</p>
<p>There is of-course a downside to GHUnit, OCUnit (bundled with XCode) can be run automatically prior to you compiling your own app, this makes getting feedback about regression a lot faster, GHUnit is something which you have to run manually, in this case. But to solve that problem, or at least make it a whole lot better, we can use continuous integration aka build server to do the auto-running-of-unit-tests for us. There is a very <a href="http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-1/">nice blog post</a> which compares various iOS unit testing frameworks.</p>
<p>So what is next? Well, the topic for my next blog and video in this series is hooking up a XCode project + GHUnit to Jenkins (or Hudson for the Oracle minded people out there).</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/03/23/ios-xcode-4-ghunit-mobile-tddcontinuous-testing-part-2-of-n/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F03%2F23%2Fios-xcode-4-ghunit-mobile-tddcontinuous-testing-part-2-of-n%2F&amp;title=iOS%20%2B%20XCode%204%20%2B%20GHUnit%20%3D%20Mobile%20TDD%2BContinuous%20testing%20part%202%20of%20n" id="wpa2a_18"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/03/23/ios-xcode-4-ghunit-mobile-tddcontinuous-testing-part-2-of-n/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Why TDD+ Continuous testing is imperative for mobile apps (part 1 of n)</title>
		<link>http://blog.xebia.com/2011/03/09/why-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n/</link>
		<comments>http://blog.xebia.com/2011/03/09/why-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 11:06:04 +0000</pubDate>
		<dc:creator>Robert van Loghem</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Testing]]></category>

	<!-- AutoMeta Start -->
	<category>apps</category>
	<category>ipad</category>
	<category>mobile</category>
	<category>robust</category>
	<category>jenkins</category>
	<category>functionality</category>
	<category>android</category>
	<category>regression</category>
	<category>apps</category>
	<category>ipad</category>
	<category>mobile</category>
	<category>robust</category>
	<category>jenkins</category>
	<category>functionality</category>
	<category>android</category>
	<category>regression</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=6301</guid>
		<description><![CDATA[Since a couple of months I&#8217;ve been developing mobile applications, some are for the business at home (girlfriend-shopping-list app that actually works and augmented reality garden iPad app) and some are for work. I have experienced that TDD and Continuous testing (Test Driven Development) is a way of working that leads to fewer bugs and [...]]]></description>
			<content:encoded><![CDATA[<p>Since a couple of months I&#8217;ve been developing mobile applications, some are for the business at home (girlfriend-shopping-list app that actually works and augmented reality garden iPad app) and some are for work. I have experienced that TDD and Continuous testing (<em>Test Driven Development</em>) is a way of working that leads to fewer bugs and regression problems and better design in my software, it&#8217;s my preferred way of programming, not testing.</p>
<p><img src="http://blog.xebia.com/wp-content/uploads/2011/03/iPad-TDD-150x150.png" alt="Mobile TDD is imperitive" title="iPad TDD" width="150" height="150" class="alignright size-thumbnail wp-image-6302" /></p>
<p>And to start off, here&#8217;s how I benefit from doing TDD:</p>
<ol>
<li>Robust</li>
<li>Better code design, no really!</li>
<li>Find regression problems early on</li>
</ol>
<p>and you can read more on TDD and Continuous testing <a href="http://blog.objectmentor.com/articles/2007/09/20/continuous-testing-explained">here</a>.</p>
<p>The thing is, writing a mobile app takes about 20% of the time it would take me to write a web+client+server based app. Which of-course is really nice, because I can write lots of apps. It also means that whenever i need to fix a bug or add new functionality, I need to have developed it in a TDD fashion, otherwise i cannot guarantee reliability. So let me explain why…</p>
<p><span id="more-6301"></span></p>
<p><strong>Previous experience</strong></p>
<p>The last complex software piece I&#8217;ve worked on is a product called Deployit, which can deploy java applications to application servers, not just one, but many different type of servers and the deploy part is encapsulated in a piece called a plugin. For every plugin we have written lots and lots of tests and boy do they prove to be a lifesaver. </p>
<p>As a developer I&#8217;m not just working on a single plugin, I&#8217;m working on the entire product (partly, because we are a small team and i like to do so), that means that for a single week I&#8217;m adding new deployment logic to plugin A and next week fixing a bug in plugin B. I&#8217;m a good programmer with a good memory but working on so many plugins and quickly fixing problems or adding functionality is hard. I have to context switch between intricacies of plugin D and the complexity of plugin W, I am bound to make a mistake or two, which will delay the release or upset users because functionality that used to work is now broken.</p>
<p>So how does this compare with mobile apps? It&#8217;s simple, plugins, resemble for me, apps. In the mobile world, you are bound to work on multiple apps in a short amount of time, that means, you need help to keep those apps stable when you are working on them. </p>
<p><strong>Translation of TDD+Continuous testing to mobile development</strong></p>
<p>Did you ever update an app that you worked on 2 months ago and broke per accident some old functionality? Then you must have seen what happened with your user ratings, it went down, right? People expect functionality that have always worked to still keep working, otherwise you will get 1-star or worse, it gets deleted! New functionality can have some bugs, because it is new, existing functionality should just work, there is no excuse for it to not do so.</p>
<p>Unless your brain can keep track of what the code of every app that you might work on is doing, which I don&#8217;t think it can, if it would you would work at NASA on &#8220;Space Bus 3.0&#8243;. That is where your automated tests come in, they really help you, make a fix and guaranteeing that your old functionality does not break. </p>
<p>It also helps you make new functionality more robust, don&#8217;t just test the happy flow, also test the monkey flow, input some weird data, trigger some weird touch-events, see if you can make your app crash, and do this automated. Your app becomes much more robust and your users will love you for it.</p>
<p><strong>What is next&#8230;</strong></p>
<p>The above words are all fine, but how do we actually do this ? In the next couple of blog posts I will go into technical detail how to do;<br />
1. Unit testing (cheap testing at code level, <a href="http://developer.apple.com/tools/unittest.html">OCUnit</a>, <a href="http://developer.android.com/resources/tutorials/testing/helloandroid_test.html">JUnit</a>)<br />
2. Continuous Integration (using <a href="http://jenkins-ci.org/">Jenkins</a>)<br />
3. UI testing (not so cheap testing at the UI level, Automation API&#8217;s, mock framework)<br />
and do this for iOS and Android platforms.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2011/03/09/why-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2011%2F03%2F09%2Fwhy-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n%2F&amp;title=Why%20TDD%2B%20Continuous%20testing%20is%20imperative%20for%20mobile%20apps%20%28part%201%20of%20n%29" id="wpa2a_20"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2011/03/09/why-tddcontinous-testing-is-imperative-for-mobile-apps-part-1-of-n/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/category/testing/feed/ ) in 0.77722 seconds, on Feb 9th, 2012 at 4:41 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 5:41 pm UTC -->
