<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Aditya Dada&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/aditya_dada/" />
<modified>2008-05-20T23:07:11Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/aditya_dada/280</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, aditya_dada</copyright>
<entry>
<title>Selenium-ANT-TestNG (SAT) Framework</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/aditya_dada/archive/2008/05/seleniumanttest.html" />
<modified>2008-05-20T23:07:11Z</modified>
<issued>2008-05-20T18:39:15Z</issued>
<id>tag:weblogs.java.net,2008:/blog/aditya_dada/280.9837</id>
<created>2008-05-20T18:39:15Z</created>
<summary type="text/plain">Putting together Selenium, ANT and TestNG to create an easy-to-use, open-source record-playback test framework. </summary>
<author>
<name>aditya_dada</name>

<email>Aditya.Dada@Sun.COM</email>
</author>
<dc:subject>Testing</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/aditya_dada/">
<![CDATA[<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="http://weblogs.java.net/blog/aditya_dada/archive/sat/testws.zip">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 http://localhost:8080/ 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 />
            }<br />
            <br />
            @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  http://localhost:8080/&lt;context_root&gt; 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. <br />
    <br />
    <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>]]>

</content>
</entry>
<entry>
<title>The Future of Testing</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/aditya_dada/archive/2008/05/the_future_of_t_1.html" />
<modified>2008-05-13T17:00:41Z</modified>
<issued>2008-05-12T21:40:29Z</issued>
<id>tag:weblogs.java.net,2008:/blog/aditya_dada/280.9786</id>
<created>2008-05-12T21:40:29Z</created>
<summary type="text/plain">Another look at the JavaONE BOF on The Future of Testing. </summary>
<author>
<name>aditya_dada</name>

<email>Aditya.Dada@Sun.COM</email>
</author>
<dc:subject>Open Source</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/aditya_dada/">
<![CDATA[On May 7th, 2008, Varun Rupela and I gave a talk on <a href="https://www28.cplan.com/cc191/session_details.jsp?isid=295387&ilocation_id=191-1&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>
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>
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>
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>
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>
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="http://weblogs.java.net/blog/aditya_dada/archive/Java1Bof_3.pdf">here</a> (.pdf).]]>

</content>
</entry>
<entry>
<title>Better Software conference</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/aditya_dada/archive/2006/07/better_software.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-07-12T21:57:08Z</issued>
<id>tag:weblogs.java.net,2006:/blog/aditya_dada/280.5178</id>
<created>2006-07-12T21:57:08Z</created>
<summary type="text/plain">My recent presentation on &apos;Smoke Tests to Signal Test Readiness&apos; at the Better Software Conference, and a review of a few talks that stood out.</summary>
<author>
<name>aditya_dada</name>

<email>Aditya.Dada@Sun.COM</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/aditya_dada/">
<![CDATA[<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&dow=thu&dg=date&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<br />
 <br />
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 & recap followed by Questions & 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&dow=wed&dg=date&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&dow=thu&dg=date&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&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>]]>

</content>
</entry>
<entry>
<title>Finding Bugs Made Easy</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/aditya_dada/archive/2006/01/finding_bugs_ma.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-01-26T18:43:39Z</issued>
<id>tag:weblogs.java.net,2006:/blog/aditya_dada/280.4006</id>
<created>2006-01-26T18:43:39Z</created>
<summary type="text/plain">A review of the FindBugs Tool developed at University of Maryland by Professor Bill Pugh and his team.</summary>
<author>
<name>aditya_dada</name>

<email>Aditya.Dada@Sun.COM</email>
</author>
<dc:subject>Testing</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/aditya_dada/">
<![CDATA[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>
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>
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>
&nbsp;* High, Medium or Low<br>
&nbsp;* Correctness, Malicious Code, Performance or Style<br>
&nbsp;* Sorted by package or class<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>
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>
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>
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>
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.]]>

</content>
</entry>

</feed>