aditya_dada's bloghttp://www.java.net/blogs/aditya_dada
enUsing Sun's Virtualization software xVM VirtualBox on MacbookPro for Windows 7 Betahttp://www.java.net/blog/aditya_dada/archive/2009/02/using_suns_virt.html
<!-- 890 | 0 --><img src="/images/people/aditya_dada.jpg" border="0", align="left" /><p>I got a new Intel-based MacBook Pro the other day and decided to try out Sun's xVM VirtualBox software on Mac OSX to install Windows 7 Beta.<br />
Here are the steps I followed: </p>
<ol>
<li> Download the software from <a href="http://dlc.sun.com/virtualbox/vboxdownload.html#mac">http://dlc.sun.com/virtualbox/vboxdownload.html#mac</a>.
<li> Select the default settings while installing. </li>
<li> Download the new windows 7 Beta from the Microsoft website: <a href="http://www.microsoft.com/windows/windows-7/beta-download.aspx" title="http://www.microsoft.com/windows/windows-7/beta-download.aspx">http://www.microsoft.com/windows/windows-7/beta-download.aspx</a> and create a boot DVD disk from the iso image. </li>
<li> Click on the new icon on the VirtualBox window to create a new VM. </li>
<li>A Wizard will start that will guide you through the simple setup.<br />
<br><br />
<img alt="SunxVM-installingWindows7-3.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-3.jpg" width="541" height="483" />
</li>
<li> Select OS Wizard will start. Select Windows 7 and give a name of your choice. E.g. Windows7Beta<br />
<br><br />
<img alt="SunxVM-installingWindows7-selectOS.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-selectOS.jpg" width="541" height="483" />
</li>
<li> Select RAM for your OS. I gave 1024MB.<br />
<br><br />
<img alt="SunxVM-installingWindows7-selectRAM.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-selectRAM.jpg" width="541" height="483" />
</li>
<li> Select HDD.<br />
<br><br />
<img alt="SunxVM-installingWindows7-selectHDD.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-selectHDD.jpg" width="541" height="483" /><br />
<br><br />
Here, you will need to create a new HDD partition that will host the new OS that you're installing. Click on the "New" button to launch the wizard.<br />
<br><br />
<img alt="SunxVM-installingWindows7-CreateNewHDD.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-CreateNewHDD.jpg" width="451" height="468" />
</li>
<li> Select size of the virtual hard disk that you'd like to allocate for the OS. I gave 30 GB to dynamically growing disk meaning that the disk allocation will start small and grow to a max of 30 GB if needed.<br />
<br><br />
<img alt="SunxVM-installingWindows7-selectHDDSize.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-selectHDDSize.jpg" width="451" height="468" />
</li>
<li> Click Finish. You will see a new VM for the OS in the main window </li>
<li> Double click the newly created VM. </li>
<li> Insert the Boot disk for DVD you created earlier </li>
<li> The new VM will guide you through the setup using the normal installation wizards.<br />
<br><br />
<img alt="SunxVM-installingWindows7-2.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-2.jpg" width="1024" height="813" /></p>
<hr>
<img alt="SunxVM-installingWindows7.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7.jpg" width="800" height="645" /></p>
<hr>
<img alt="SunxVM-installingWindows7-running.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-installingWindows7-running.jpg" width="800" height="645" /></p>
<hr>
<img alt="SunxVM-VirtualBox.jpg" src="http://weblogs.java.net/blog/aditya_dada/archive/xVM/SunxVM-VirtualBox.jpg" width="770" height="642" /></p>
</li>
</ol>
<p><br><br />
I found VirtualBox extremely easy and intuitive to use.</p>
http://www.java.net/blog/aditya_dada/archive/2009/02/using_suns_virt.html#commentsVirtual MachineThu, 05 Feb 2009 22:19:46 +0000aditya_dada241505 at http://www.java.netSelenium-ANT-TestNG (SAT) Frameworkhttp://www.java.net/blog/aditya_dada/archive/2008/05/seleniumanttest.html
<!-- 3579 | 0 --><img src="/images/people/aditya_dada.jpg" border="0", align="left" /><p><font face="verdana" size="2"><br />
<H2>Architecture</H2></p>
<p>This framework is created using <A HREF="http://ant.apache.org/">ANT</A>, <A HREF="http://testng.org/">TestNG</A> and <A HREF="http://www.openqa.org/selenium/">Selenium</A>.<br />
Through this framework, a user is able to create an automated test case which can be run later by executing a single command. The uses of different frameworks are as follows:<br />
Selenium: This framework is needed for recording a testcase, exporting it into Java, and executing it on a browser<br />
TestNG: This framework is used to organize different tests, and to report results.<br />
ANT: provides the glue to hold everything together, and execute basic commands.</p>
<p><H2>Pre-requisites: </H2><br />
Basic knowledge of Selenium IDE, Selenium RC, TestNG and ANT. </p>
<p><H2>Setup:</H2><br />
1. Install <a href="http://www.openqa.org/selenium-ide/">Selenium IDE</a> on your <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> browser.<br />
2. Make sure you have <a href="http://ant.apache.org">ANT</a> installed.<br />
3. Grab the testws.zip file from <A HREF="/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://weblogs.java.net/blog/aditya_dada/archive/sat/testws.zip&nid=240261">here</A>. Unzip it into a directory of your choice.</p>
<p><strong>About the sample </strong><br />
There are 2 bundled samples:<br />
1. AdminLoginTest.java: This test logs into the glassfish admin console using the username/password: admin/administrator. It then clicks on the 'Enterprise Applications' link, and tests to see if there are no applications deployed. Else, test will fail.<br />
2. SimpleTest.java: This test accesses <a href="http://localhost:8080/" title="http://localhost:8080/">http://localhost:8080/</a> page, and tests whether the term "Glassfish Project" appears or not.</p>
<p>The <i>config</i> directory contains <i>testng.xml</i> file, and is a place holder for configuration files.<br />
The <i>lib</i> directory contains required jar files, and is a place holder for other library jars/zips.<br />
The <i>test</i> directory contains test java files and is a place holder for other test files.<br />
Once the tests are run, <i>build</i> and <i>test-output</i> directories will be created.<br />
The <i>build</i> directory contains compiled classes, and is a volatile directory that is deleted by the target <i>clean</i> in <i>build.xml</i> file.<br />
The <i>test-output</i> directory contains result files, and is generated by TestNG.<br />
<strong><I>Notes</I></strong>:<br />
To run the bundled sample, follow the steps for "Execute your test through ANT" (see below).<br />
Currently, I face some issues running this on IE. I have successfully been able to run tests using Firefox.</p>
<p><H2 >How To: </H2><br />
<strong>Write a test case</strong><br />
The basic structure that one has to follow to create a test case is:<br />
1. Record a testcase using Selenium IDE (Firefox browser only), Export the test case into Java<br />
2. Edit the test case &ndash; java file, and add TestNG annotations<br />
3. Execute the test case using ANT</p>
<p>1. <strong>Record test using selenium IDE and export it into Java:</strong><br />
i. Open the website you&rsquo;d like to test in Firefox browser<br />
ii. Start the selenium IDE from your Firefox browser<br />
iii. Ensure that the Base URL in Firefox is the same as the website you want to test<br />
iv. Start clicking on the website. Selenium will record your actions.<br />
v. When finished, do: File -&gt; Export Test As... -&gt; Java &ndash; Selenium RC and save the java file.<br />
<img alt="seleniumIDE-export.JPG" src="http://weblogs.java.net/blog/aditya_dada/archive/sat/seleniumIDE-export.JPG" width="398" height="519" /><br />
After exporting, your java test case should look like this:<br />
<img alt="selenium-java-test.JPG" src="http://weblogs.java.net/blog/aditya_dada/archive/sat/selenium-java-test.JPG" width="900" height="497" /></p>
<p>2. <strong>Add TestNG to your test case:</strong><br />
i. Open the java test file you just created in an editor<br />
ii. Add the following:<br />
(a) to the import statements:<br />
<font color="blue" face="courier"> import org.testng.annotations.*; </font><br />
(b) To variable declarations:<br />
<font color="blue" face="courier"><br />
private DefaultSelenium selenium;<br />
private static String TIMEOUT_PERIOD =&quot;10000&quot;;<br />
</font><br />
(c) To The class:<br />
<font color="blue" face="courier"><br />
@BeforeSuite(alwaysRun = true)<br />
public void setUp(String browser) {<br />
selenium = new DefaultSelenium(&quot;localhost&quot;, 4444, &quot;*firefox&quot;, &quot;http://localhost:8080&quot;);<br />
selenium.start();<br />
selenium.open(&quot;http://localhost:8080&quot;);<br />
}</p>
<p> @AfterSuite(alwaysRun = true)<br />
private void stopTest() {<br />
selenium.stop();<br />
}<br />
</font><br />
(d) After each statement in the test that will take time for a page to load:<br />
<font color="blue" face="courier"><br />
selenium.waitForCondition(&quot;selenium.browserbot.isNewPageLoaded()&quot;, TIMEOUT_PERIOD);<br />
</font><br />
(e) On top of the test method:<br />
<font color="blue" face="courier"><br />
@Test(groups = { &quot;&lt;your test group name&gt;&quot; })<br />
e.g. @Test(groups = { &quot;roller&quot; })<br />
</font><br />
(f) Edit page to be opened. Make sure arg to &lsquo;open&rsquo; method of selenium points to the right context root e.g. If <a href="http://localhost:8080/&lt;context_root&gt;" title="http://localhost:8080/&lt;context_root&gt;">http://localhost:8080/&lt;context_root&gt;</a> is the correct URL to test, then since we already have tried to open localhost:8080 in setUp, we only need to open the context root page.<br />
e.g. <font color="blue" face="courier"><br />
selenium.open(&quot;&lt;context_root&gt;&quot;);<br />
</font></p>
<p>iii. Save the test file<br />
(a). (Optional) Update testng.xml file. TestNG uses this file to read which groups to execute and also <A HREF="http://testng.org/doc/documentation-main.html#parameters">to pass parameters</A> to the test. This file is only required if build.xml file uses testng.xml file to run the test.<br />
Note: in sample test included, testng.xml is used, and will need to be updated. </p>
<p>iv. Ensure that the test file you created is mentioned in the build.xml compile target. </p>
<p>3. <strong>Execute your test through ANT</strong><br />
i. Start domain required by your webpage. e.g. asadmin start-domain<br />
ii. Start database if needed (Not needed for bundled sample test)<br />
iii. Start selenium server e.g. cd testws/lib, java -jar selenium-server.jar<br />
iv. Execute the command: &ldquo;ant run&rdquo; from &lsquo;testws&rsquo;. You should see a new firefox browser window open up, and run through your test.<br />
v. Check reports generated by TestNG under &lsquo;testws/test-output&rsquo; directory. Open the index.html to see different output from the test. </p>
<p> <img alt="SAT-html-output.JPG" src="http://weblogs.java.net/blog/aditya_dada/archive/sat/SAT-html-output.JPG" width="1401" height="346" /><br />
Console output: </p>
<p> <img alt="SAT-cmd-output.JPG" src="http://weblogs.java.net/blog/aditya_dada/archive/sat/SAT-cmd-output.JPG" width="589" height="332" /><br />
</font></p>
http://www.java.net/blog/aditya_dada/archive/2008/05/seleniumanttest.html#commentsTestingTue, 20 May 2008 17:39:15 +0000aditya_dada240261 at http://www.java.netThe Future of Testinghttp://www.java.net/blog/aditya_dada/archive/2008/05/the_future_of_t.html
<!-- | 0 --><p>On May 7th, 2008, Varun Rupela and I gave a talk on <a href="https://www28.cplan.com/cc191/session_details.jsp?isid=295387&amp;ilocation_id=191-1&amp;ilanguage=english">"The Future of Testing: How Community Engagement Is Changing the Rules" </a> at the <a href="http://java.sun.com/javaone/sf/index.jsp">JavaONE</a> conference in San Francisco.<br />
<br><br><br />
At Sun's <a href="http://glassfish.org">GlassFish</a> Quality Engineering team, we have been seeing a trend for the past few years, ever since GlassFish joined the open source revolution, that more and more features are developed by the community, but these features are not tested by the community. While the burden of additional testing came to rest upon the in-house Quality Organziation, the resources are often not added to meet the additional requirements. So what does a resource-constrained Quality organization such as ours do? We follow project GlassFish, and go open source!<br />
<br><br><br />
The charter of <a href="https://glassfish.dev.java.net/quality/portal/index.html">GlassFish Quality Community</a> is unique - something that gives us leverage in creating a niche for ourselves as an open-source community. We are the only organization under GlassFish, that can offer <a href="https://glassfish.dev.java.net/quality/portal/learn.html">opportunities to learn latest technologies</a>, interact with industry experts while also <a href="https://glassfish.dev.java.net/quality/portal/rewards.html">making the whole experience rewarding</a>. And it is this strategic placement that helps us create a win-win solution.<br />
<br><br><br />
We not only attract students and young professionals who would like to get their feet wet with latest GlassFish technologies, but also attract quality engineers from other organizations that are already using GlassFish, and would like to stay on top of the <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishCommunityTestResults">quality status</a> of GlassFish. And, we not only accept all contributions to help improve GlassFish Quality, we also incorporate many of the applciations into our nightly test base. And while young professionals in the field of JavaEE applications improve their skills in developing applications, our customers can get the defects fixed faster, and request new features more efficiently.<br />
<br><br><br />
This was the idea that was a novelty for many at JavaONE this year, and we won many praises and accolades for taking a step in the right direction.<br />
<br><br><br />
By the way, for those interested in the slides to our talk, they can be downloaded <a href="http://weblogs.java.net/blog/aditya_dada/archive/Java1Bof_3.odp"> here</a> (.odp) or <a href="/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://weblogs.java.net/blog/aditya_dada/archive/Java1Bof_3.pdf&nid=240214">here</a> (.pdf).</p>
http://www.java.net/blog/aditya_dada/archive/2008/05/the_future_of_t.html#commentsOpen SourceMon, 12 May 2008 20:40:29 +0000aditya_dada240214 at http://www.java.netBetter Software conferencehttp://www.java.net/blog/aditya_dada/archive/2006/07/better_software.html
<!-- | 0 --><p>I recently presented at the <a href="http://www.sqe.com/bettersoftwareconf/">Better Software conference</a> in Las Vegas. It was my first time at this conference and I had a great time attending, and presenting there.<br />
I was scheduled to present on the 29th and I arrived at the conference on 28th at lunchtime (now that's one way to start a conference!). </p>
<p>My presentation on '<a href="http://sqe.com/bettersoftwareconf/sessions.asp?from=glance&amp;dow=thu&amp;dg=date&amp;dgd=thu#T11">Smoke Tests to Signal Test Readiness</a>' went off well, with the room quite full of audience. I started my talk by covering typical problems that face complex software complex stacks. I then discussed definitions and purpose of smoke tests, different types of release models (Tinderbox, nightly weekly, milestone), different types of smoke tests to find bugs for the different release models. Features for designing smoke tests (coverage, speed, reporting, management, tools) and challenges in designing proper test suites followed, namely:</p>
<p>Â· Complex Software Stack<br />
Â· Multiple developers<br />
Â· Tests for different teams and purposes<br />
Â· Test enhancement Strategy<br />
Â· Baselining<br />
Â· Portability<br />
Â· Management</p>
<p>After describing a process to create smoke-tests, the talk covered a real-world example from our <a href="https://glassfish.dev.java.net/">GlassFish </a>(and <a href="http://java.sun.com/javaee/downloads/index.html">Sun Java System Application Server</a>) testbase. I ended my talk with benefits &amp; recap followed by Questions &amp; Answers session. The audience raised very relevant questions at the end that made for some great discussions.<br />
Even though only a small percentage of my audience had used <a href="https://glassfish.dev.java.net/">GlassFish </a>or <a href="http://java.sun.com/javaee/downloads/index.html">Sun Java System Application Server</a>, I handed out some business cards on <a href="https://glassfish.dev.java.net/">GlassFish </a>and the <a href="http://wiki.java.net/bin/view/Projects/GlassFishQuality">Quality Portal</a>, as well as CDs and even a few T-shirts, and the response was very positive. I also helped educate some members of the audience that <a href="http://java.sun.com/javaee/downloads/index.html">Sun Java System Application Server</a> was free to download, and that <a href="https://glassfish.dev.java.net/">GlassFish </a>was an open-source project. Again the response was very positive, and I hope some of them contribute to the <a href="https://glassfish.dev.java.net/">GlassFish </a>Project in the near future.</p>
<p>There were many interesting topics people presented, however three stood out for me. </p>
<p>One was a very technical and enjoyable talk titled '<a href="http://sqe.com/bettersoftwareconf/sessions.asp?from=glance&amp;dow=wed&amp;dg=date&amp;dgd=wed#W14">Software production line automation</a>' by <a href="http://www.go2group.com/">C. Thomas Tyler</a>. Since my own talk dealt with automation in some ways, it was interesting to me that his talk had a lot of ideas very similar to those in mine, and to those that we follow at Sun. It was good to see that others faced similar issues as we did. The presentation focused on trying to bring the line automation into software, by parallel-izing software development, and improving automation with the use of tools. In addition, the presentation covered ways to incorporate Agile methodology and create a system where a machines could create products that maybe shipped with the current state of features, where machines can provide automated answers to questions like - "which bug fixes went into which build"? </p>
<p>Another very entertaining and educational talk, was given by <a href="http://www.catalysisgroup.com/welcome.asp">Payson Hall</a> on '<a href="http://sqe.com/bettersoftwareconf/sessions.asp?from=glance&amp;dow=thu&amp;dg=date&amp;dgd=thu#T1">How to Estimate Anything</a>'. He claimed in his talk that if we (the audience) were to follow his techniques, it would guarantee an improvement in our estimation by 20%, or he would come to where ever we were in the world, buy us lunch, and discuss what could be done better. Now that's a claim I'd like to challenge :) Payson had two demonstrations in his talk. One was to estimate lengths of different ropes - once wrapped neatly, held in hand, and shown slowly and quietly to the audience, then all untangled with Payson running wildly around the audience, then finally, with me as a baseline to measure it against. The audience 'estimated' the lengths. The results:<br />
Â· Estimates for shorter ropes were more accurate.<br />
Â· Estimates made when compared to a baseline were more accurate.<br />
Â· Estimates made when the target was moving, and a lot of noise interfered - were less accurate.<br />
Another demonstration had to do with estimating the number of credit cards in the room. Same question, asked three times, with different amounts of time allowed to answer them yielded three different answers. Interestingly, people's observations related in some way to their cultural backgrounds! One thing to note was that the art of estimation, as old as it maybe, still poses challenges in almost every organization for almost every project. </p>
<p><a href="http://www.joelonsoftware.com/">Joel Splosky</a> gave a keynote presentation on '<a href="http://sqe.com/bettersoftwareconf/keynotes.asp?from=glance&amp;dow=thu#spolsky">Donâ€™t Settle For Better Softwareâ€”Make Truly Great Software</a>'. He brought out 3 points that he believes makes the difference between a good product, and a market leader - knowing what the users want, keeping the emotional aspect in mind and obsessing over aesthetics (iPod vs Creative's Zen). It was one of the most entertaining presentations at the conference. In a simple way, Joel brought out a subtle idea - not all products with good functionality become market leaders.</p>
http://www.java.net/blog/aditya_dada/archive/2006/07/better_software.html#commentsJava EnterpriseWed, 12 Jul 2006 20:57:08 +0000aditya_dada235876 at http://www.java.netFinding Bugs Made Easyhttp://www.java.net/blog/aditya_dada/archive/2006/01/finding_bugs_ma.html
<!-- | 0 --><p>I was introduced to <a href="http://findbugs.sourceforge.net/">FindBugsâ„¢</a> tool in April 2005. I attended professor Bill Pugh's presentation, and walked out impressed. Some of you may have met him at <a href="http://java.sun.com/javaone/sf/index.jsp">JavaOne </a>in 2004 after his <a href="http://developers.sun.com/learning/javaoneonline/2004/corej2se/TS-1847.html">presentation</a>. While he was visiting Sun Microsystems, Inc. campus in Santa Clara, CA, I had the opportunity to meet him, and discuss with him techniques to integrate FindBugsâ„¢ into our processes.<br />
<br><br />
Since then, I've tried to put FindBugsâ„¢ to good use by running it against <a href="https://glassfish.dev.java.net/">Glassfish</a>. And the results have been surprising.<br />
<br><br />
FindBugsâ„¢ is a static analysis tool, that uses <a href="http://findbugs.sourceforge.net/bugDescriptions.html">bug patterns</a> to search for common problems by analyzing Java byte-code. Its strength is its ability to discover problems like possible infinite recursive loops, impossible casts, possible typos in method names and many more. It catches errors that compilers let pass. It has powerful reporting that points out the defective class, the method and the line of code. The warnings produced can be categorized in many different ways, like:<br><br />
&nbsp;* High, Medium or Low<br><br />
&nbsp;* Correctness, Malicious Code, Performance or Style<br><br />
&nbsp;* Sorted by package or class<br><br />
<BR><br />
<a href="http://findbugs.sourceforge.net/manual/filter.html#d0e1681">Filter</a> patterns may be written to exclude or include matching Classes and/or Warnings.<br />
<br><br><br />
I found the tools that were bundled with FindBugsâ„¢ really easy to use, and powerful. What's more - it helps brush up the core concepts of Java programming, and in using Java more effectively.<br />
<br><br><br />
Along with its many strengths, FindBugsâ„¢ also has some shortcomings. One of them is the inability to process nested jars (which the FindBugsâ„¢ team is aware of, and a fix may be available soon). Another is generation of 'False Positives' that may not be real product bugs.<br />
<br><br><br />
In my experience, the high priority warnings produced by FindBugsâ„¢ are best addressed first. The medium priority warnings need a bit of analysis, and the low priority may be ignored.<br />
<br><br><br />
The strengths of FindBugsâ„¢ far outweigh its weaknesses. FindBugsâ„¢ provides a low cost way of catching issues and defects. Since FindBugsâ„¢ is so easy to install, and requires minimal effort to use, I'd highly recommend using it to improve the quality of your code.</p>
http://www.java.net/blog/aditya_dada/archive/2006/01/finding_bugs_ma.html#commentsTestingThu, 26 Jan 2006 18:43:39 +0000aditya_dada234750 at http://www.java.net