<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Freelance Developer</title>
	
	<link>http://brill.no</link>
	<description>Java and agile development</description>
	<pubDate>Wed, 26 Aug 2009 13:30:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AlexanderBrill" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="alexanderbrill" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Backpacking Brighton</title>
		<link>http://brill.no/backpacking-brighton/</link>
		<comments>http://brill.no/backpacking-brighton/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 10:18:17 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://brill.no/?p=118</guid>
		<description><![CDATA[I'm in Brighton at the moment, and therefore made a map of some of the nice galleries and places to see there.
View Backpacking Brighton in a larger map
]]></description>
			<content:encoded><![CDATA[<p>I'm in Brighton at the moment, and therefore made a map of some of the nice galleries and places to see there.<br />
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?hl=en&amp;ie=UTF8&amp;t=h&amp;msa=0&amp;msid=106435937118279658211.00046ee3ab41a18af022d&amp;ll=50.827138,-0.146084&amp;spn=0.018976,0.036478&amp;z=14&amp;output=embed"></iframe><br /><small>View <a href="http://maps.google.com/maps/ms?hl=en&amp;ie=UTF8&amp;t=h&amp;msa=0&amp;msid=106435937118279658211.00046ee3ab41a18af022d&amp;ll=50.827138,-0.146084&amp;spn=0.018976,0.036478&amp;z=14&amp;source=embed" style="color:#0000FF;text-align:left">Backpacking Brighton</a> in a larger map</small></p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/backpacking-brighton/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Greenhopper acquired by Atlassian</title>
		<link>http://brill.no/greenhopper-acquired-by-atlassian/</link>
		<comments>http://brill.no/greenhopper-acquired-by-atlassian/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 10:53:34 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://brill.no/?p=83</guid>
		<description><![CDATA[Greenhopper, an agile project management plugin for JIRA has been acquired by Atlassian.
This is a great plugin that creates broad agile capabilities to JIRA - which means that agile teams can use JIRA not only as a bug tracker, but also as a planning board for their sprints. It got some great reporting tools complete [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://atlassian.com/greenhopper"><img class="alignleft" title="Greenhopper screenshot" src="http://www.atlassian.com/greenhopper/images/screenshot_main.png" alt="" width="281" height="177" />Greenhopper</a>, an agile project management plugin for <a href="http://atlassian.com/jira">JIRA</a> has been acquired by <a href="http://atlassian.com">Atlassian</a>.</p>
<p>This is a great plugin that creates broad agile capabilities to JIRA - which means that agile teams can use JIRA not only as a bug tracker, but also as a planning board for their sprints. It got some great reporting tools complete with burndown charts.</p>
<p>We implemented Greenhopper for the teams at <a href="http://www.nhst.no">NHST Media Group</a>, and it really helped the execution of our agile processes</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/greenhopper-acquired-by-atlassian/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Aspects with Spring and Maven for getting rid of singletons</title>
		<link>http://brill.no/aspects-with-spring-and-maven-for-getting-rid-of-singletons/</link>
		<comments>http://brill.no/aspects-with-spring-and-maven-for-getting-rid-of-singletons/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 14:50:55 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://brill.no/?p=55</guid>
		<description><![CDATA[Get rid of the singleton pattern by using Aspect Oriented Programming and Spring to wire up your application.]]></description>
			<content:encoded><![CDATA[<p>We wanted to update some old hibernate DAOs we had laying around which were implemented using singletons.  Instead of using singletons we wanted to wire these up using the Spring context. This was seemed to be an easy refactoring task. However, diving into the code we came to realize that we had several taglibs developed (extending from SimpleTagSupport) that was using these DAOs. And since you can't have constructors for these tags to dependency inject our DAOs we had to look elsewhere.</p>
<p><span id="more-55"></span></p>
<p>Aspects to the rescue! By using the @Configurable annotation found in spring we could have spring set up our DAO services in our tags instead of using that singleton pattern.</p>
<pre>@Configurable
public class MyTag extends SimpleTagSupport {
    @Autowired
    private MySweetRepository repository;
...
}</pre>
<p>I now had to choose wether I wanted to have compile time weaving or load time weaving. I opted for compile time because I didn't want to change our production environment too much by introducing -javaagent. And having tried the javaagent path with Tomcat before, I wasn't jumping with enthusiasm of wrestling with that beast again.</p>
<p>Since we are using maven to compile our project I needed some dependencies for aspects:</p>
<pre>    &lt;dependency&gt;
        &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
        &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
        &lt;version&gt;1.6.2&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
    &lt;/dependency&gt;</pre>
<p>And then to set up the aspectj compiler for maven:</p>
<pre>        &lt;plugin&gt;
            &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
            &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.1&lt;/version&gt;
            &lt;configuration&gt;
                &lt;source&gt;1.5&lt;/source&gt;
                &lt;target&gt;1.5&lt;/target&gt;
                &lt;showWeaveInfo&gt;false&lt;/showWeaveInfo&gt;
                &lt;outxml&gt;true&lt;/outxml&gt;
                &lt;aspectLibraries&gt;
                  &lt;aspectLibrary&gt;
                    &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                    &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
                  &lt;/aspectLibrary&gt;
                &lt;/aspectLibraries&gt;
            &lt;/configuration&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;compile&lt;/goal&gt;
                        &lt;goal&gt;test-compile&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;</pre>
<p>Running 'mvn package' will now give me java classes with aspects woven into them. You can for example use an java decompiler such as jad to check this.</p>
<p>Just one final bit missing now, and that is to set up my spring application context to actually wire this up.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/sche
ma/beans/spring-beans.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/
tx/spring-tx-2.5.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/sc
hema/context/spring-context-2.5.xsd
  "&gt;

    &lt;context:spring-configured /&gt;
    &lt;context:annotation-config /&gt;</pre>
<p>spring-configured will make sure the @Configurable annotation kicks in as the class is instantiated, while annotation-config will do the actual job of checking for @Autowired and place the correct DAO service into my tag.</p>
<p>So now I have gotten rid of my old school singleton patterns and replaced them with DAOs that are wired up in my spring config. I did a complete refactoring of our database layer in one afternoon using this technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/aspects-with-spring-and-maven-for-getting-rid-of-singletons/feed/</wfw:commentRss>
		</item>
		<item>
		<title>rechargenews.com released</title>
		<link>http://brill.no/rechargenewscom-released/</link>
		<comments>http://brill.no/rechargenewscom-released/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 16:19:03 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://brill.no/?p=48</guid>
		<description><![CDATA[
I've lately been spending my working hours getting rechargenews.com up and running. And now its here! The web release was friday 9th, and the first printed newspaper came out today.
All the design was delivered to us from apt, but we implemented the design and controllers inhouse. And I'm almost a bit proud to say that [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-50" title="rechargelogo" src="http://brill.no/wp-content/uploads/2009/01/rechargelogo.png" alt="rechargelogo" width="460" height="51" /></p>
<p>I've lately been spending my working hours getting <a href="http://www.rechargenews.com">rechargenews.com</a> up and running. And now its here! The web release was friday 9th, and the first printed newspaper came out today.</p>
<p>All the design was delivered to us from <a href="http://apt.no">apt</a>, but we implemented the design and controllers inhouse. And I'm almost a bit proud to say that this has become one of the most visually and user friendly news sites on the web.</p>
<p>Rechargenews will deliver news and editorials on renewable energy - an important issue in today. And it is my hope that it will influence people to make choiches that will lead to a habitable planet in the future.</p>
<p>Using scrum on this project has made us able to deliver on time, and with an acceptable feature set. More will surely come in the future, but the important bits are already there.</p>
<p>This release marked the end of my commitment for this project at this time, and I will be moving my attention to the new work that needs to be done to <a href="http://dn.no">dn.no</a> - the leading financial news site in Norway.</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/rechargenewscom-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Remove bottlenecks and optimize the web with Javascript</title>
		<link>http://brill.no/remove-bottlenecks-and-optimize-the-web-with-javascript/</link>
		<comments>http://brill.no/remove-bottlenecks-and-optimize-the-web-with-javascript/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 09:25:43 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Web development]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[bottleneck]]></category>

		<category><![CDATA[dom]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[manipulation]]></category>

		<guid isPermaLink="false">http://brill.no/?p=46</guid>
		<description><![CDATA[
There are times when you want to embed 3rd party elements into your web pages. If you have a high traffic site which has time critical output, you might come to realize that your 3rd party vendor doesn't have the same uptime as yourself, resulting in delayed GET statements that seem to bog down your [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="alignnone aligncenter" src="http://farm1.static.flickr.com/182/446710364_47ae447331.jpg?v=0" alt="speed boat" width="423" height="328" /></p>
<p>There are times when you want to embed 3rd party elements into your web pages. If you have a high traffic site which has time critical output, you might come to realize that your 3rd party vendor doesn't have the same uptime as yourself, resulting in delayed GET statements that seem to bog down your site.</p>
<p>Here you are left with a couple of choices.</p>
<ul>
<li>Ditching the supplied elements all together, usually a very unpopular decision.</li>
<li>Caching it - which might be a problem with licensing and time critical elements.</li>
<li>Use JavaScript to fetch those elements - as explained in this article.</li>
</ul>
<p>The goal here is to give a usable page to your visitors as quickly as possible.</p>
<p><span id="more-46"></span></p>
<h2>Fetching images</h2>
<p>Imagine you have some graphs that you wish to display. You'd normally show these as</p>
<pre>&lt;img src="http://some.remote.host.com/image.jpg" alt="...." /&gt;</pre>
<p>However, this can be troublesome. If this image is slow to fetch it might bog down your entire web page. So you want to fetch this image after everything else is loaded.</p>
<ol>
<li>Set up a div element to hold your image.</li>
<li>Use JavaScript to manipulate the DOM to update the div element in #1.</li>
<li>The web browser will now automatically read the new DOM update and fetch the image.</li>
<li>Success.</li>
</ol>
<pre>&lt;div id="some_image"&gt;&lt;/div&gt;</pre>
<pre>&lt;script type="text/javascript" src="/js/imagefetch.js"&gt;&lt;/script&gt;</pre>
<p>The content of the imagefetch.js script:</p>
<pre>function getImage() {
    div = document.getElementById("some_image");

    img = document.createElement("img");
    img.setAttribute("src", "http://some.remote.host.com/image.jpg");
    img.setAttribute("alt", "alt text");

    div.appendChild(img);
}   

window.onload = getImage</pre>
<p>The important aspect of this script is the window.onload event. With this you will execute the getImage function after the entire page is loaded.</p>
<h2>Fetching fragments</h2>
<p>There are other cases where entire fragments are to be inserted into your page. This has traditionally been solved by using iframes. However, using iframes leaves you at an disadvantage if you want to apply stylesheets or add javascript to the imported fragment. By inserting the fragment directly into your already existing DOM you can help leviate this problem. Using an AJAX library such as prototype greatly simplifies this.</p>
<pre>&lt;script type="text/javascript" src="/js/prototype.js"&gt;&lt;/script&gt;</pre>
<pre>&lt;script type="text/javascript" src="/js/getfragment.js"&gt;&lt;/script&gt;</pre>
<pre>&lt;div id="remote_fragment"&gt;&lt;/div&gt;</pre>
<p>And the content of getfragments.js:</p>
<pre>new Ajax.Updater('remote_fragment', 'http://some.remote.host/fragment.html', {method: 'get'});</pre>
<p>Since this is an AJAX call we don't need to call this in an window.onload event as it is already going on in the background. And with the Ajax.Updater helper this oneliner does an GET on the url and updates the remote_fragment with the output. If there is an error, nothing happens.</p>
<h2>Conclusion</h2>
<p>By using Javascript you can solve some of the bottlenecks on your web site when talking with 3rd party vendors. The techniques described here can also be used in other ways as well where you can get away with DOM manipulations. I.e. chain loading of javascripts for your ad management by updating the &lt;head&gt; element and adding new &lt;script&gt; tags through DOM after the window is loaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/remove-bottlenecks-and-optimize-the-web-with-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The FRA law may make the internet a more secure place.</title>
		<link>http://brill.no/fra-makes-internet-secure/</link>
		<comments>http://brill.no/fra-makes-internet-secure/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 10:40:53 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Social Media]]></category>

		<guid isPermaLink="false">http://brill.no/?p=44</guid>
		<description><![CDATA[
I live in Norway. And with the advent of the new FRA law in Sweden a lot of shouting about political intervention and pressure has come forth in the local media. Big companies in Norway are asking if there can be ways to route traffic around Sweden to their destination. Complaints have been lodged to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://brill.no/wp-content/uploads/2008/09/fra_logo.gif"><img class="alignnone size-medium wp-image-45" title="FRA logo" src="http://brill.no/wp-content/uploads/2008/09/fra_logo.gif" alt="" width="200" height="274" align="left" /></a></p>
<p>I live in Norway. And with the advent of the new FRA law in Sweden a lot of shouting about political intervention and pressure has come forth in the local media. Big companies in Norway are asking if there can be ways to route traffic around Sweden to their destination. Complaints have been lodged to the EU. And philosophical discussions have surfaced that this is a way to treat everyone as a criminal until proven innocent - turning the entire legal system on its head.</p>
<p>However, I won't discuss this, but another aspect which hasn't been discussed much. This case gives the public insight into how the protocols of the internet work: Internet traffic crosses borders. This is a fact. Even if sender and recipient is in the same country traffic can cross national borders. This is how this technology is built, and is even considered one of the strengths of the internet. As one node goes down traffic will still find a way through somehow.</p>
<p><span id="more-44"></span></p>
<p>One more thing this also teaches the public: People can see your traffic in the clear. This means that anyone controlling a node in the network that your traffic goes through can read your email (your, and others internet providers). We technicians have always known this. This is one of the reasons why projects such as <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security">TLS</a>, <a href="http://en.wikipedia.org/wiki/Tor_(anonymity_network)">Tor</a>, <a href="http://en.wikipedia.org/wiki/Freenet">Freenet</a> and <a href="http://en.wikipedia.org/wiki/Pretty_Good_Privacy">PGP</a> have come to life - to make it easier for people to communicate securely without other people eavesdropping.</p>
<p>In general there are two things we need from the internet in these times; anonymity and security. We want to be able to criticize the current power infrastructure in a way that doesn't put yourself as a person at a risk. This might be an exxaggurated point in a democratic nation you say, but suddenly we have terrorist watch lists and whatnot crawling the web for rants and adding you to a no-fly list.</p>
<p>For businesses, the people with the cash, this anonymous point is probably of little concern. But the point of transacting secure dialogues with business partners is important. You do not wish to divulge important information to your competition. And considering how easy it is to sniff network traffic between two points you might really consider this.</p>
<p>The old school way of sending secure messages is via ordinary mail. You can see if your mail has been tampered with. You can even send it with a special courier. The equivalent of doing these things in the email era is also possible. Tools exist to securely encrypt messages between sender and receiver. And the cost of doing it outweighs the dangers of your business critical secrets leaking to the competition.</p>
<p>However, until businesses see the value and start using cash on securing their information instead of crying out in the media, we will continue to be ripped off when questions regarding national security are asked in the tone that everyone is a potential terrorist.</p>
<p>Hopefully advances in secure message handling between businesses will also trickle down onto our moms and dads using a computer to voice their opinion.</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/fra-makes-internet-secure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bamboo IRC bot</title>
		<link>http://brill.no/bamboo-irc-bot/</link>
		<comments>http://brill.no/bamboo-irc-bot/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 14:33:54 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://blog.brill.no/?p=43</guid>
		<description><![CDATA[
We use IRC as our main communication channel here at the office. And after setting up Bamboo as our continuous integration server I wanted to hook it up to our channel so I could get some automatic flaming of those build-breakers.
Its been some years since I last wrote anything for IRC. And the only thing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flickr.com/photos/lockwasher/142241598/"><img src="http://farm1.static.flickr.com/50/142241598_b986794c0d.jpg?v=0" alt="fat robot" /></a><br />
We use IRC as our main communication channel here at the office. And after setting up <a href="http://atlassian.com/bamboo">Bamboo</a> as our continuous integration server I wanted to hook it up to our channel so I could get some automatic flaming of those build-breakers.</p>
<p>Its been some years since I last wrote anything for IRC. And the only thing I had ever programmed in before was eggdrop. But I wanted something leaner - and preferably written in python. I ended up with <a href="http://linux.duke.edu/projects/kibot/">Kibot</a>. It seemed to have everything I needed - namely timer support.</p>
<p>Bamboo have several RSS feeds you can tap into. I wanted to use the feed for all failed builds. Have the bot iterate over these items (I used <a href="http://feedparser.org">feedparser</a> for this) and send a message to a channel.</p>
<p>I finally ended up with <a href="http://en.wikipedia.org/wiki/Murphy's_law">Murphy</a>. A chap who will give full notice of your shortcomings as a programmer.</p>
<p>You can grab the <a href="http://brill.no/projects/bamboo.py">source</a> and play around with it yourself if you like.</p>
<p>Now I just need to plug in an insult generator. Anyone have any ideas where I can find a particularily nasty dictionary?</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/bamboo-irc-bot/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Analyzing your website for search engine optimization</title>
		<link>http://brill.no/analyzing-your-website-for-search-engine-optimization/</link>
		<comments>http://brill.no/analyzing-your-website-for-search-engine-optimization/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 12:00:15 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Web development]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[search engine optimization]]></category>

		<category><![CDATA[seo]]></category>

		<category><![CDATA[spiders]]></category>

		<guid isPermaLink="false">http://blog.brill.no/?p=32</guid>
		<description><![CDATA[
In accordance with my previous article about search engine optimization tips, I will in this article concentrate on how to dissect your website and figure out what needs to be done. And I'll only use free tools doing it :)

How many links do you have?
Search engines computes your importance rank according to how many people [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/pagerank.png"><img class="alignright size-full wp-image-33" title="pagerank" src="http://blog.brill.no/wp-content/uploads/2008/06/pagerank.png" alt="Google Toolbar Pagerank" width="159" height="86" /></a></p>
<p>In accordance with <a href="http://blog.brill.no/search-engine-optimization-tips/">my previous article about search engine optimization tips</a>, I will in this article concentrate on how to dissect your website and figure out what needs to be done. And I'll only use free tools doing it :)</p>
<p><span id="more-32"></span></p>
<h2>How many links do you have?</h2>
<p>Search engines computes your importance rank according to how many people have linked to you. And its also important to have high ranking sites linking to you.</p>
<p>You can do this by easily supplying in a Google search field: "link:http://mysite.com/"<br />
<a href="http://blog.brill.no/wp-content/uploads/2008/06/link-slashdot.png"><img class="aligncenter size-medium wp-image-34" title="slashdot link search" src="http://blog.brill.no/wp-content/uploads/2008/06/link-slashdot-300x37.png" alt="link:slashdot.org" width="300" height="37" /></a></p>
<h2>How are your pages seen as the user get hits from your page?</h2>
<p>In your google search box do "site:mysite.com". This will list all pages that Google has indexed about your site. Here you can also see how they are represented when a search gives you a hit. This is where the meta tag description comes in handy.</p>
<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/site-brill.png"><img class="aligncenter size-full wp-image-35" title="site-brill" src="http://blog.brill.no/wp-content/uploads/2008/06/site-brill.png" alt="" width="500" height="134" /></a></p>
<h2>How does a search spider see my web page?</h2>
<p>A search bot, spider or a crawler doesn't see your web page as a human does. Contrary to a human being the spider will only see text. It cant see images, placement of text or anything else. Just text. So head on over to <a href="http://searchwho.com/sw5-spider.html">SearchWho</a> and enter your site there to get a taste.</p>
<h2>What queries are people using to get to my pages?</h2>
<p>For this you will need to install Google Analytics. Its a great free tool for giving you statistics about your web traffic. It will tell you from which sources traffic is generated, and if its from search engines - you get a drilldown of what keywords was used as well. Nifty.</p>
<p>With this data at hand you can do your own searches for the same keywords and see how the results look like. Are they compelling? Or would you actually rather click on the competition?</p>
<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/analytics.png"><img class="aligncenter size-medium wp-image-36" title="google-analytics" src="http://blog.brill.no/wp-content/uploads/2008/06/analytics-300x42.png" alt="Screenshot from Google Analytics" width="300" height="42" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/analyzing-your-website-for-search-engine-optimization/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Search Engine Optimization Tips</title>
		<link>http://brill.no/search-engine-optimization-tips/</link>
		<comments>http://brill.no/search-engine-optimization-tips/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 14:31:34 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://blog.brill.no/?p=29</guid>
		<description><![CDATA[I'm doing search engine optimization on some of our sites now. And in that process I have collected some tips about what helps the crawler do its job.
You are looking for new readers for your glorious content, but nobody is finding their way to your site. Did you wall yourself in by an accident?
SEO is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/optimus-prime.jpg"><img class="alignright size-medium wp-image-30" title="optimus-prime" src="http://blog.brill.no/wp-content/uploads/2008/06/optimus-prime-300x267.jpg" alt="Optimus Prime - Prime Optimizer" width="229" height="203" /></a>I'm doing search engine optimization on some of our sites now. And in that process I have collected some tips about what helps the crawler do its job.</p>
<p>You are looking for new readers for your glorious content, but nobody is finding their way to your site. Did you wall yourself in by an accident?</p>
<p>SEO is usually a lot of common sense, really, and if you have good developers on your site with a bit of time on their hands you can do the job yourself instead of contracting this out.</p>
<p><span id="more-29"></span></p>
<h2>Title</h2>
<p>Have a good &lt;title&gt; tag. Preferably one that says &lt;title&gt;The title of my article - Company name&lt;/title&gt; instead of the other way around, putting your company first. Yes, I know you lads love company branding, but search engines don't really give a crap.</p>
<h2>URL pattern</h2>
<p>Use a good URL scheme. Instead of having dynamic article.html?id=1024, invest some work in a more permalink way of doing things. http://mycompany/articles/this-is-the-title-of-my-article.html goes a long way of helping search engines match user queries up to results. Search engines actually believe that people will name their documents properly. Weird, eh?</p>
<p>If you are already using some sort of relational database (like MySQL or Oracle) to hold your articles you can probably set up a new table with two columns. One with the permalink name, and the other with the article id. This won't break your old infrastructure, but you will be able to set up a servlet which can take your permalinks and map them to your articles and render the correct page.</p>
<h2>Validate your html</h2>
<p>Yes, yes, yes. You've all heard it before. But its important! Ease the poor crawler's job by having valid html. Cleaning up your html code will probably lead you to structuring your document better as well - which will easy readability.</p>
<h2>Document structure</h2>
<pre>&lt;h1&gt;Title of my document&lt;/h1&gt;</pre>
<pre>&lt;p&gt;Here comes the body of some article&lt;/p&gt;</pre>
<pre>&lt;p&gt;And here's another paragraph&lt;/p&gt;</pre>
<p>Don't use DIVs instead of H1 when you mean to set a title. You can style H1-blocks with css as well you know...</p>
<h2>Placement</h2>
<p>Put your article text in the top of the document. Yes, the entire document is usually crawled. But isn't the most relevant stuff supposed to be in the top of the document anyway? By using css to do your layout this shouldn't be a problem anyway.</p>
<h2>Redirects</h2>
<p>Don't do them. Search engines don't like to be shuffled around. The only exception here is when you are actually going to move your site to a new server, or are changing the url layout (in which case you should be using the http code 301).</p>
<h2>Javascript</h2>
<p>Search Engines don't run Javascript. So any text that is inserted through it won't be parsed. Be wary.</p>
<h2>Meta tags</h2>
<p>Meta tags can be nice. Or they can kill you. You need to balance this bit out. Don't overdo it, but you'll need a couple.</p>
<pre>&lt;<span class="start-tag">meta</span><span class="attribute-name"> name</span>=<span class="attribute-value">"description" </span><span class="attribute-name">content</span>=<span class="attribute-value">"A 160 word maximum description of this article goes here" </span><span class="error"><span class="attribute-name">/</span></span>&gt;
&lt;<span class="start-tag">meta</span><span class="attribute-name"> name</span>=<span class="attribute-value">"keywords" </span><span class="attribute-name">content</span>=<span class="attribute-value">"money, cash, greed" </span><span class="error"><span class="attribute-name">/</span></span>&gt;
</pre>
<h2>Sitemap</h2>
<p>Create a sitemap.xml file for your site. This can help the search engine to discover more content. With a sitemap you can also tell search engines how often content is updated in various sections, and will aid in helping the search engine's crawler in deciding how often to crawl your site.</p>
<h2>Pay for article view</h2>
<p>Yes, I know people want to get paid for what they do. But hiding their content behind a login screen will probably just end up with none actually being aware that you have any content to sell. Or at least, not new customers anyway. Those customers you want to reach through a search engine for example.</p>
<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/cash.jpg"><img class="alignleft size-medium wp-image-31" title="cash" src="http://blog.brill.no/wp-content/uploads/2008/06/cash-300x197.jpg" alt="A load of cash" width="300" height="197" /></a>So instead, think about how much of your content you can give away, without giving up all the details. Create introductions to your articles which are keyword rich - keywords you think people will search for.</p>
<p>For the rest of the article you'll want to have the reader sign up. But this can also be a big wall, its easier to just click "back" and select the next hit in the search result. So this is where you need to think about some strategies about your content. Do I want to give it all away for free, living of ads? Or do I open up my archive, so that stories older than X are served in their full glory. Giving paying subscribers the juice of fresh content.</p>
<p>I guess, if you are already on the web, and reading about search engine optimization you are on the lookout for attracting new readers, so you should carefully weigh the pros and cons on this one.</p>
<h2>Other resources</h2>
<p><a href="http://www.e2solutions.net/articles/beginners-guide-seo.htm" target="_blank">Beginners Guide to SEO, Search Engine Optimization India</a></p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/search-engine-optimization-tips/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creating Automatic Acceptance Tests - FIT vs Selenium</title>
		<link>http://brill.no/creating-automatic-acceptance-tests/</link>
		<comments>http://brill.no/creating-automatic-acceptance-tests/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 14:57:10 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
		
		<category><![CDATA[Agile]]></category>

		<category><![CDATA[acceptance test]]></category>

		<category><![CDATA[continous integration]]></category>

		<category><![CDATA[fit]]></category>

		<category><![CDATA[fitnesse]]></category>

		<category><![CDATA[junit]]></category>

		<category><![CDATA[maven]]></category>

		<category><![CDATA[selenium]]></category>

		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://blog.brill.no/?p=26</guid>
		<description><![CDATA[I wanted a tool to write acceptance tests with. Something easy to set up, and of course, flexible. What gets churned out here at my company are webapps, so I had this in mind when I went ahead looking for the right tool. After browsing around I came to the conclusion that the tools with [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted a tool to write acceptance tests with. Something easy to set up, and of course, flexible. What gets churned out here at my company are webapps, so I had this in mind when I went ahead looking for the right tool. After browsing around I came to the conclusion that the tools with most drive behind them was <a href="http://fit.c2.com" target="_blank">FIT</a> and <a href="http://selenium.openqa.org" target="_blank">Selenium</a>. Here follows my encounter with them.</p>
<h3><span id="more-26"></span></h3>
<h3>FIT</h3>
<p>This looked like a neat idea. You have your customers come up with a html table through any WYSIWYG application - like MS Word or whatever. The customer then creates columns with input values and an expected result column.</p>
<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/fit.gif"><img class="aligncenter size-full wp-image-27" title="fit" src="http://blog.brill.no/wp-content/uploads/2008/06/fit.gif" alt="FIT MS Word example" width="500" height="379" /></a></p>
<p>As a developer you then write a fixture that takes this html file as input. In essence - data driven testing.</p>
<p>You also have <a href="http://www.fitnesse.org" target="_blank">fitnesse</a> (which I have been unable to download because of their site problems) that has a wiki style frontend for FIT tables. Your customers can enter the wiki, and create their own tests, change them, run them and view the results.</p>
<p>However, I'm not convinved that this is going to supplement our jUnit testing on a web framework. You should already have tests that check if you can handle the login() procedure with both a valid and invalid username in your standard unit-tests. I'm not really seeing the usecase here I guess. And this won't really show us any errors we get because of some missing html or http component. And since web is our bread and butter I gave this the thumbs down for now.</p>
<h3>Selenium</h3>
<p>In comes Selenium. And for webapps this looks like a killer testing platform. With the firefox plugin I can record an interactive session I have with a webpage. For example, I can login and have it search for some text to use as a success-criteria. I can for example check that all menupoints are on certain pages, or do  form validator checking. And its all done in firefox. I open the Firefox Selenium IDE plugin. Hit the record-button and start using the site I'm developing for as a normal user. I then save the recorded session for later playback so I can check if the next version I am about to deploy breaks something.</p>
<p>But I want to automate my selenium tests. I don't want to open up firefox every time my webapp is due for acceptance testing - which should be every time I check in my code. This is something I want handled by my integration server.</p>
<p>It seems the firefox plugin can export my selenium tests (originally written in selenese) to Java. Hmm, nice. Maybe I can use this for jUnit then.</p>
<p><a href="http://blog.brill.no/wp-content/uploads/2008/06/selenium.png"><img class="aligncenter size-full wp-image-28" title="selenium-export" src="http://blog.brill.no/wp-content/uploads/2008/06/selenium.png" alt="Selenium export" width="500" height="520" /></a></p>
<p>And there is a Java API for selenium!</p>
<p>I set up a <a href="http://selenium-rc.openqa.org/" target="_blank">Selenium Remote Control</a> server. I am developing on a Linux box, and therefore don't have access to Internet Explorer and Safari locally. But we have a test-server in a corner which runs Windows. So I downloaded Selenium RC on it. I can now connect to this server instance and have it execute selenium commands on a wide range of browsers running on that machine.</p>
<p>To do this through java code I added a dependencies in my pom.xml to the selenium API:</p>
<p>&lt;dependency&gt;<br />
&lt;groupId&gt;org.openqa.selenium.client-drivers&lt;/groupId&gt;<br />
&lt;artifactId&gt;selenium-java-client-driver&lt;/artifactId&gt;<br />
&lt;version&gt;1.0-beta-1&lt;/version&gt;<br />
&lt;scope&gt;test&lt;/scope&gt;<br />
&lt;/dependency&gt;</p>
<p>And in my $HOME/.m2/settings.xml file I had to add the selenium repository server:</p>
<p>&lt;profile&gt;<br />
&lt;id&gt;selenium&lt;/id&gt;<br />
&lt;repositories&gt;<br />
&lt;repository&gt;<br />
&lt;id&gt;openqa.org&lt;/id&gt;<br />
&lt;name&gt;Openqa Release Repository&lt;/name&gt;<br />
&lt;url&gt;http://archiva.openqa.org/repository/releases&lt;/url&gt;<br />
&lt;layout&gt;default&lt;/layout&gt;<br />
&lt;snapshots&gt;&lt;enabled&gt;false&lt;/enabled&gt;&lt;/snapshots&gt;<br />
&lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;<br />
&lt;/repository&gt;<br />
&lt;/repositories&gt;<br />
&lt;/profile&gt;</p>
<p>Now we are ready to create a jUnit test file based on the output the firefox plugin recorded earlier. The export function created a skeleton for me to base my test on:</p>
<pre class="java"><span style="color: #000000; font-weight: bold;">package</span> com.<span style="color: #006600;">example</span>.<span style="color: #006600;">tests</span>;
&nbsp;
<span style="color: #a1a100;">import com.thoughtworks.selenium.*;</span>
<span style="color: #a1a100;">import java.util.regex.Pattern;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> NewTest <span style="color: #000000; font-weight: bold;">extends</span> SeleneseTestCase <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setUp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> <span style="color: #66cc66;">&#123;</span>
                setUp<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://change-this-to-the-site-you-are-testing/&quot;</span>,
                      <span style="color: #ff0000;">&quot;*chrome&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> testNew<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> <span style="color: #66cc66;">&#123;</span>
                selenium.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=Børs/marked&quot;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=Aksjekurser&quot;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                verifyTrue<span style="color: #66cc66;">&#40;</span>selenium.<span style="color: #006600;">isTextPresent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;DN Finans&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=markedsoversikt&quot;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                verifyTrue<span style="color: #66cc66;">&#40;</span>selenium.<span style="color: #006600;">isTextPresent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Børskommentar Oslo&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=DN.no&quot;</span><span style="color: #66cc66;">&#41;</span>;
                selenium.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                verifyTrue<span style="color: #66cc66;">&#40;</span>selenium.<span style="color: #006600;">isTextPresent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SØK&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>The SeleneseTestCase class is a class coming with the Selenium API. It extends the TestCase method already in jUnit and adds verifyXXX() methods instead of using assertXXX(). These verifiers don't throw exceptions like assert does, but rather collects all the errors and waits until the tearDown is called to show any errors that occured.</p>
<p>I opted out of this because I want my tests to fail the minute they do. I'd rather have several selenium test suites breaking up the tests in easier to manage chunks. I also wish to check on several browsers at once, so I just set up a standard jUnit test to see if all works as expected:</p>
<pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DnTest <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> DefaultSelenium firefox;
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> DefaultSelenium explorer;
&nbsp;
        <span style="color: #808080; font-style: italic;">/**
         * @throws java.lang.Exception
         */</span>
        @BeforeClass
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> setUpBeforeClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> <span style="color: #66cc66;">&#123;</span>
                firefox = <span style="color: #000000; font-weight: bold;">new</span> DefaultSelenium<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;selenium.nhst.as&quot;</span>, <span style="color: #cc66cc;">4444</span>,
                                              <span style="color: #ff0000;">&quot;*firefox&quot;</span>, <span style="color: #ff0000;">&quot;http://www.dn.no&quot;</span><span style="color: #66cc66;">&#41;</span>;
                explorer = <span style="color: #000000; font-weight: bold;">new</span> DefaultSelenium<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;selenium.nhst.as&quot;</span>, <span style="color: #cc66cc;">4444</span>,
                                               <span style="color: #ff0000;">&quot;*iexplore&quot;</span>, <span style="color: #ff0000;">&quot;http://www.dn.no&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/**
         * @throws java.lang.Exception
         */</span>
        @AfterClass
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> tearDownAfterClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> <span style="color: #66cc66;">&#123;</span>
                firefox = <span style="color: #000000; font-weight: bold;">null</span>;
                explorer = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #66cc66;">&#125;</span>
        @Test
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> testMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> <span style="color: #66cc66;">&#123;</span>
                firefox.<span style="color: #006600;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=Børs/marked&quot;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=Aksjekurser&quot;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                assertTrue<span style="color: #66cc66;">&#40;</span>firefox.<span style="color: #006600;">isTextPresent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;DN Finans&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=markedsoversikt&quot;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                assertTrue<span style="color: #66cc66;">&#40;</span>firefox.<span style="color: #006600;">isTextPresent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Børskommentar Oslo&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;link=DN.no&quot;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">waitForPageToLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;30000&quot;</span><span style="color: #66cc66;">&#41;</span>;
                assertTrue<span style="color: #66cc66;">&#40;</span>firefox.<span style="color: #006600;">isTextPresent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SØK&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                firefox.<span style="color: #006600;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>The above snippet connects to my selenium rc host. Requests an firefox and iexplore session and feeds the firefox session with commands that are to be executed. And if any error occurs, the asserts will fail and give me a standard assert error I can address in Eclipse by clicking on the line that failed.</p>
<p>However, you would probably want to run firefox.start() and firefox.stop() in your setup() and tearDown(), so that firefox will be closed even though a test fails.</p>
<p>But this takes a looooong time to run. It can take several minutes to run. It starts firefox, sends queues commands and closes firefox. And then you do the same with other browsers. So I don't want these tests to be in my standard test suite executed by the maven test goal. I wanted to only execute this during the integration-test phase.</p>
<p>Lets configure the maven-surefire-plugin:</p>
<p>&lt;plugin&gt;<br />
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
&lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br />
&lt;configuration&gt;<br />
&lt;excludes&gt;<br />
&lt;exclude&gt;**/selenium/*Test.java&lt;/exclude&gt;<br />
&lt;/excludes&gt;<br />
&lt;/configuration&gt;<br />
&lt;executions&gt;<br />
&lt;execution&gt;<br />
&lt;id&gt;surefire-it&lt;/id&gt;<br />
&lt;phase&gt;integration-test&lt;/phase&gt;<br />
&lt;goals&gt;<br />
&lt;goal&gt;test&lt;/goal&gt;<br />
&lt;/goals&gt;<br />
&lt;configuration&gt;<br />
&lt;excludes&gt;<br />
&lt;exclude&gt;none&lt;/exclude&gt;<br />
&lt;/excludes&gt;<br />
&lt;includes&gt;<br />
&lt;include&gt;**/selenium/*Test.java&lt;/include&gt;<br />
&lt;/includes&gt;<br />
&lt;/configuration&gt;<br />
&lt;/execution&gt;<br />
&lt;/executions&gt;<br />
&lt;/plugin&gt;<br />
This code will exclude every test in the selenium-package during normal test run, but include them under the integration-test phase.</p>
<p>And now we have automated our Selenium acceptance tests :)</p>
]]></content:encoded>
			<wfw:commentRss>http://brill.no/creating-automatic-acceptance-tests/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
