<?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>GARBUZ.COM</title>
	<atom:link href="http://garbuz.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://garbuz.com</link>
	<description>Developer&#039;s thougths ...</description>
	<lastBuildDate>Tue, 27 Sep 2011 04:01:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Maven 2: Configuring web projects in Eclipse</title>
		<link>http://garbuz.com/2010/08/07/maven-2-configuring-web-projects-in-eclipse/</link>
		<comments>http://garbuz.com/2010/08/07/maven-2-configuring-web-projects-in-eclipse/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 02:42:29 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Deploy]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[POM]]></category>
		<category><![CDATA[WAR]]></category>

		<guid isPermaLink="false">http://garbuz.com/?p=81</guid>
		<description><![CDATA[When you use Maven plug-in for Eclipse (Eclipse WTP) it generates you a project using predefined archetype but then Eclipse does not recognize this project as Web project and you loose the ability to debug it. This is what you can do to fix it. First, we need to convert this project into Eclipse WTP [...]]]></description>
			<content:encoded><![CDATA[<p>When you use Maven plug-in for Eclipse (Eclipse WTP) it generates you a project using predefined archetype but then Eclipse does not recognize this project as Web project and you loose the ability to debug it.</p>
<p>This is what you can do to fix it. First, we need to convert this project into Eclipse WTP web project.</p>
<p>This is <strong>.project</strong> file before modification</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;projectDescription&gt;
	&lt;name&gt;web&lt;/name&gt;
	&lt;comment&gt;&lt;/comment&gt;
	&lt;projects&gt;
	&lt;/projects&gt;
	&lt;buildSpec&gt;
		&lt;buildCommand&gt;
			&lt;name&gt;org.eclipse.jdt.core.javabuilder&lt;/name&gt;
			&lt;arguments&gt;
			&lt;/arguments&gt;
		&lt;/buildCommand&gt;
		&lt;buildCommand&gt;
			&lt;name&gt;org.maven.ide.eclipse.maven2Builder&lt;/name&gt;
			&lt;arguments&gt;
			&lt;/arguments&gt;
		&lt;/buildCommand&gt;
	&lt;/buildSpec&gt;
	&lt;natures&gt;
		&lt;nature&gt;org.eclipse.jdt.core.javanature&lt;/nature&gt;
		&lt;nature&gt;org.maven.ide.eclipse.maven2Nature&lt;/nature&gt;
	&lt;/natures&gt;
&lt;/projectDescription&gt;
</pre>
<p>We need to add a new builder and a new nature to the project. You will need to insert this XML code into this file.</p>
<p>This will go under build spec section:</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;buildCommand&gt;
		&lt;name&gt;org.eclipse.wst.common.project.facet.core.builder&lt;/name&gt;
		&lt;arguments&gt;
		&lt;/arguments&gt;
	&lt;/buildCommand&gt;
</pre>
<p>and this will go under natures:</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;nature&gt;org.eclipse.wst.common.project.facet.core.nature&lt;/nature&gt;
</pre>
<p>This is <strong>.project</strong> file after modification:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;projectDescription&gt;
	&lt;name&gt;web&lt;/name&gt;
	&lt;comment&gt;&lt;/comment&gt;
	&lt;projects&gt;
	&lt;/projects&gt;
	&lt;buildSpec&gt;
		&lt;buildCommand&gt;
			&lt;name&gt;org.eclipse.jdt.core.javabuilder&lt;/name&gt;
			&lt;arguments&gt;
			&lt;/arguments&gt;
		&lt;/buildCommand&gt;
		&lt;buildCommand&gt;
			&lt;name&gt;org.maven.ide.eclipse.maven2Builder&lt;/name&gt;
			&lt;arguments&gt;
			&lt;/arguments&gt;
		&lt;/buildCommand&gt;
		&lt;buildCommand&gt;
			&lt;name&gt;org.eclipse.wst.common.project.facet.core.builder&lt;/name&gt;
			&lt;arguments&gt;
			&lt;/arguments&gt;
		&lt;/buildCommand&gt;
	&lt;/buildSpec&gt;
	&lt;natures&gt;
		&lt;nature&gt;org.eclipse.jdt.core.javanature&lt;/nature&gt;
		&lt;nature&gt;org.maven.ide.eclipse.maven2Nature&lt;/nature&gt;
		&lt;nature&gt;org.eclipse.wst.common.project.facet.core.nature&lt;/nature&gt;
	&lt;/natures&gt;
&lt;/projectDescription&gt;
</pre>
<p>Now you need to go to project properties and select appropriate facets. To do that you need to right click on the project name and select Properties. On project Properties dialog you will need to select Project Facets.</p>
<p>On that screen you will need to select Dynamic Web Module, and appropriate version of Java for this module. For example if you select Dynamic Web Module version 2.5 you will need to have Java 5 or higher selected too.</p>
<p><a href="http://garbuz.com/blog/wp-content/uploads/2010/08/Capture.png"><img title="Selecting Project Facets - click to enlarge" src="http://garbuz.com/blog/wp-content/uploads/2010/08/Capture.png" alt="Image that display how to select Project Facets for Web Project in Eclipse" /></a></p>
<p>Once you selected these facets and saved project project properties Eclipse will add new folder to your project called WebContent. This is the folder where Eclipse will store all the web files such as web.xml and JSPs.</p>
<p>Now you have a web project that will be recognized by Eclipse and you can add this project to your server.</p>
<p>The problem with this is that Maven does not know anything about this WebContent folder and won&#8217;t be able to build you project. You have two options: you can update the POM file to change the location of webapp folder, or you can update project settings to replace WebContent with /src/main/webapp.</p>
<p>This is what you need to do: open up <strong>org.eclipse.wst.common.component</strong> file under <strong>.settings</strong> folder. It would look like this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project-modules id=&quot;moduleCoreId&quot; project-version=&quot;1.5.0&quot;&gt;
    &lt;wb-module deploy-name=&quot;web&quot;&gt;
        &lt;wb-resource deploy-path=&quot;/&quot; source-path=&quot;/WebContent&quot;/&gt;
        &lt;wb-resource deploy-path=&quot;/WEB-INF/classes&quot; source-path=&quot;/src/main/java&quot;/&gt;
        &lt;wb-resource deploy-path=&quot;/WEB-INF/classes&quot; source-path=&quot;/src/test/java&quot;/&gt;
        &lt;property name=&quot;context-root&quot; value=&quot;web&quot;/&gt;
        &lt;property name=&quot;java-output-path&quot; value=&quot;/web/target/classes&quot;/&gt;
    &lt;/wb-module&gt;
&lt;/project-modules&gt;
</pre>
<p>Replace /WebContent with /src/main/webapp and save the file.</p>
<p>This is what updated file would look like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project-modules id=&quot;moduleCoreId&quot; project-version=&quot;1.5.0&quot;&gt;
    &lt;wb-module deploy-name=&quot;web&quot;&gt;
        &lt;wb-resource deploy-path=&quot;/&quot; source-path=&quot;/src/main/webapp&quot;/&gt;
        &lt;wb-resource deploy-path=&quot;/WEB-INF/classes&quot; source-path=&quot;/src/main/java&quot;/&gt;
        &lt;wb-resource deploy-path=&quot;/WEB-INF/classes&quot; source-path=&quot;/src/test/java&quot;/&gt;
        &lt;property name=&quot;context-root&quot; value=&quot;web&quot;/&gt;
        &lt;property name=&quot;java-output-path&quot; value=&quot;/web/target/classes&quot;/&gt;
    &lt;/wb-module&gt;
&lt;/project-modules&gt;
</pre>
<p>Now you can delete WebContent folder and your project is fully configured with web support and can be debugged inside Eclipse and build by Maven.</p>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/08/07/maven-2-configuring-web-projects-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven 2: Deploying Javadoc with your project</title>
		<link>http://garbuz.com/2010/08/01/maven-2-deploying-javadoc-with-your-project/</link>
		<comments>http://garbuz.com/2010/08/01/maven-2-deploying-javadoc-with-your-project/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 01:35:29 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Deploy]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[POM]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=55</guid>
		<description><![CDATA[When you deploy your project to remote repository you may want to include the project documentation and deploy it codes along with the project JAR file so that people would be able to download the JAR with Javadoc using Eclipse plug-in. It comes very handy when you use IDE like Eclipse or IDEA. Unfortunately by [...]]]></description>
			<content:encoded><![CDATA[<p>When you deploy your project to remote repository you may want to include the project documentation and deploy it codes along with the project JAR file so that people would be able to download the JAR with Javadoc using Eclipse plug-in. It comes very handy when you use IDE like Eclipse or IDEA. Unfortunately by default Maven 2 does not deploy your source codes when you execute &#8220;deploy&#8221; goal.</p>
<p>This is how you can accomplish this. You need to configure Javadoc plug-in in your POM file</p>
<pre class="brush: xml; title: ; notranslate">

    &lt;reporting&gt;
    	&lt;plugins&gt;
		    &lt;plugin&gt;
		    	&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
		    	&lt;artifactId&gt;maven-javadoc-plugin&lt;/artifactId&gt;
		    	&lt;!-- Add this if you use Java 5 --&gt;
		    	&lt;configuration&gt;
		    		&lt;javadocVersion&gt;1.5&lt;/javadocVersion&gt;
		    	&lt;/configuration&gt;
		    &lt;/plugin&gt;
    	&lt;/plugins&gt;
    &lt;/reporting&gt;
    &lt;build&gt;
    	&lt;plugins&gt;
    		&lt;plugin&gt;
    			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    			&lt;artifactId&gt;maven-javadoc-plugin&lt;/artifactId&gt;
    			&lt;executions&gt;
    				&lt;execution&gt;
    					&lt;id&gt;attach-javadocs&lt;/id&gt;
    					&lt;goals&gt;
    						&lt;goal&gt;jar&lt;/goal&gt;
    					&lt;/goals&gt;
    				&lt;/execution&gt;
    			&lt;/executions&gt;
    		&lt;/plugin&gt;
	    	&lt;!-- Add this if you use Java 5 --&gt;
    		&lt;plugin&gt;
    			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    			&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
    			&lt;configuration&gt;
    				&lt;verbose&gt;true&lt;/verbose&gt;
    				&lt;fork&gt;true&lt;/fork&gt;
    				&lt;compilerVersion&gt;1.5&lt;/compilerVersion&gt;
    				&lt;source&gt;1.5&lt;/source&gt;
    				&lt;target&gt;1.5&lt;/target&gt;
    			&lt;/configuration&gt;
    		&lt;/plugin&gt;
    	&lt;/plugins&gt;
    &lt;/build&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/08/01/maven-2-deploying-javadoc-with-your-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven 2: Downloading sources</title>
		<link>http://garbuz.com/2010/08/01/maven-2-downloading-sources/</link>
		<comments>http://garbuz.com/2010/08/01/maven-2-downloading-sources/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 01:31:28 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=49</guid>
		<description><![CDATA[When you building a project using Maven 2 you may need to download sources for your project dependencies. This is how you can accomplish this goal:]]></description>
			<content:encoded><![CDATA[<p>When you building a project using Maven 2 you may need to download sources for your project dependencies. This is how you can accomplish this goal:</p>
<pre class="brush: plain; title: ; notranslate">

mvn clean compile package -DdownloadSources=true
</pre>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/08/01/maven-2-downloading-sources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven 2: Building Web Projects</title>
		<link>http://garbuz.com/2010/07/31/maven-2-building-web-projects/</link>
		<comments>http://garbuz.com/2010/07/31/maven-2-building-web-projects/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 22:31:09 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[POM]]></category>
		<category><![CDATA[WAR]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=41</guid>
		<description><![CDATA[By default Maven 2 provides a standard way of building web applications. All of the web files such as web.xml and tag libraries and must be stored in /src/main/webapp directory. While this is perfectly fine for the new applications for some existing projects this file structure might be inappropriate. Unfortunately some times you cannot change [...]]]></description>
			<content:encoded><![CDATA[<p>By default Maven 2 provides a standard way of building web applications. All of the web files such as web.xml and tag libraries and must be stored in /src/main/webapp directory.</p>
<p>While this is perfectly fine for the new applications for some existing projects this file structure might be inappropriate. Unfortunately some times you cannot change the existing file structure as you pleased. For example, if you use PVCS as your source control system, then you don’t want to change the existing file structure because it is very difficult to update the source repository.</p>
<p>Another issue that you might have is integration with development tools such as WSAD or Eclipse Web Tools. By default they use different file structure for web projects and unless you want to take a way from people the ability to use debugger you better follow the same file structure as WSAD suggests.</p>
<p>To implement this we will have to modify our POM file and configure maven-war-plugin to tell it where to find web resources. You need to specify the path to the folder that contains the web content. This is how you configure the war plug-in</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 

http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;

	&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
	&lt;groupId&gt;com.garbuz.maven&lt;/groupId&gt;
	&lt;artifactId&gt;test-web-project&lt;/artifactId&gt;
	&lt;packaging&gt;war&lt;/packaging&gt;
	&lt;version&gt;1.0&lt;/version&gt;
	&lt;build&gt;
		&lt;plugins&gt;
			&lt;plugin&gt;
				&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
				&lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
				&lt;version&gt;2.0&lt;/version&gt;
				&lt;configuration&gt;
					&lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
				&lt;/configuration&gt;
			&lt;/plugin&gt;
		&lt;/plugins&gt;
	&lt;/build&gt;
&lt;/project&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/07/31/maven-2-building-web-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven 2: Deploying Project Sources</title>
		<link>http://garbuz.com/2010/07/31/maven-2-deploying-project-sources/</link>
		<comments>http://garbuz.com/2010/07/31/maven-2-deploying-project-sources/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 22:19:10 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Deploy]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=36</guid>
		<description><![CDATA[When you deploy your project to remote repository you may want to include the project source codes along with the project JAR file so that other projects would be able to access your source codes. It comes very handy when you use IDE like Eclipse or IDEA. Unfortunately by default Maven 2 does not deploy [...]]]></description>
			<content:encoded><![CDATA[<p>When you deploy your project to remote repository you may want to   include the project source codes along with the project JAR file so that   other projects would be able to access your source codes. It comes  very  handy when you use IDE like Eclipse or IDEA. Unfortunately by  default  Maven 2 does not deploy your source codes when you execute  &#8220;deploy&#8221;  goal.</p>
<p>This is how you can accomplish this. You need to configure source plug-in in your POM file</p>
<pre class="brush: xml; title: ; notranslate">
&lt;build&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
			&lt;executions&gt;
				&lt;execution&gt;
					&lt;goals&gt;
						&lt;goal&gt;jar&lt;/goal&gt;
					&lt;/goals&gt;
				&lt;/execution&gt;
			&lt;/executions&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/build&gt;
</pre>
<p>If you execute &#8220;deploy&#8221; goal now you will see that in your repository there will be another JAR file – yourproject-1.0-sources.jar.</p>
<p>You may also need to deploy your automated tests. This will help you to avoid writing duplicate code and eventually minimize the maintenance cost. If you want to deploy your test classes with your project you need to configure jar plug-in:</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
			&lt;executions&gt;
				&lt;execution&gt;
					&lt;goals&gt;
						&lt;goal&gt;jar&lt;/goal&gt;
					&lt;/goals&gt;
				&lt;/execution&gt;
			&lt;/executions&gt;
		&lt;/plugin&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
			&lt;executions&gt;
				&lt;execution&gt;
					&lt;goals&gt;
						&lt;goal&gt;test-jar&lt;/goal&gt;
					&lt;/goals&gt;
				&lt;/execution&gt;
			&lt;/executions&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/build&gt;
</pre>
<p>And if you wish to include test sources then your POM file will look like this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;build&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
			&lt;executions&gt;
				&lt;execution&gt;
					&lt;goals&gt;
						&lt;goal&gt;jar&lt;/goal&gt;
						&lt;goal&gt;test-jar&lt;/goal&gt;
					&lt;/goals&gt;
				&lt;/execution&gt;
			&lt;/executions&gt;
		&lt;/plugin&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
			&lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
			&lt;executions&gt;
				&lt;execution&gt;
					&lt;goals&gt;
						&lt;goal&gt;test-jar&lt;/goal&gt;
					&lt;/goals&gt;
				&lt;/execution&gt;
			&lt;/executions&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/build&gt;
</pre>
<p>You can also put this into your super POM file and make all your project POM files extend this one. Then all your projects will deploy sources and tests by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/07/31/maven-2-deploying-project-sources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading Selenium for new Firefox version</title>
		<link>http://garbuz.com/2010/07/31/upgrading-selenium-for-new-firefox-version/</link>
		<comments>http://garbuz.com/2010/07/31/upgrading-selenium-for-new-firefox-version/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 22:07:36 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=33</guid>
		<description><![CDATA[Recently I&#8217;ve ran into a problem after I upgraded Firefox to the latest version and Selenium could not launch a new session. It turned out that Selenium has hardcoded Firefox version number and if your version of FF is greater than this number then it stops working and I got this wired error message: selenium [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve ran into a problem after I upgraded Firefox to the  latest version and Selenium could not launch a new session. It turned  out that Selenium has hardcoded Firefox version number and if your  version of FF  is greater than this number then it stops working and I  got this wired error message: <strong>selenium failed to start new browser session, shutdown browser and clear all session data</strong></p>
<p>This is that you can do to fix the problem.</p>
<ol>
<li>Create a directory and place your selenium-driver.jar in this directory.</li>
<li>Copy your selenium-server.jar file in the newly created directory and go into this directory.</li>
<li>Unzip the jar files contents here.</li>
<li>First find all the *.rdf files – you should see 5 of them:
<ul>
<li>./customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf</li>
<li>./customProfileDirCUSTFF/extensions/readystate@openqa.org/install.rdf</li>
<li>./customProfileDirCUSTFFCHROME/extensions/{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4}/install.rdf</li>
<li>./customProfileDirCUSTFFCHROME/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf</li>
<li>./customProfileDirCUSTFFCHROME/extensions/readystate@openqa.org/install.rdf</li>
</ul>
</li>
<li>In each of these files you will see hardcoded version like this:        3.5.*  Change them to  3.6.*</li>
<li>All the files are now patched. Zip up the extracted files into a new JAR file selenium-server-new.jar</li>
</ol>
<p>Now you should all set to use this patched version of selenium. You can delete your old selenium-server.jar file if you&#8217;d like.</p>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/07/31/upgrading-selenium-for-new-firefox-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Selenium with custom Firefox profile</title>
		<link>http://garbuz.com/2010/07/31/running-selenium-with-custom-firefox-profile/</link>
		<comments>http://garbuz.com/2010/07/31/running-selenium-with-custom-firefox-profile/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 22:04:31 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=30</guid>
		<description><![CDATA[In some instances you may find yourself trying to run functional test against application server that has fake SSL certificates (for example your test environment). In that case Selenium will give you headache since it will create and destroy custom Firefox profile for each test. Fortunately, you can use your own custom profile and run [...]]]></description>
			<content:encoded><![CDATA[<p>In some instances you may find yourself trying to run functional test  against application server that has fake SSL certificates (for example  your test environment). In that case Selenium will give you headache  since it will create and destroy custom Firefox profile for each test.</p>
<p>Fortunately, you can use your own custom profile and run your  Selenium functional tests using this profile. In that case you can  accept all of the certificates once and Firefox will never prompt you to  accept them again. This is how you do this:</p>
<ul>
<li>Navigate to the directory that contains your Firefox profile. If you  use Windows then this directory is something like this C:\Documents and  Settings\[your login name]\Application Data\Mozilla\Firefox\Profiles</li>
<li>In this directory you will see a subdirectory with Firefox profile in it. It would look something like this zv7rrcv8.default.</li>
<li>Copy this entire directory and save it under selenium.default name.</li>
<li>Then navigate to this folder and open up prefs.js file in text editor. Find the line that says:<br />
<code>user_pref("browser.startup.page", 0);</code><br />
and comment it out like this<br />
<code>//user_pref("browser.startup.page", 0);</code></li>
<li>Then open up the bat file that you use to start selenium server.</li>
</ul>
<p>Use this command to start Selenium server:</p>
<p><code> java -jar ./selenium-server-0.9.2.jar  -firefoxProfileTemplate  "C:\Documents and Settings\[your login name]\Application  Data\Mozilla\Firefox\Profiles\selenium.default" </code></p>
<p>Now you can run your functional test against Selenium server using  your own Firefox profile and not worry about SSL certificates, and other  things that are specific to your network.</p>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/07/31/running-selenium-with-custom-firefox-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven 2 and Cobertura configuration</title>
		<link>http://garbuz.com/2010/07/31/maven-2-and-cobertura-configuration/</link>
		<comments>http://garbuz.com/2010/07/31/maven-2-and-cobertura-configuration/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 05:00:05 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Cobertura]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=16</guid>
		<description><![CDATA[We all know how important it is to control the test coverage for the project. However, the only way to ensure objective results is through the use of automated test coverage reports like Clover or Cobertura. While Clover is a commercial product that will cost you money Cobertura is open-source solution that is absolutely free. [...]]]></description>
			<content:encoded><![CDATA[<p>We all know how important it is to control the test coverage for the  project. However, the only way to ensure objective results is through  the use of automated test  coverage reports like Clover or Cobertura.  While Clover is a commercial product that will cost you money Cobertura  is open-source solution that is absolutely free.</p>
<p>Unfortunately, being an open-source project Cobertura seriously lacks  documentation, especially regarding how to configure Maven 2 plug-in.  One of the most common problems with Cobertura is when generated report  shows 100% test coverage while in reality many of the classes do not  have tests.</p>
<p>The reason for this is that Cobertura did not perform code  instrumentation during the site generation phase. As the result the  coverage information is incorrect.</p>
<p>This is the example of how you can configure this report so that it would reflect real test coverage.</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;build&gt;
		&lt;plugins&gt;

			&lt;plugin&gt;
				&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
				&lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
				&lt;executions&gt;
					&lt;execution&gt;
						&lt;id&gt;site&lt;/id&gt;
						&lt;phase&gt;pre-site&lt;/phase&gt;

						&lt;goals&gt;
							&lt;goal&gt;clean&lt;/goal&gt;
						&lt;/goals&gt;
					&lt;/execution&gt;
					&lt;execution&gt;
						&lt;id&gt;instrument&lt;/id&gt;
						&lt;phase&gt;site&lt;/phase&gt;

						&lt;goals&gt;
							&lt;goal&gt;instrument&lt;/goal&gt;
							&lt;goal&gt;cobertura&lt;/goal&gt;
						&lt;/goals&gt;
					&lt;/execution&gt;
				&lt;/executions&gt;
				&lt;configuration&gt;
					&lt;instrumentation&gt;

						&lt;excludes&gt;
							&lt;exclude&gt;com/test/ClassToIgnore.class&lt;/exclude&gt;
							&lt;exclude&gt;com/test/**/*Test.class&lt;/exclude&gt;
							&lt;exclude&gt;com/test2/**/*.class&lt;/exclude&gt;
						&lt;/excludes&gt;
					&lt;/instrumentation&gt;
				&lt;/configuration&gt;

			&lt;/plugin&gt;
		&lt;/plugins&gt;
	&lt;/build&gt;
</pre>
<p>And then we need to add this code to reporting section of our POM file</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;reporting&gt;
		&lt;plugins&gt;
			&lt;plugin&gt;
				&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
				&lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;

			&lt;/plugin&gt;
		&lt;/plugins&gt;
	&lt;/reporting&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/07/31/maven-2-and-cobertura-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Testing 101</title>
		<link>http://garbuz.com/2010/07/30/unit-testing-101/</link>
		<comments>http://garbuz.com/2010/07/30/unit-testing-101/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 03:30:14 +0000</pubDate>
		<dc:creator>Alexander Garbuz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://blog.garbuz.com/?p=1</guid>
		<description><![CDATA[Have you ever seen how the car engines are being diagnosed nowadays? There are special computers at the car repair facilities that can be hooked up right to your car. Inside the engine there are several embedded sensors that can communicate with this computer. They transmit information about the engine’s conditions to the computer and [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Have you ever seen how the car engines are being diagnosed nowadays? There are special computers at the car repair facilities that can be hooked up right to your car. Inside the engine there are several embedded sensors that can communicate with this computer. They transmit information about the engine’s conditions to the computer and it tells you exactly what is going on. Isn’t it quite amazing?</p></blockquote>
<p>As a software developer I always wanted to have this special computer that could tell me instantly why my code is not doing what it’s supposed to do. Unfortunately, there is no such computer in a real world. However, there is something else that can do pretty much the same job. It is called test driven development.<br />
How can you, as a programmer, make sure that your code is functional and meets the client’s expectations? What are the ways to verify that nothing has changed in the system’s behavior since the last server upgrade? Can you make a certain change without breaking the entire system? To answer these questions we have several options.</p>
<p>Option number one is to remain ignorant and continue the development process hoping that at the end things will just work. While many people use this naive approach, it is not hard to imagine what can happen at the end. Usually, this would result in a failed project and potentially a request for the HR department to hire a new project manager to replace the one who led the project.</p>
<p>The second option would be to hire a tester &#8211; someone whose job responsibility would be to run your code and make sure it behaves according to the specification. While this approach sounds easy enough, it has one serious problem: you can’t start testing until your code it written completely, or at least you have enough of it so you can execute it. But, what if you made a mistake along the way and your code simply doesn’t run? How can you, as a programmer, quickly find out where the problem is? Using this approach, it is going to be very hard or sometimes even impossible to identify the source of the problem and resolve it in a short period of time. Not only is it going to be very difficult, it is also going to be very time consuming and expensive. Not to mention that once you found the error, there is no guarantee that the code will run. You simply might have another error similar to the one you just fixed somewhere else in the code and you will have to repeat the entire debugging processes over and over, again and again, until all the problems are fixed.</p>
<p>Fortunately for us there is another way. It is called test driven development. The idea behind this approach is to develop a suite of automated tests that can test your code on a regular basis and provide you with valuable feedback regarding the conditions of the program you’re writing.</p>
<p>This is how it works in general. First, you develop your tests and only then you write your code. By the time you start writing your main system code you already have a unique custom-built tool that can almost instantly diagnose your system and tell you if there are any problems. When you get to the point where you need to finish your project, your code will be intensively tested from inside out using variety of test scenarios and many of the potential problems will be already identified and removed. And even if a new problem occurs, it is going to be relatively easy to narrow it down and eliminate the source of the problem in a short period of time. Sounds good, doesn’t it?</p>
<p>Well, before we go any further we need to define what the unit test is. This is the definition given to us by Wikipedia – a free on-line encyclopedia:</p>
<blockquote><p>In computer programming, a unit test is a procedure used to verify that a particular module of source code is working properly. The idea about unit tests is to write test cases for all functions and methods so that whenever a change causes a regression, it can be quickly identified and fixed.</p></blockquote>
<p>Personally, I am not completely satisfied with this definition, that&#8217;s why I came up with my own:</p>
<blockquote><p>A unit test is a software module that verifies the results of a single operation or a unit of functionality by emulating a user’s request and comparing the generated output with predefined data.</p></blockquote>
<p>The concept of unit testing is based on the same idea as using the embedded sensors to diagnose your car engine. Each unit test acts similar to those sensors – it verifies the correct execution of one single block of code and reports you whether it worked according to the expectations or not. The more sensors you have inside your code the better it is going to be in the future. They execute your program and compare the generated output with the previously defined data. If they match then test passes, otherwise the test fails and a message indicating the test failure will be displayed. That doesn’t look like something really difficult, right? In fact, making sure that your code passes the test is usually much easier than trying to find why your program doesn’t work.</p>
<p>Do you remember the old days when you had to take your car to the mechanics and they would spend hours trying to investigate why your car started to consume all this extra fuel? They would always be glad to do all this work for you, because at the end they would charge you for every minute they spent working on your car. The worst part of it was that once they told you they fixed, what they thought was broken, there was really no guarantee that they really fixed the problem instead of introducing a new one. And the next time you would come to them again and spend your time and money trying to get your car back in the shape.</p>
<p>Those of you who have had experience managing or coordinating the software projects will definitely see some similarities. How often do we find ourselves in the situation when we need to make a change to the code and simply can’t do this because we are not sure if this change is going to break some existing functionality? How often do we hear from software developers that it will take ten minutes to implement the required changes and another three or four hours (or even days) to complete the full system test? To make matters worse, imagine the situation when one of the core developers just quit the job. How can a new person, who was recently hired, tell if the change that is about to be implemented is going to break something else?</p>
<p>The answer to all this questions is – use automated test driven development process. Do not try to save money on testing your products. In the end, poorly written code represents a serious liability to the clients. It is much like manufacturing untested cars. You would not want to drive a car that never went through a crash test, right? If something goes badly, you might find yourself working on your resume a lot sooner that you had expected.</p>
<p>However, despite the obvious advantages and benefits that test driven development can provide for us, many people still remain suspicious. One of the most often used arguments against test driven development is: “I don’t have this extra time required to write tests”. Well, it is really easy to beat. All you need to do is ask them – how much time do you have to debug your code? Would you rather spend time and energy on debugging your code instead of writing the unit test? If the answer is yes then this person should probably consider doing something else other than software development.</p>
<p>Another very hard thing to do is to convince your management to allocate additional time and recourses to develop unit tests. This one is a little bit more difficult. Unfortunately, managers and especially those who don’t have any technical background often don’t see the benefits of writing the unit tests because, in their eyes, it is just another activity that programmers like to do. The best way to convince the management in this situation is to demonstrate in practice, using a real life example, how the test driven development can save time and money and at the same time improve the quality of the product. It is good to start with a small project and use it as a sand box to sharpen the required skills before going into the deep waters and starting to work on a large project. It is going to be a lot easier to receive managerial approval to try something new while developing a small module to enhance the exiting system than on a huge enterprise wide mission critical project.</p>
<p>There are number of tools that can help developers to utilize test driven development. Probably, the most well known is JUnit &#8211; a framework written in Java programming language. JUnit provides software developers with a set of predefined objects that can be extended for their purposes. JUnit is an open source project and available for download from its own web site: <a href="http://www.junit.org">www.junit.org</a>.</p>
<p>Without any doubts, one of the biggest advantages of JUnit is its tight integration with modern development tools. Almost every existing integrated development environment (IDE) for Java including Intellij IDEA, Eclipse, NetBeans, and JBuilder has a built-in JUnit test runner. Another significant advantage that JUnit gives to developers is the ability to run unit tests while building the projects using different build tools such as Ant, Maven, and Cruise Control. For those who can’t or simply don’t want to use Java there is a .NET port of JUnit framework called NUnit.</p>
<p>There are also many other tools and frameworks that can help developers to design and develop the unit tests for their projects. More information on this subject is available from <a href="http://www.junit.org">www.junit.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://garbuz.com/2010/07/30/unit-testing-101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

