<?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>Technology and Leadership</title>
	<atom:link href="http://technologyandleadership.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://technologyandleadership.com</link>
	<description>The intersection of Technology and Leadership</description>
	<lastBuildDate>Sat, 25 May 2013 00:56:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>EGIT &#8211; GIT in action within your Eclipse IDE</title>
		<link>http://technologyandleadership.com/egit-git-in-action-within-your-eclipse-ide/</link>
		<comments>http://technologyandleadership.com/egit-git-in-action-within-your-eclipse-ide/#comments</comments>
		<pubDate>Sat, 25 May 2013 00:56:34 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[GIT]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[download EGIT]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse Egit]]></category>
		<category><![CDATA[Eclipse IDE]]></category>
		<category><![CDATA[Eclipse Indigo]]></category>
		<category><![CDATA[Eclipse plugin]]></category>
		<category><![CDATA[eclipse workspace]]></category>
		<category><![CDATA[EGIT]]></category>
		<category><![CDATA[GIT repository]]></category>
		<category><![CDATA[http://download.eclipse.org/releases/indigo/]]></category>
		<category><![CDATA[Install EGIT]]></category>
		<category><![CDATA[Share Project]]></category>
		<category><![CDATA[workspace]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1370</guid>
		<description><![CDATA[This article presents two simple steps to place your eclipse workspace under GIT. EGIT is a plugin that allows you to use GIT directly within the Eclipse IDE. Step1: Installation of EGIT Navigate to Help  &#8211;&#62; Install New Software &#160; Type the URL from which the EGIT could be downloaded. Then, click select all and [...]]]></description>
				<content:encoded><![CDATA[<p>This article presents two simple steps to place your eclipse workspace under GIT. <strong>EGIT </strong>is a plugin that allows you to use GIT directly within the Eclipse IDE.</p>
<h2>Step1: Installation of EGIT</h2>
<p>Navigate to Help  &#8211;&gt; Install New Software</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/Step1help.png"><img class="alignnone size-full wp-image-1373" alt="Step1help" src="http://technologyandleadership.com/wp-content/uploads/2013/05/Step1help.png" width="324" height="338" /></a></p>
<p>&nbsp;</p>
<p>Type the URL from which the EGIT could be downloaded. Then, click select all and next.</p>
<p><a title=" http://download.eclipse.org/releases/indigo/" href=" http://download.eclipse.org/releases/indigo/">http://download.eclipse.org/releases/indigo/</a></p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/step3selectallnext.png"><img class="alignnone size-full wp-image-1381" alt="step3selectallnext" src="http://technologyandleadership.com/wp-content/uploads/2013/05/step3selectallnext.png" width="844" height="673" /></a></p>
<p>&nbsp;</p>
<p>Then Deselect All and select only <strong>&#8220;Eclipse Egit&#8221; </strong>and click on next.</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/step3bselecteclipseegit.png"><img class="alignnone size-full wp-image-1382" alt="step3bselecteclipseegit" src="http://technologyandleadership.com/wp-content/uploads/2013/05/step3bselecteclipseegit.png" width="842" height="667" /></a></p>
<p>After installation of EGIT, we need to configure GIT on Eclipse</p>
<p>&nbsp;</p>
<h2>Step2:  Configure your Eclipse project to use GIT</h2>
<p>Right click on your project in Eclipse. In the context menu, Choose<strong> Team &#8211;&gt; Share Project</strong></p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/Step4LocalRepository.png"><img class="alignnone size-full wp-image-1385" alt="Step4LocalRepository" src="http://technologyandleadership.com/wp-content/uploads/2013/05/Step4LocalRepository.png" width="533" height="233" /></a></p>
<p>&nbsp;</p>
<p>Then, select GIT in the <strong>Share Project </strong>menu</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/Step5SeletGIT.png"><img class="alignnone size-full wp-image-1386" alt="Step5SeletGIT" src="http://technologyandleadership.com/wp-content/uploads/2013/05/Step5SeletGIT.png" width="799" height="551" /></a></p>
<p>Then enter the name of your project and <strong>create a new GIT repository</strong> for the project</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/Step6CreateNewGITrepository.png"><img class="alignnone size-full wp-image-1387" alt="Step6CreateNewGITrepository" src="http://technologyandleadership.com/wp-content/uploads/2013/05/Step6CreateNewGITrepository.png" width="518" height="435" /></a></p>
<p>To view your project as a GIT repository within the Eclipse IDE, navigate to Windows &#8211;&gt; Show View &#8211;&gt; GIT &#8211;&gt; GIT Repositories</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/05/Step7ShowViewGITReo.png"><img class="alignnone size-full wp-image-1390" alt="Step7ShowViewGITReo" src="http://technologyandleadership.com/wp-content/uploads/2013/05/Step7ShowViewGITReo.png" width="308" height="443" /></a></p>
<p><em><strong>Now you can see your project placed under GIT version control and apply all the GIT commands from your Eclipse IDE!</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/egit-git-in-action-within-your-eclipse-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GIT merge conflict &#8211; commit your changes or stash them before you can merge</title>
		<link>http://technologyandleadership.com/git-merge-conflict-commit-your-changes-or-stash-them-before-you-can-merge/</link>
		<comments>http://technologyandleadership.com/git-merge-conflict-commit-your-changes-or-stash-them-before-you-can-merge/#comments</comments>
		<pubDate>Sat, 11 May 2013 07:32:45 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[GIT]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[--global]]></category>
		<category><![CDATA[3-way merge]]></category>
		<category><![CDATA[Automatic merge failed]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[changes]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[conflict]]></category>
		<category><![CDATA[DiffMerge]]></category>
		<category><![CDATA[difftool]]></category>
		<category><![CDATA[Failed to merge]]></category>
		<category><![CDATA[GIT Bash]]></category>
		<category><![CDATA[git config]]></category>
		<category><![CDATA[git difftool]]></category>
		<category><![CDATA[GIT environment]]></category>
		<category><![CDATA[GIT pull]]></category>
		<category><![CDATA[git pull --rebase]]></category>
		<category><![CDATA[GIT repository]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[merge conflict]]></category>
		<category><![CDATA[merge.tool]]></category>
		<category><![CDATA[mergetool.diffmerge.cmd]]></category>
		<category><![CDATA[mergetool.diffmerge.trustExitCode]]></category>
		<category><![CDATA[rebase]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[SourceGear]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1314</guid>
		<description><![CDATA[Here are the frequent GIT merge conflict horror stories one might encounter when one pulls the latest code changes or when the project code is rebased. If you are using GIT bash, its quite easy to configure the GIT environment with a visual GUI tool called DiffMerge that helps you clearly see the lines of [...]]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;">Here are the frequent GIT merge conflict horror stories one might encounter when one pulls the latest code changes or when the project code is rebased. If you are using GIT bash, its quite easy to configure the GIT environment with a visual GUI tool called <strong>DiffMerge</strong> that helps you <strong>clearly see the lines of code causing the conflict</strong> and resolve the merge conflict with a &#8220;single click&#8221;.</p>
<p><strong>Problem:</strong></p>
<p>Merge conflicts while doing <strong>git pull</strong><br />
<strong>Output 1:</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git pull</span>
Enter passphrase <span style="color: #000000; font-weight: bold;">for</span> key <span style="color: #ff0000;">'/c/Users/arvenkataraman/.ssh/id_rsa'</span>:
Auto-merging testSuite<span style="color: #000000; font-weight: bold;">/</span>sample.xml
CONFLICT <span style="color: #7a0874; font-weight: bold;">&#40;</span>content<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Merge conflict <span style="color: #000000; font-weight: bold;">in</span> testSuite<span style="color: #000000; font-weight: bold;">/</span>sample.xml
Automatic merge failed; fix conflicts and <span style="color: #000000; font-weight: bold;">then</span> commit the result.</pre></td></tr></table></div>

<p><strong>Output 2:</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git pull</span> <span style="color: #660033;">--rebase</span>
U       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample1.xml
U       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample2.xml
U       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample3.xml
M       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample4.xml
U       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample5.xml
U       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample6.xml
U       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample7.xml
M       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample8.xml
M       testSuite<span style="color: #000000; font-weight: bold;">/</span>sample9.xml
Pull is not possible because you have unmerged files.
Please, fix them up <span style="color: #000000; font-weight: bold;">in</span> the work <span style="color: #c20cb9; font-weight: bold;">tree</span>, and <span style="color: #000000; font-weight: bold;">then</span> use <span style="color: #ff0000;">'git add/rm '</span>
<span style="color: #c20cb9; font-weight: bold;">as</span> appropriate to mark resolution, or use <span style="color: #ff0000;">'git commit -a'</span>.</pre></td></tr></table></div>

<p><strong><br />
Output 3:</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git pull</span>
Falling back to patching base and <span style="color: #000000;">3</span>-way merge...
Auto-merging testSuite<span style="color: #000000; font-weight: bold;">/</span>sample.xml
CONFLICT <span style="color: #7a0874; font-weight: bold;">&#40;</span>content<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Merge conflict <span style="color: #000000; font-weight: bold;">in</span> testSuite<span style="color: #000000; font-weight: bold;">/</span> sample.xml 
Auto-merging testSuite<span style="color: #000000; font-weight: bold;">/</span>sample2.xml
CONFLICT <span style="color: #7a0874; font-weight: bold;">&#40;</span>content<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Merge conflict <span style="color: #000000; font-weight: bold;">in</span> testSuite<span style="color: #000000; font-weight: bold;">/</span> sample2.xml 
Auto-merging testSuite<span style="color: #000000; font-weight: bold;">/</span>sample3.xml
CONFLICT <span style="color: #7a0874; font-weight: bold;">&#40;</span>content<span style="color: #7a0874; font-weight: bold;">&#41;</span>: Merge conflict <span style="color: #000000; font-weight: bold;">in</span> testSuite<span style="color: #000000; font-weight: bold;">/</span> sample3.xml
Failed to merge <span style="color: #000000; font-weight: bold;">in</span> the changes.
Patch failed at 0001 <span style="color: #7a0874; font-weight: bold;">test</span> changes</pre></td></tr></table></div>

<h2></h2>
<h2><strong>Solution</strong></h2>
<p><strong><br />
</strong></p>
<h3>Step 1: Download DiffMerge tool</h3>
<p>The SourceGear DiffMerge tool could be downloaded from the below location:<br />
<a href="http://www.sourcegear.com/diffmerge/downloads.php ">http://www.sourcegear.com/diffmerge/downloads.php </a></p>
<p><strong><br />
</strong></p>
<h3>Step 2: Configure GIT to use DiffMerge tool</h3>
<p>Open GIT Bash and navigate to the GIT repository. Then give the below commands to configure GIT with the downloaded DiffMerge tool</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git config</span> <span style="color: #660033;">--global</span> merge.tool diffmerge
<span style="color: #c20cb9; font-weight: bold;">git config</span> <span style="color: #660033;">--global</span> mergetool.diffmerge.cmd <span style="color: #ff0000;">&quot;C:/<span style="color: #000099; font-weight: bold;">\&quot;</span>Program Files<span style="color: #000099; font-weight: bold;">\&quot;</span>/<span style="color: #000099; font-weight: bold;">\&quot;</span>SourceGear<span style="color: #000099; font-weight: bold;">\&quot;</span>/Common/DiffMerge/sgdm.exe --merge --result=<span style="color: #000099; font-weight: bold;">\$</span>MERGED <span style="color: #000099; font-weight: bold;">\$</span>LOCAL <span style="color: #000099; font-weight: bold;">\$</span>BASE <span style="color: #000099; font-weight: bold;">\$</span>REMOTE&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">git config</span> <span style="color: #660033;">--global</span> mergetool.diffmerge.trustExitCode <span style="color: #c20cb9; font-weight: bold;">true</span></pre></td></tr></table></div>

<p><strong><br />
</strong></p>
<h3>Step 3: Invoke DiffMerge from GIT bash</h3>
<p>&nbsp;</p>
<p><strong></strong><br />
If the git pull command doesn&#8217;t succeed due to merge conflict, please give the below command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git difftool</span></pre></td></tr></table></div>

<p>The DiffMerge opens up as below with automatically selected merge conflict files for comparison<br />
<a href="http://technologyandleadership.com/wp-content/uploads/2013/05/Step1mid2selectfiles.png"><img class="alignnone size-full wp-image-1330" alt="Step1mid2selectfiles" src="http://technologyandleadership.com/wp-content/uploads/2013/05/Step1mid2selectfiles.png" width="644" height="320" /></a><br />
<strong><br />
</strong></p>
<h3>Step 4: Shift the highlighted piece of code to resolve the merge conflict</h3>
<p>On the top of the DiffMerge tool there is an arrow to apply changes from the right to left:<br />
<a href="http://technologyandleadership.com/wp-content/uploads/2013/05/step2-DiffMerge-for-merge-conflict.png"><img class="alignnone size-full wp-image-1334" alt="step2 DiffMerge for merge conflict" src="http://technologyandleadership.com/wp-content/uploads/2013/05/step2-DiffMerge-for-merge-conflict.png" width="845" height="118" /></a><br />
The files are displayed side-by-side for comparision and the differential piece of code to be merged is highlighted in violet color:<br />
<a href="http://technologyandleadership.com/wp-content/uploads/2013/05/step3-Merge-changes.png"><img class="alignnone size-full wp-image-1335" alt="step3 Merge changes" src="http://technologyandleadership.com/wp-content/uploads/2013/05/step3-Merge-changes.png" width="930" height="401" /></a><br />
Select the piece of code highlighted and click on the <strong>&#8220;apply changes from the right&#8221;</strong> arrow at the top. After merge the code will look like below:<br />
<a href="http://technologyandleadership.com/wp-content/uploads/2013/05/step4-After-merge.png"><img class="alignnone size-full wp-image-1338" alt="step4 After merge" src="http://technologyandleadership.com/wp-content/uploads/2013/05/step4-After-merge.png" width="1035" height="362" /></a></p>
<p>Similarly we could resolve all the merge conflicts with a single click. It is a lot more easier since this is a visual tool for merge.</p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/git-merge-conflict-commit-your-changes-or-stash-them-before-you-can-merge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code debugging with watch variables/expression using Eclipse IDE</title>
		<link>http://technologyandleadership.com/code-debugging-with-watch-variablesexpression-using-eclipse-ide/</link>
		<comments>http://technologyandleadership.com/code-debugging-with-watch-variablesexpression-using-eclipse-ide/#comments</comments>
		<pubDate>Sat, 20 Apr 2013 03:22:10 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[breakpoint]]></category>
		<category><![CDATA[breakpoint properties]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debug mode]]></category>
		<category><![CDATA[debug variable]]></category>
		<category><![CDATA[debug with expressions in java]]></category>
		<category><![CDATA[debug with watch variable java]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Eclipse IDE]]></category>
		<category><![CDATA[expressions]]></category>
		<category><![CDATA[F6 Key]]></category>
		<category><![CDATA[Inspect]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[open perspective]]></category>
		<category><![CDATA[run]]></category>
		<category><![CDATA[Step Into]]></category>
		<category><![CDATA[Step Into Selection]]></category>
		<category><![CDATA[suspend]]></category>
		<category><![CDATA[suspend thread]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[toggle breakpoint]]></category>
		<category><![CDATA[watch expression java]]></category>
		<category><![CDATA[watch variable java]]></category>
		<category><![CDATA[watch variables]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1277</guid>
		<description><![CDATA[Here are the steps to do extensive debugging of java code using Eclipse IDE with watch variables, expression and Inspect. Step1: Enable breakpoint Set the breakpoint at the line of code or point of method entry from where you would like to start debugging the code. Right click on the left margin of the editor [...]]]></description>
				<content:encoded><![CDATA[<p>Here are the steps to do extensive debugging of java code using Eclipse IDE with <strong>watch variables, expression and Inspect.</strong></p>
<h2>Step1: Enable breakpoint</h2>
<p>Set the breakpoint at the line of code or point of method entry from where you would like to start debugging the code. Right click on the left margin of the editor next to the line of code and a context menu pops up. Select toggle breakpoint in the context menu as shown below:</p>
<p style="padding-left: 30px;">Figure1: Toggle Breakpoint</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step1-enableBreakpoint.png"><img class="alignnone size-full wp-image-1278" alt="Step1-enableBreakpoint" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step1-enableBreakpoint.png" width="354" height="312" /></a></p>
<p>&nbsp;</p>
<h2>Step2: Configure the breakpoint to stop execution</h2>
<p>To start debugging, the execution should stop at the breakpoint specified. For this click on breakpoint properties (refer Figure1)  and do the following:</p>
<ol>
<li>Check Hit count</li>
<li>Specify value as 1</li>
<li>Select &#8220;Suspend thread&#8221; option</li>
</ol>
<p>This will stop the execution when the program hits the breakpoint.</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step3setBreakpint2.png"><img class="alignnone size-full wp-image-1300" alt="Step3setBreakpint" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step3setBreakpint2.png" width="711" height="567" /></a></p>
<p>&nbsp;</p>
<h2>Step3: Switch to debug perspective</h2>
<p>In Eclipse, select Window &#8211;&gt;Open Perspective &#8211;&gt; Debug as shown below:</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step4-switch-to-debug-perspective.png"><img class="alignnone size-full wp-image-1281" alt="Step4 switch to debug perspective" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step4-switch-to-debug-perspective.png" width="376" height="302" /></a></p>
<p>&nbsp;</p>
<h2>Step4: Run in debug mode</h2>
<p>Now run the program in debug mode. Select Run &#8211;&gt; Debug</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step5-Run-in-debug-mode.png"><img class="alignnone size-full wp-image-1282" alt="Step5 Run in debug mode" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step5-Run-in-debug-mode.png" width="339" height="644" /></a></p>
<p>Now the program starts running in debug mode and you would see the state of the thread as &#8220;<strong>running&#8221;</strong></p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step6-running-thread.png"><img class="alignnone size-full wp-image-1283" alt="Step6 running thread" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step6-running-thread.png" width="390" height="73" /></a></p>
<p>When the program hits the breakpoint the state of the thread changes from &#8220;<strong>running</strong>&#8221; to &#8220;<strong>suspended</strong>&#8221;</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step7-suspend-thread.png"><img class="alignnone size-full wp-image-1284" alt="Step7 suspend thread" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step7-suspend-thread.png" width="301" height="75" /></a></p>
<p>&nbsp;</p>
<h2>Step5: Debugging the code with Expressions \Watch variables \ Inspect</h2>
<p>Now the code stops at the breakpoint. You could use the <strong>watch variables / expression</strong> <strong>to monitor the current value of the debug variable</strong>.</p>
<p>Suppose you set the breakpoint at the variable named &#8220;counter&#8221; and the program stopped at counter variable as shown below:</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/step8-stops-at-code.png"><img class="alignnone size-full wp-image-1285" alt="step8 stops at code" src="http://technologyandleadership.com/wp-content/uploads/2013/04/step8-stops-at-code.png" width="183" height="138" /></a>\</p>
<p>Add the expression with the variable name &#8220;counter&#8221; which allows you to monitor the value of the variable as you execute the program:</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step11-watch-variableexpressions.png"><img class="alignnone size-full wp-image-1286" alt="Step11 watch variableexpressions" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step11-watch-variableexpressions.png" width="419" height="115" /></a></p>
<p>You could also right click on the counter variable and select &#8220;<strong>Inspect</strong>&#8221; from the context menu</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step12-right-click-to-inspectstepinto.png"><img class="alignnone size-full wp-image-1287" alt="Step12 right click to inspectstepinto" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step12-right-click-to-inspectstepinto.png" width="226" height="139" /></a></p>
<p>If it is a method then, select the method name and click on &#8220;<strong>Step Into Selection</strong>&#8220;. <strong>This will allow you to monitor or debug the method execution line by line.</strong></p>
<p>&nbsp;</p>
<h2>Step6: Use F6 key to step into the method</h2>
<p>To &#8220;<strong>step into</strong>&#8221; the next executable line of code in the current method, press the &#8220;<strong>F6 Key&#8221;.</strong> This will pass the program control from the current line to the next executable line of code.<strong> </strong></p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/Step9-Press-F6-key.png"><img class="alignnone size-full wp-image-1288" alt="Step9 Press F6 key" src="http://technologyandleadership.com/wp-content/uploads/2013/04/Step9-Press-F6-key.png" width="185" height="107" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/code-debugging-with-watch-variablesexpression-using-eclipse-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git &#8211; Permission denied (publickey)</title>
		<link>http://technologyandleadership.com/git-permission-denied-publickey/</link>
		<comments>http://technologyandleadership.com/git-permission-denied-publickey/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 23:49:24 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[GIT]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[GIT repository]]></category>
		<category><![CDATA[git@github.com]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[id_rsa.pub]]></category>
		<category><![CDATA[Permission denied (publickey)]]></category>
		<category><![CDATA[public key]]></category>
		<category><![CDATA[public/private rsa key pair]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[rsa key pair]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[SSH Key]]></category>
		<category><![CDATA[ssh-keygen]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1252</guid>
		<description><![CDATA[This is a very common issue that most users face after installation of GIT. Extensive troubleshooting of this GIT issue &#8220;Git &#8211; Permission denied (publickey)&#8221; can be done with the below command: ssh -vT git@github.com Output: OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Connecting to github.com &#91;204.232.175.90&#93; port 22. debug1: Connection established. debug1: identity file [...]]]></description>
				<content:encoded><![CDATA[<p>This is a very common issue that most users face after installation of GIT.</p>
<p>Extensive troubleshooting of this GIT issue &#8220;Git &#8211; Permission denied (publickey)&#8221; can be done with the below command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-vT</span> <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>github.com</pre></td></tr></table></div>

<p>Output:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">OpenSSH_4.6p1, OpenSSL 0.9.8e <span style="color: #000000;">23</span> Feb <span style="color: #000000;">2007</span>
debug1: Connecting to github.com <span style="color: #7a0874; font-weight: bold;">&#91;</span>204.232.175.90<span style="color: #7a0874; font-weight: bold;">&#93;</span> port <span style="color: #000000;">22</span>.
debug1: Connection established.
debug1: identity <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>c<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>arvenkataraman<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>identity <span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #660033;">-1</span>
debug1: identity <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>c<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>arvenkataraman<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa <span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #660033;">-1</span>
debug1: identity <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>c<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>arvenkataraman<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_dsa <span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #000000;">2</span>
debug1: Remote protocol version <span style="color: #000000;">2.0</span>, remote software version OpenSSH_5.5p1 Debia
n-<span style="color: #000000;">6</span>+squeeze1+github9
debug1: match: OpenSSH_5.5p1 Debian-<span style="color: #000000;">6</span>+squeeze1+github9 pat OpenSSH<span style="color: #000000; font-weight: bold;">*</span>
debug1: Enabling compatibility mode <span style="color: #000000; font-weight: bold;">for</span> protocol <span style="color: #000000;">2.0</span>
debug1: Local version string SSH-<span style="color: #000000;">2.0</span>-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server-<span style="color: #000000; font-weight: bold;">&amp;</span>gt;client aes128-cbc hmac-md5 none
debug1: kex: client-<span style="color: #000000; font-weight: bold;">&amp;</span>gt;server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1024</span><span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000;">1024</span><span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000;">8192</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host <span style="color: #ff0000;">'github.com (204.232.175.90)'</span> can<span style="color: #ff0000;">'t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '</span>github.com,204.232.175.90<span style="color: #ff0000;">' (RSA) to the list of know
n hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/arvenkataraman/.ssh/identity
debug1: Trying private key: /c/Users/arvenkataraman/.ssh/id_rsa
debug1: Offering public key: /c/Users/arvenkataraman/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<h2>Solution:</h2>
<p>Step 1: Navigate to .ssh directory inside your home directory</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">         <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh</pre></td></tr></table></div>

<p>Step 2: Generate the public/private rsa key pair</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">         <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span></pre></td></tr></table></div>

<p>Step 3: Copy the <strong>SSH</strong> key to the clipboard using the below command</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">         <span style="color: #c20cb9; font-weight: bold;">cat</span> id_rsa.pub <span style="color: #000000; font-weight: bold;">|</span> clip</pre></td></tr></table></div>

<p>Step 4: Navigate to your GIT repository in <a href="https://github.com/">https://github.com/</a></p>
<p>Step 5: Go to Account Settings</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/accountsetting.png"><img class="alignnone size-full wp-image-1273" alt="accountsetting" src="http://technologyandleadership.com/wp-content/uploads/2013/04/accountsetting.png" width="260" height="95" /></a></p>
<p>Step 6: Under Account Setting select SSH keys</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/ssh.png"><img class="alignnone size-large wp-image-1274" alt="ssh" src="http://technologyandleadership.com/wp-content/uploads/2013/04/ssh-620x270.png" width="620" height="270" /></a></p>
<p>Step 7:  Click on Add SSH key, paste the key copied to the clipboard (in Step 3) and store the key</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2013/04/saveSSH.png"><img class="alignnone size-full wp-image-1275" alt="saveSSH" src="http://technologyandleadership.com/wp-content/uploads/2013/04/saveSSH.png" width="675" height="450" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/git-permission-denied-publickey/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TestNG &#8211; running tests in parallel</title>
		<link>http://technologyandleadership.com/testng-running-tests-in-parallel/</link>
		<comments>http://technologyandleadership.com/testng-running-tests-in-parallel/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 05:42:37 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[Test Automation Tools]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[annotation]]></category>
		<category><![CDATA[invocation-count]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[org.testng.TestNG]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[suite]]></category>
		<category><![CDATA[suiteThreadPoolSize]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[TestNG.xml]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[thread-count]]></category>
		<category><![CDATA[timeout]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1215</guid>
		<description><![CDATA[If you have several suites to be run, you could run them in parallel at the same time in different threads. Parallel suites In command line the ant task suiteThreadPoolSize can be used to run several suites in parallel using org.testng.TestNG as shown below: java org.testng.TestNG -suiteThreadPoolSize 3 testng1.xml testng2.xml testng3.xml This command runs the [...]]]></description>
				<content:encoded><![CDATA[<p>If you have several suites to be run, you could run them in parallel at the same time in different threads. </p>
<h2>Parallel suites</h2>
<p>In command line the ant task suiteThreadPoolSize can be used to run several suites in parallel using org.testng.TestNG as shown below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">java org.<span style="color: #006633;">testng</span>.<span style="color: #006633;">TestNG</span> <span style="color: #339933;">-</span>suiteThreadPoolSize <span style="color: #cc66cc;">3</span> testng1.<span style="color: #006633;">xml</span> testng2.<span style="color: #006633;">xml</span> testng3.<span style="color: #006633;">xml</span></pre></td></tr></table></div>

<p>This command runs the three suites in 3 different threads in parallel</p>
<h2>Parallel methods, tests, classes</h2>
<p>In testng.xml file, using the attribute <strong>parallel</strong> inside the suite tag instructs TestNG to runs tests in parallel in different threads. The attribute parallel accepts certain values as outlined below:<br />
</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mysuite&quot;</span> <span style="color: #000066;">parallel</span>=<span style="color: #ff0000;">&quot;methods&quot;</span> <span style="color: #000066;">thread-count</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mysuite&quot;</span> <span style="color: #000066;">parallel</span>=<span style="color: #ff0000;">&quot;tests&quot;</span> <span style="color: #000066;">thread-count</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mysuite&quot;</span> <span style="color: #000066;">parallel</span>=<span style="color: #ff0000;">&quot;classes&quot;</span> <span style="color: #000066;">thread-count</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mysuite&quot;</span> <span style="color: #000066;">parallel</span>=<span style="color: #ff0000;">&quot;instances&quot;</span> <span style="color: #000066;">thread-count</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>

<p>1. <strong>parallel=&#8221;methods&#8221;</strong>: TestNG will run all the test methods in parallel in different threads. The dependent methods will also run in different threads but would respect the order that was specified.<br />
2. <strong>parallel=&#8221;tests&#8221;</strong>: TestNG will run all the methods in the same test in the same thread but each test will be run in separate threads. This allows to group the thread-safe classes in the same test so that they will run in the same thread while taking advantage of TestNG&#8217;s capability to run tests in several threads.<br />
3. <strong>parallel=&#8221;classes&#8221;</strong>: TestNG will run all the test methods in the same class in the same thread and each class will be run in separate thread.<br />
4. <strong>parallel=&#8221;instances&#8221;</strong>: TestNG will run all the test methods in the same instance in the same thread and each instance will be run in separate threads.</p>
<p>Also, the attribute <strong>threadPoolSize</strong> of the @Test annotation could be used to run tests in parallel as shown below.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@Test<span style="color: #009900;">&#40;</span>threadPoolSize<span style="color: #339933;">=</span><span style="color: #cc66cc;">5</span>, invocation<span style="color: #339933;">-</span>count<span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span>, timeout<span style="color: #339933;">=</span><span style="color: #cc66cc;">10000</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testMethod<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This will invoke the method testMethod 10 times in 5 different threads. The timeout of 10 seconds ensures that the thread is not blocked for more than 10 seconds. The timout applies for both parallel and non-parallel mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/testng-running-tests-in-parallel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestNG groups using include/exclude</title>
		<link>http://technologyandleadership.com/testng-groups-using-includeexclude/</link>
		<comments>http://technologyandleadership.com/testng-groups-using-includeexclude/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 00:42:26 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[exclude]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[suite]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[test method]]></category>
		<category><![CDATA[TestNG annotation]]></category>
		<category><![CDATA[TestNG.xml]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1178</guid>
		<description><![CDATA[TestNG allows to perform groupings of test methods. The methods can be declared to belong to groups and TestNG can be invoked to include/exclude certain set of groups. This provides maximum flexibility to structure the tests in a more intuitive way. Step1: Declare groups in java class Suppose we would like to group the test [...]]]></description>
				<content:encoded><![CDATA[<p>TestNG allows to perform groupings of test methods. The methods can be declared to belong to groups and TestNG can be invoked to include/exclude certain set of groups. This provides maximum flexibility to structure the tests in a more intuitive way.</p>
<h2>Step1: Declare groups in java class</h2>
<p>Suppose we would like to group the test methods into two categories functional and sanity. We declare the methods to belong to either of the two groups using the <strong>&#8220;groups&#8221; </strong>attribute of @Test annotation.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test1
<span style="color: #009900;">&#123;</span>
  @Test<span style="color: #009900;">&#40;</span>groups<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;functional&quot;</span>,<span style="color: #0000ff;">&quot;sanity&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testMethod1<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Test<span style="color: #009900;">&#40;</span>groups<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;sanity&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testMethod2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Test<span style="color: #009900;">&#40;</span>groups<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;functional&quot;</span>,<span style="color: #0000ff;">&quot;sanity&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testMethod3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<h2>Step2: Specify groups in TestNG.xml file</h2>
<p>Suppose we would like to run the sanity tests alone. We specify the groups in the TestNG.xml file using the &lt;groups&gt; tag inside the &lt;suite&gt; or &lt;test&gt; tag as shown below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mySuite&quot;</span> <span style="color: #000066;">verbose</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Regression&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groups<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;run<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sanity&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/run<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groups<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;class</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sample.Test1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/test<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/suite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/testng-groups-using-includeexclude/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestNG.xml &#8211; A Quick Overview</title>
		<link>http://technologyandleadership.com/testng-xml-a-quick-overview/</link>
		<comments>http://technologyandleadership.com/testng-xml-a-quick-overview/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 00:19:19 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[Test Automation Tools]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[annotation]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[suite]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[TestNG.xml]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1147</guid>
		<description><![CDATA[TestNG is a testing framework designed to simplify the testing needs. &#160; Quick overview of TestNG.xml file A suite is an xml file represented by &#60;suite&#62; tag. The TestNG suite can contain one or more TestNG tests A test is represented by the &#60;test&#62; tag. A TestNG test can contain one or more TestNG classes [...]]]></description>
				<content:encoded><![CDATA[<p>TestNG is a testing framework designed to simplify the testing needs.</p>
<p>&nbsp;</p>
<h2>Quick overview of TestNG.xml file</h2>
<ul>
<li>A <strong>suite</strong> is an xml file represented by &lt;suite&gt; tag. The TestNG suite can contain one or more TestNG tests</li>
<li>A <strong>test </strong>is represented by the &lt;test&gt; tag. A TestNG test can contain one or more TestNG classes</li>
<li>A <strong>class</strong> is a java class having TestNG annotations. It is represented by the &lt;class&gt; tag. A TestNG class can contain one or more TestNG methods</li>
<li>A <strong>method</strong> is method configured with @Test annotation</li>
</ul>
<p>&nbsp;</p>
<h2>Sample TestNG.xml file</h2>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;</pre></td></tr></table></div>

<p>Also, it is possible to use packages instead of classes in TestNG.xml file. For this package tag is used as shown below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/testng-xml-a-quick-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Ruby on Rails</title>
		<link>http://technologyandleadership.com/getting-started-with-ruby-on-rails/</link>
		<comments>http://technologyandleadership.com/getting-started-with-ruby-on-rails/#comments</comments>
		<pubDate>Sat, 24 Nov 2012 03:54:03 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[advantages of rails]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[aptana studio]]></category>
		<category><![CDATA[bundle install]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[gemfile]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[jquery-rails]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[model-view-controller architecture]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails new]]></category>
		<category><![CDATA[ruby gem]]></category>
		<category><![CDATA[script/rails]]></category>
		<category><![CDATA[sqlite3]]></category>
		<category><![CDATA[vendor]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1076</guid>
		<description><![CDATA[Video demonstration of ruby on rails application creation: One of the many advantages of rails is that it immediately gets you from zero to a functional application. To get started lets create a directory for the rails project called &#8220;railsproject&#8221;. mkdir railsproject Now open the ruby command prompt and navigate to the directory that we [...]]]></description>
				<content:encoded><![CDATA[<h2>Video demonstration of ruby on rails application creation:</h2>
<p><iframe src="http://www.youtube.com/embed/4nGkCTp4ezE" frameborder="0" width="560" height="315"></iframe></p>
<p style="text-align: justify;">One of the many advantages of rails is that it immediately gets you from zero to a functional application. To get started lets create a directory for the rails project called &#8220;railsproject&#8221;.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> railsproject</pre></td></tr></table></div>

<p style="text-align: justify;">Now open the ruby command prompt and navigate to the directory that we just created. Run the rails new command to make your first rails application. Let us call our first rails application as &#8220;first&#8221;. The<strong> rails new</strong> command is a program that creates a skeleton rails application. It creates a standard file and directory structure that makes it easier than ever to organize and deploy files. All the rails application have a common file and directory structure making it easy to understand someone else&#8217;s code.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="rails" style="font-family:monospace;">rails <span style="color:#5A0A0A; font-weight:bold;">new</span> <span style="color:#5A0A0A; font-weight:bold;">first</span></pre></td></tr></table></div>

<p style="text-align: justify;">After the file creation is done rails automatically runs the <strong>bundle install</strong> command which we will discuss later in this article. Upon successful execution of the <strong>rails new </strong>command, it will display the message &#8220;Your bundle is complete!&#8221;</p>
<h3>Output:</h3>
<div id="attachment_1091" class="wp-caption alignnone" style="width: 630px"><a href="http://technologyandleadership.com/wp-content/uploads/2012/11/rubyonrailsbundleinstall1.png"><img class="size-large wp-image-1091" title="rubyonrailsbundleinstall" src="http://technologyandleadership.com/wp-content/uploads/2012/11/rubyonrailsbundleinstall1-620x599.png" alt="" width="620" height="599" /></a><p class="wp-caption-text">Bundle install command</p></div>
<p>&nbsp;</p>
<p>Now lets have a quick look into the files and directories that have just been created. I use Aptana studio, an IDE for windows users of Rails.</p>
<div id="attachment_1087" class="wp-caption alignnone" style="width: 327px"><a href="http://technologyandleadership.com/wp-content/uploads/2012/11/filestructure.png"><img class="size-full wp-image-1087" title="filestructure" src="http://technologyandleadership.com/wp-content/uploads/2012/11/filestructure.png" alt="" width="317" height="500" /></a><p class="wp-caption-text">Rails application directory structure</p></div>
<p>&nbsp;</p>
<p>Let&#8217;s learn more about the files that have been created.</p>
<ul>
<li style="text-align: justify;"><strong>app</strong> &#8211; This contains the Core application code including the <strong>models, views, controllers</strong> and helpers. The model, view and controller are very important parts of a rails architecture which we would learn in-depth in the later articles</li>
<li style="text-align: justify;"><strong>script/rails</strong> -A script to generate code and start the local server</li>
<li style="text-align: justify;"><strong>vendor &#8211; </strong>This contains third party code such as plugins and gems</li>
<li style="text-align: justify;"><strong>Gemfile</strong> &#8211; This file contains the gem requirements of the application</li>
</ul>
<p style="text-align: justify;">The <strong>bundle install</strong> or the <strong>bundler</strong> command which we had seen in the beginning of this article installs the gems from the Gemfile. The bundler looks for the gems that needs to be installed from this file. Thus the Gemfil should contain the gems needed by your application.</p>
<p>Gemfile:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="rails" style="font-family:monospace;">source <span style="color:#996600;">'https://rubygems.org'</span>
&nbsp;
gem <span style="color:#996600;">'rails'</span>, <span style="color:#996600;">'3.2.8'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Bundle edge Rails instead:</span>
<span style="color:#008000; font-style:italic;"># gem 'rails', :git =&amp;gt; 'git://github.com/rails/rails.git'</span>
&nbsp;
gem <span style="color:#996600;">'sqlite3'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Gems used only for assets and not required</span>
<span style="color:#008000; font-style:italic;"># in production environments by default.</span>
group <span style="color:#ff3333; font-weight:bold;">:assets</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  gem <span style="color:#996600;">'sass-rails'</span>,   <span style="color:#996600;">'~&amp;gt; 3.2.3'</span>
  gem <span style="color:#996600;">'coffee-rails'</span>, <span style="color:#996600;">'~&amp;gt; 3.2.1'</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># See https://github.com/sstephenson/execjs#readme for more supported runtimes</span>
  <span style="color:#008000; font-style:italic;"># gem 'therubyracer', :platforms =&amp;gt; :ruby</span>
&nbsp;
  gem <span style="color:#996600;">'uglifier'</span>, <span style="color:#996600;">'&amp;gt;= 1.0.3'</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
gem <span style="color:#996600;">'jquery-rails'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># To use ActiveModel has_secure_password</span>
<span style="color:#008000; font-style:italic;"># gem 'bcrypt-ruby', '~&amp;gt; 3.0.0'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># To use Jbuilder templates for JSON</span>
<span style="color:#008000; font-style:italic;"># gem 'jbuilder'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Use unicorn as the app server</span>
<span style="color:#008000; font-style:italic;"># gem 'unicorn'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Deploy with Capistrano</span>
<span style="color:#008000; font-style:italic;"># gem 'capistrano'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># To use debugger</span>
<span style="color:#008000; font-style:italic;"># gem 'debugger'</span></pre></td></tr></table></div>

<p style="text-align: justify;">Inside the gemfile, the <strong>rails </strong> gem is the gem for rails itself. &#8220;sqlite3&#8243; is the gem for the ruby interface to the SQLite database. &#8221;jquery-rails&#8221;  is for the jQuery javascript library. As you could notice there is a version 3.2.8 specified in the rails gem command. Unless the version is explicitly specified, rails automatically deploys the latest version of that gem.<strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/getting-started-with-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inheritance &#8211; the Ace of the Object Oriented Programming world</title>
		<link>http://technologyandleadership.com/inheritance-the-ace-of-the-object-oriented-programming-world/</link>
		<comments>http://technologyandleadership.com/inheritance-the-ace-of-the-object-oriented-programming-world/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 18:16:16 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[base class]]></category>
		<category><![CDATA[break]]></category>
		<category><![CDATA[child class]]></category>
		<category><![CDATA[derived class]]></category>
		<category><![CDATA[extends]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[object oriented programming]]></category>
		<category><![CDATA[parent class]]></category>
		<category><![CDATA[Reusability]]></category>
		<category><![CDATA[reuse]]></category>
		<category><![CDATA[sub class]]></category>
		<category><![CDATA[super]]></category>
		<category><![CDATA[super class]]></category>
		<category><![CDATA[switch case]]></category>
		<category><![CDATA[system.out.format]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=1026</guid>
		<description><![CDATA[The code is just a junkyard if it is not designed for reuse. Re-usability is very simple if you understand inheritance, a very powerful principle of object oriented programming. For this reason I call inheritance the Ace of the object-oriented programming world. Here, I explain inheritance with a simple illustration. From the figure below can [...]]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;">The code is just a junkyard if it is not designed for reuse. Re-usability is very simple if you understand <strong>inheritance</strong>, a very powerful principle of object oriented programming. For this reason I call inheritance the Ace of the object-oriented programming world.</p>
<p style="text-align: justify;">Here, I explain inheritance with a simple illustration. From the figure below can you list the properties that are common to all the balloons?</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2011/08/balloons1.png"><img class="alignnone size-large wp-image-1029" title="balloons" src="http://technologyandleadership.com/wp-content/uploads/2011/08/balloons1-620x404.png" alt="" width="620" height="404" /></a></p>
<p>&nbsp;</p>
<p align="JUSTIFY"><span style="color: #000000;">The below properties are common to every balloon:</span></p>
<ol>
<li>Color</li>
<li>Size</li>
<li>Price and so on</li>
</ol>
<p style="text-align: justify;">These properties that are common to all classes of a given type say balloon is stored in a class called the <strong>base class or super class or parent class</strong>. <strong>Inheritance is a powerful object oriented programming feature that allows a class to reuse the properties and methods of an already existing class while adding its own functionality.</strong> It&#8217;s the process of creating a new class as an <strong>extension</strong> of an existing class primarily to enhance the code re-usability. The class that extends is called the <strong>derived / sub class</strong> and the class getting extended is called the <strong>super / base class</strong>.</p>
<p align="JUSTIFY"><strong> </strong>Suppose there is a super class called superBalloon. There are different kinds of balloons such as birthday balloons, balloons that represent a theme like sports or Disneyland and so on. For class inheritance java uses the keyword <strong>extends. </strong>Now let&#8217;s write a small java program for the base class &#8220;superBalloon&#8221;.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">balloonInherit</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> superBalloon
<span style="color: #009900;">&#123;</span>
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * The superBalloon class defines methods and variables common to all balloons such as
	 * size, color and price
	 */</span>
	<span style="color: #666666; font-style: italic;">//commonly used fields in all balloons</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> size<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> color<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">double</span> price<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> number_of_balloons_purchased<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">double</span> total_cost<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> purchase<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span> price, <span style="color: #000066; font-weight: bold;">int</span> number_of_balloons_purchased<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		total_cost <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>price <span style="color: #339933;">*</span> number_of_balloons_purchased<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: justify;"><strong>A derived class is more specific and can have additional functionality of its own apart from that of the base class.</strong> Thus a birthday balloon is a specialized version of the balloon class having a new field called decoration cost specific to it&#8217;s type to better suit the needs.</p>
<p style="text-align: justify;"><a href="http://technologyandleadership.com/wp-content/uploads/2011/08/bday.png"><img class="alignnone size-full wp-image-1048" title="bday" src="http://technologyandleadership.com/wp-content/uploads/2011/08/bday.png" alt="" width="467" height="570" /></a></p>
<p style="text-align: justify;">We can also <strong>override /replace</strong> the behavior of the base class in the derived class. Here, in the below example the birthday balloon inherits the superBalloon class and defines a new field called decoration cost specific to it&#8217;s kind. We use the <strong>super </strong>keyword to reuse the already existing properties of the base class.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">balloonInherit</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> subPartyBalloon <span style="color: #000000; font-weight: bold;">extends</span> superBalloon
<span style="color: #009900;">&#123;</span>
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Since this is a partyBalloon, an additional new field called decoration cost is added
	 * which is specific to this kind of balloon
	 */</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//Create an object for subPartyBalloon class and invoke the purchase method</span>
                subPartyBalloon bDayBalloon <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> subPartyBalloon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		bDayBalloon.<span style="color: #006633;">purchase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> purchase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//Additional property specific to the type partyBalloon</span>
		<span style="color: #000066; font-weight: bold;">double</span> decoration_cost <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2.00</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Reuse the existing properties of the base class using super keyword</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">size</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">number_of_balloons_purchased</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">color</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;red&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//These are the prices of the balloon depending on it's size</span>
		<span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">:</span>
				<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">price</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5.00</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">:</span>
				<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">price</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10.00</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">:</span>
				<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">price</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15.00</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
				<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Invalid size&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Invoke the the purchase methods of the super class to calculate the base_cost</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">purchase</span><span style="color: #009900;">&#40;</span>price,number_of_balloons_purchased<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Since it is a birthday party balloon the additional cost for decoration is added</span>
		total_cost <span style="color: #339933;">=</span> total_cost <span style="color: #339933;">+</span> decoration_cost<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The total cost of %d %s birthday balloons is %.2f&quot;</span>, number_of_balloons_purchased,color,total_cost<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: justify;"><span style="color: #000000;">The switch-case control structure decides the price of the balloon based on the input size. Once a matching size is found it assigns value to the price variable and breaks the execution of the switch-case block. The total cost of the birthday balloons is calculated and the output is as below.</span></p>
<p><strong><span style="color: #008000;">OUTPUT:</span></strong></p>
<p>The total cost of 3 red birthday balloons is 32.00</p>
<p style="text-align: justify;">Now let&#8217;s create a java program for another derived class called subThemeBalloon. A theme based balloon has theme and design as additional fields specific to it&#8217;s kind. For example to represent the theme of Disneyland, a balloon is designed with the theme Disneyland and with the shape Mickey mouse.</p>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2011/08/themebasedBalloons3.png"><img class="alignnone size-large wp-image-1055" title="themebasedBalloons3" src="http://technologyandleadership.com/wp-content/uploads/2011/08/themebasedBalloons3-620x413.png" alt="" width="620" height="413" /></a></p>
<p style="text-align: justify;">The subThemeBalloon class reuses the existing properties of the base class superBalloon using the <strong>super</strong> keyword. It also has three additional new fields viz. theme, design and decoration cost specific to it&#8217;s kind to better suit the needs.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">balloonInherit</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> subThemeBalloon <span style="color: #000000; font-weight: bold;">extends</span> superBalloon
<span style="color: #009900;">&#123;</span>
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * A theme based balloon has theme and design as additional fields. For example to represent
	 * the theme of Disneyland a balloon is designed with the theme Disneyland and with
	 * the shape mickey mouse
	 **/</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
                <span style="color: #666666; font-style: italic;">//Create an object of subThemeBalloon class and invoke the purchase method</span>
                subThemeBalloon themeBalloon <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> subThemeBalloon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		themeBalloon.<span style="color: #006633;">purchase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> purchase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//Declare three additional properties that are specific to the type themeBalloon</span>
		<span style="color: #003399;">String</span> theme <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Disneyland&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> design <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Mickey Mouse&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> decoration_cost <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Reuse the existing properties of the base class using super keyword</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">number_of_balloons_purchased</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">price</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15.00</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Invoke the purchase method of the base balloon class to calculate base cost using super keyword</span>
		<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">purchase</span><span style="color: #009900;">&#40;</span>price, number_of_balloons_purchased<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Add the decoration cost for the balloon</span>
		total_cost <span style="color: #339933;">=</span> total_cost <span style="color: #339933;">+</span> decoration_cost<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Print the total cost of the balloon</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The total cost of a %s %s balloon is %.2f&quot;</span>, theme, design, total_cost<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong><span style="color: #008000;">OUTPUT:</span></strong></p>
<p>The total cost of a Disneyland Mickey Mouse balloon is 305.00<br />
<strong></strong></p>
<p>&nbsp;</p>
<p>This is all about inheritance. Feel free to post any comments /questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/inheritance-the-ace-of-the-object-oriented-programming-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>30-feet view of test automation framework with selenium</title>
		<link>http://technologyandleadership.com/30-feet-view-of-test-automation-framework-with-selenium/</link>
		<comments>http://technologyandleadership.com/30-feet-view-of-test-automation-framework-with-selenium/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 19:28:58 +0000</pubDate>
		<dc:creator>Aruna</dc:creator>
				<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[Test Automation Tools]]></category>
		<category><![CDATA[assertEquals]]></category>
		<category><![CDATA[assertTrue]]></category>
		<category><![CDATA[automate faster]]></category>
		<category><![CDATA[data driven testing]]></category>
		<category><![CDATA[DefaultSelenium]]></category>
		<category><![CDATA[higly maintainable test suite]]></category>
		<category><![CDATA[HttpCommandProcessor]]></category>
		<category><![CDATA[modular testing framework]]></category>
		<category><![CDATA[Modularization]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[selenium java client driver]]></category>
		<category><![CDATA[Selenium RC]]></category>
		<category><![CDATA[Selenium Remote Control]]></category>
		<category><![CDATA[selenium test automation]]></category>
		<category><![CDATA[Selenium.getTitle]]></category>
		<category><![CDATA[Selenium.isTextPresent]]></category>
		<category><![CDATA[selenium.open]]></category>
		<category><![CDATA[selenium.start]]></category>
		<category><![CDATA[selenium.waitForPageToLoad]]></category>
		<category><![CDATA[setup selenium test automation framework]]></category>
		<category><![CDATA[setup test environment for selenium]]></category>
		<category><![CDATA[start selenium server]]></category>
		<category><![CDATA[step-by-step]]></category>
		<category><![CDATA[step-by-step Selenium RC setup]]></category>
		<category><![CDATA[test automation]]></category>
		<category><![CDATA[test automation framework]]></category>
		<category><![CDATA[test data]]></category>
		<category><![CDATA[test execution]]></category>
		<category><![CDATA[test setup with selenium]]></category>
		<category><![CDATA[testing practices]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[writing a selenium test case]]></category>

		<guid isPermaLink="false">http://technologyandleadership.com/?p=938</guid>
		<description><![CDATA[Is selenium the future of test automation? That leads us to yet another important question, what was the past of test automation? Well&#8230;,I was just kidding. There are numerous amazing test automation tools out there but none of them could takeover the field of test automation. Why? It&#8217;s because, when you take a closer look [...]]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;"><span style="color: #000000;">Is selenium the future of test automation? That leads us to yet another important question, what was the past of test automation? Well&#8230;,I was just kidding. There are numerous amazing test automation tools out there but none of them could takeover the field of test automation. Why? <strong>It&#8217;s because, when you take a closer look at any testing project, the complexity increases so much that it takes a real tester with highly sophisticated testing practices and coding skills more than a mere tool to handle those situations. </strong>Yes, any tool no matter how good it is, cannot simply provide the foundation for a sound test automation framework. It is we, the “testers”, who can do it! But how?</span></p>
<p style="text-align: justify;"><span style="color: #000000;">This article shows step-by-step how selenium with a hybrid of other tools and practices could be used by the tester to develop a <em><strong>highly maintainable, robust, sophisticated and sound test automation framework.</strong></em></span></p>
<p style="text-align: justify;"><span style="color: #000000;"><em><strong><a href="http://technologyandleadership.com/wp-content/uploads/2011/07/30feetview.png"><img class="alignnone size-full wp-image-941" title="30feetview" src="http://technologyandleadership.com/wp-content/uploads/2011/07/30feetview.png" alt="" width="660" height="456" /></a></strong></em></span></p>
<p>&nbsp;</p>
<p><span style="color: #000000;">This article gives a 30-feet overview of how a test automation framework with selenium looks like.</span></p>
<p>&nbsp;</p>
<h2><span style="color: #800000;"><strong>The little secrets of test automation:</strong></span></h2>
<p style="text-align: justify;"><span style="color: #000000;"><strong>Would you be interested to know how I can automate tests in just six weeks while others usually take over six months? I automate far faster and much cheaper than anyone else can do!</strong> Come on, my little secrets are so little.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Often in a testing project we tend to handle things in our own way that we see fit. The delicate test automation framework gets upset due to these gimmicks. Let me introduce you to the few main things that really counts during test automation:</span></p>
<ol>
<li style="text-align: justify;"><span style="color: #000000;">Customer focus</span></li>
<li style="text-align: justify;"><span style="color: #000000;">Easy-to-understand test case listing the user actions</span></li>
<li style="text-align: justify;"><span style="color: #000000;">Decoupling of test data from test execution</span></li>
<li style="text-align: justify;"><span style="color: #000000;">Intelligent exception handling</span></li>
<li style="text-align: justify;"><span style="color: #000000;">Data-driven testing framework</span></li>
<li style="text-align: justify;"><span style="color: #000000;">Modular testing framework </span></li>
<li>
<p style="text-align: justify;"><span style="color: #000000;">Separation of test verification from test script</span></p>
</li>
</ol>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><span style="color: #000000;">Even if you are new to automation you can easily get a hang of it as you follow the steps outlined. Let me illustrate these principles with a simple demo. </span></p>
<p><strong>Pre-requisites: </strong></p>
<p>To execute the practical demonstration in this article we require the installation of <strong>JDK, Selenium Server, Selenium client driver for java, ant, TestNG, eclipse and TestNG plugin for eclipse.</strong></p>
<p><span style="color: #000000;">For installation/setting up of Selenium, please refer the article “</span><a href="http://technologyandleadership.com/selenium-rc-configuration-for-java-%E2%80%93-all-in-a-nutshell/" target="_blank">Selenium RC configuration for java – all in a nutshell</a><span style="color: #000000;">”. </span></p>
<p>In this demo I am using Ubuntu as platform. You could use your favorite platform for coding. So, let us walkthrough the steps for developing a robust and highly maintainable test automation framework with selenium.</p>
<p>&nbsp;</p>
<h2 style="text-align: justify;"><span style="color: #800000;"><strong>Step 1: Create java project and add references to external jars:</strong></span></h2>
<p style="text-align: justify;"><span style="color: #000000;">Suppose we want to dress perfectly for the weather with a rain hat, a rain coat and an umbrella. Now let&#8217;s develop a selenium test automation framework to test a very simple application that I have created called <strong>Weather Monster </strong>- “<a href="http://weathermonster.heroku.com/microposts">http://weathermonster.heroku.com/</a>”.</span></p>
<ol>
<li style="text-align: justify;"><span style="color: #000000;">Open eclipse → Create a new java project called <strong>weatherMonster</strong></span></li>
<li style="text-align: justify;"><span style="color: #000000;">Click on Next button → click on the Libraries tab</span></li>
<li style="text-align: justify;"><span style="color: #000000;">Click on <strong>Add External JARs</strong> button and add the respective jar files for selenium server, selenium java client driver and TestNG as shown in the diagram below → Click Finish</span></li>
</ol>
<p><a href="http://technologyandleadership.com/wp-content/uploads/2011/07/addreferences.png"><img class="alignnone size-full wp-image-951" title="addreferences" src="http://technologyandleadership.com/wp-content/uploads/2011/07/addreferences.png" alt="" width="614" height="326" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2><span style="color: #800000;"><strong>Step 2: Automatic configuration of test environment</strong></span></h2>
<p style="text-align: justify;"><span style="color: #000000;"><strong>A configuration script contains the key value pair needed to setup the test environment. </strong>These values could be changed dynamically using a shell script.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Let&#8217;s create a shell script to dynamically start the selenium server.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Create a new folder called “config” in the weatherMonster project and place the below shell script named<strong> config.sh</strong> in it.</span></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>installable<span style="color: #000000; font-weight: bold;">/</span>selenium<span style="color: #000000; font-weight: bold;">/</span>jar\ files<span style="color: #000000; font-weight: bold;">/</span>
gnome-terminal <span style="color: #660033;">--title</span>=<span style="color: #ff0000;">&quot;config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;java -jar selenium-server-standalone-2.0rc2.jar&quot;</span></pre></td></tr></table></div>

<p style="text-align: justify;">This shell script navigates to the folder path containing the selenium server jar file (Replace this path with respective path on your machine). It then opens a new GNOME-TERMINAL named config and runs the selenium server by execution of the command “java -jar selenium-server-standalone-2.0rc2.jar”</p>
<p style="text-align: justify;">To grant execution privileges to the script use chmod command as below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">777</span> config.sh</pre></td></tr></table></div>

<p style="text-align: justify;">Then run the script using the below command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>config.sh</pre></td></tr></table></div>

<p style="text-align: justify;"><strong>We need to run this script each time before test suite execution to start the selenium server.</strong></p>
<p style="text-align: justify;">Right click the src folder and create a package named config. Right click the config package and create a java class called seleniumTest.java</p>
<p style="text-align: justify;">Let&#8217;s assign values to the <strong>environment variables</strong> such as host, port, browser and so on.<br />
Since we <strong>do not want to hard code the test data</strong> and we would like to <strong>decouple test data from test execution</strong> let&#8217;s assign the test data to the variables separately in the config folder and organize them as shown below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">config</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.thoughtworks.selenium.DefaultSelenium</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.thoughtworks.selenium.HttpCommandProcessor</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> seleniumTest
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">/*Environment variables*/</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> HOST <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> PORT <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4444</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> BROWSER <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;firefox&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> BASE_URL <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://weathermonster.heroku.com&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//To set the baseURL and server port</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> HttpCommandProcessor PROC <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpCommandProcessor<span style="color: #009900;">&#40;</span>HOST,PORT, BROWSER, BASE_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//To create a selenium object for passing as variable</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> DefaultSelenium Selenium <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DefaultSelenium<span style="color: #009900;">&#40;</span>PROC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*Timeout*/</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> TIMEOUT<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;60000&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*Weather Monster home page*/</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> HOME_MSG <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;This is weathermonster, bringing you the weather&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> HOME_PAGETITLE <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Weather Monster&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<h2><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><span style="color: #800000;"><strong>Step 3: Modularization of commonly used methods</strong></span></h2>
<p style="text-align: justify;"><span style="color: #000000;">A module is a <strong>small independent script</strong> that represents AUT(Application Under Test). The most commonly used methods in the test case should be created as modules in separate folders that can be called and reused by many test cases. This increases the maintainability of the test suite. If there is a change, it needs to be applied only in one single place as opposed to all the places thus saving lots of time and cost.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Modularization also makes the test case <strong>easy-to-read and understand</strong>.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Consider the below test automation code. Can you understand it? It is a <strong>technical stack containing all the configuration details which is very hard to understand.</strong></span></p>
<p style="text-align: justify;"><span style="color: #000000;"><strong><a href="http://technologyandleadership.com/wp-content/uploads/2011/07/bad.png"><img class="alignnone size-full wp-image-961" title="bad" src="http://technologyandleadership.com/wp-content/uploads/2011/07/bad.png" alt="" width="649" height="127" /></a></strong></span></p>
<p>&nbsp;</p>
<p style="text-align: justify;"><span style="color: #000000;"><strong>The test case should list the user actions not the technical details. This makes the test case customer-focused and easy-to-read. </strong>Now, let&#8217;s move out all the technical stack from the test case to a separate module.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Right click the src folder and create a package named module. Right click the module package and create a java class called testInit.java.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Here we code all the technical details of starting selenium server for test initialization so that the actual test case is freed from these unnecessary details and can cover the main area to test.</span></p>
<p style="text-align: justify;"><span style="color: #000000;"><br />
</span></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">module</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.thoughtworks.selenium.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.testng.annotations.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">config.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> testInit <span style="color: #000000; font-weight: bold;">extends</span> SeleneseTestBase
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Declare a new selenium test</span>
	seleniumTest test <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> seleniumTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	@Test
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testSetup<span style="color: #009900;">&#40;</span>DefaultSelenium selenium<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">//Open, maximize and focus on the facebook page. Delete all cookies</span>
			selenium.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			selenium.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			selenium.<span style="color: #006633;">waitForPageToLoad</span><span style="color: #009900;">&#40;</span>test.<span style="color: #006633;">TIMEOUT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Handles timeout exception</span>
			selenium.<span style="color: #006633;">windowMaximize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			selenium.<span style="color: #006633;">windowFocus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			selenium.<span style="color: #006633;">deleteAllVisibleCookies</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Clear all session cookies before testing</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			 e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><br />
<span style="color: #800000;"><strong>Step 4: Writing a selenium test case</strong></span></h2>
<p style="text-align: justify;"><span style="color: #000000;">Now that we already have modules for test setup and initialization, the writing of a selenium test case doesn&#8217;t take much effort. All we need to do is just call these modules and reuse them in our test case. <strong>This allows us to focus more on the customer.</strong></span></p>
<p style="text-align: justify;"><span style="color: #000000;">A good automation script should contain the actual code logic to perform and validate a business scenario.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Right click the src folder and create a package named testSuite. Right click the testSuite package and create a java class called weatherMonsterHome.java</span></p>
<p style="text-align: justify;"><span style="color: #000000;"><br />
</span></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">testSuite</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Test case for weather monster home page*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">module.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">config.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.testng.annotations.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.thoughtworks.selenium.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> weatherMonsterHome <span style="color: #000000; font-weight: bold;">extends</span> SeleneseTestBase
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Declare a new selenium test</span>
	seleniumTest test <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> seleniumTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	testInit setUp <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> testInit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	@Test
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testWeatherMonster<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">/*Test the home page of Weather Monster
			 * Pass the expected message and page title of the home page as parameters
			 */</span>
			setUp.<span style="color: #006633;">testSetup</span><span style="color: #009900;">&#40;</span>test.<span style="color: #006633;">Selenium</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			weatherMonster<span style="color: #009900;">&#40;</span>test.<span style="color: #006633;">Selenium</span>, test.<span style="color: #006633;">HOME_MSG</span>,test.<span style="color: #006633;">HOME_PAGETITLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> weatherMonster<span style="color: #009900;">&#40;</span>DefaultSelenium Selenium, <span style="color: #003399;">String</span> strHomeMsg, <span style="color: #003399;">String</span> strExpectedHomePageTitle<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">/*Verification of Weather Monster home page*/</span>
			assertTrue<span style="color: #009900;">&#40;</span>Selenium.<span style="color: #006633;">isTextPresent</span><span style="color: #009900;">&#40;</span>strHomeMsg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Message on the Weather Monster home page is displayed successfully&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			assertEquals<span style="color: #009900;">&#40;</span>Selenium.<span style="color: #006633;">getTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,strExpectedHomePageTitle<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Title of Weather Monster home page is correct&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: justify;"><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><br />
<span style="color: #000000;">This decoupling of test script from all the test execution details has made the test case <em><strong>a very easy-to-read list of user actions.</strong></em></span></p>
<p style="text-align: justify;"><span style="color: #000000;">Ultimately the test structure is as below:</span></p>
<p style="text-align: justify;"><span style="color: #000000;"><a href="http://technologyandleadership.com/wp-content/uploads/2011/07/teststructure.png"><img class="alignnone size-full wp-image-968" title="teststructure" src="http://technologyandleadership.com/wp-content/uploads/2011/07/teststructure.png" alt="" width="311" height="356" /></a></span></p>
<h2><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><span style="color: #800000;"><strong>Step 5: Run the test case</strong></span></h2>
<ol>
<li style="text-align: justify;"><span style="color: #000000;">Navigate to the config folder and give the below command to start selenium server:</span><span style="color: #000000;"><span style="color: #000000;"><br />
</span></span></li>
</ol>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>config.sh</pre></td></tr></table></div>

<ul>
<li style="text-align: justify;"><span style="color: #000000;">Right click on weatherMonsterHome.java and select “Run as TestNG test”.</span></li>
</ul>
<p>&nbsp;</p>
<p><strong><span style="color: #008000;">OUTPUT:</span></strong></p>
<p><span style="color: #000000;"><span style="font-family: Monospace;"><span style="font-size: x-small;">RemoteTestNG starting</span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Monospace;"><span style="font-size: x-small;">Message on the Weather Monster home page is displayed successfully</span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Monospace;"><span style="font-size: x-small;">Title of Weather Monster home page is correct</span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Monospace;"><span style="font-size: x-small;">PASSED: testWeatherMonster</span></span></span></p>
<p>&nbsp;</p>
<p style="text-align: justify;"><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><span style="color: #000000;">We have missed out on a few little secrets of test automation like intelligent exception handling and data-driven testing. We shall get introduced to them in our next article, so stay tuned!</span></p>
<p><span style="color: #000000;">Feel free to ask any question or post comments.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://technologyandleadership.com/30-feet-view-of-test-automation-framework-with-selenium/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
