<?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>JavaPulse &#187; testing</title>
	<atom:link href="http://javapulse.net/tag/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://javapulse.net</link>
	<description>a finger on the pulse of the freelance Java&#0153; market in the Netherlands</description>
	<lastBuildDate>Sat, 19 Jun 2010 11:00:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Smart = Agile++ by Ivar Jacobson</title>
		<link>http://javapulse.net/2008/12/24/smart-agile-by-ivar-jacobson/</link>
		<comments>http://javapulse.net/2008/12/24/smart-agile-by-ivar-jacobson/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 15:10:17 +0000</pubDate>
		<dc:creator>Clara Ko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[devoxx08]]></category>
		<category><![CDATA[smart]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://javapulse.net/?p=131</guid>
		<description><![CDATA[One of the most entertaining talks I went to was the Be smart! by Ivar Jacobson. Although the concepts that he presented were definitely not new, he found a very clear and entertaining way to present them. A RUP guy, he told it how it is &#8211; about what I consider to be agile &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most entertaining talks I went to was the <a href="http://devoxx.com/display/JV08/Be+smart!" target="Devoxx">Be smart!</a> by <a href="http://ivarblog.com" target="Ivar Jacobson">Ivar Jacobson</a>. Although the concepts that he presented were definitely not new, he found a very clear and entertaining way to present them. A RUP guy, he told it how it is &#8211; about what I consider to be agile &#8211; while calling it not agile &#8211; but smart.<br />
According to Ivar, here are a list of things that we don&#8217;t learn in school:</p>
<ul>
<li>people</li>
<li>teams</li>
<li>projects</li>
<li>requirements</li>
<li>architecture</li>
<li>modeling</li>
<li>testing</li>
<li>documentation</li>
<li>process</li>
<li>knowledge</li>
<li>outsourcing</li>
<li>tools</li>
</ul>
<p>From the above, I believe that teamwork and testing are becoming increasingly relevant and valuable in our professional.<br />
I must agree with him that these topics were either not taught at all or they were not taught very effectively due to the lack of focus given to these &#8220;non-technical&#8221; topics (with the exception of architecture &#8211; which usually didn&#8217;t get ). At least that was how it was when I was at university (I graduated in 1996 at U.C. Berkeley). Perhaps there is more focus on them these days. At that time, they were starting to realize that being able to work in a group is important for the students into workplace. So they started putting people in groups to do assignments. I believe in teamwork because it is better for the company as a whole. A team that can work together and share knowledge amongst members is more valuable to the company than an individual who is supposedly `really good´. If this individual does not share his/her knowledge, then the company gets only limited benefits of the individual&#8217;s potential. In a story that I heard from <a href="http://jeffsutherland.com/" target="Jeff Sutherland">Jeff Sutherland</a> &#8211; one of the creators of Scrum &#8211; the combined effort of a team out-performed the effort of a &#8216;really good&#8217; individual &#8211; an individual considered 5 times as good as the other team members. This performance was measured when the Scrum master kicked the &#8216;really good&#8217; individual out of the team. Turned out that he was disrupting the performance of the other team members by refusing to work together with them.</p>
<p>Another topic is increasingly relevant these days for a developer is testing. Again, testing is hardly ever taught in school. I&#8217;m glad to see as over the years testing has become more and more prominent. Any developer that does not know or does not care about testing is definitely old-school and out-dated. A good developer cares about about writing testable code and has is equipped with a list of testing tools in his skillset.</p>
<p>Here are some of the great quotes from the talk:<br />
<em>A fool with a tool is still a fool but a dangerous fool</em><br />
Tools are not enough, but proper use of the tools is what is important. Companies often decide on new tools without investing in training for these tools.</p>
<p><em>Software is developed by people not by process and tools</em><br />
I have been always saying about agile is that it puts the human element back into software development. That is the really that it has an effect on motivating people. Feedback motivates people. Doing a good job motivates people.</p>
<p><em>Software development is like a football game &#8211; lose together or win together</em><br />
When you play football, you don&#8217;t say, &#8220;I did great &#8211; I scored 3 goals &#8211; but the goalie, he let in 5 goals &#8211; he&#8217;s terrible.&#8221; Either you win as a team or lose as a team. Winning or losing may come down to your ability to work as a team.</p>
<p><em>Think big, build incrementally</em><br />
This reminds me of the discussion about whether people prefer to use <a href="http://www.mountaingoatsoftware.com/article_view/27-advantages-of-user-stories-for-requirements" target="Mountaint Goat Software">user stories</a> or use cases in agile. A <a href="http://alistair.cockburn.us/A+user+story+is+to+a+use+case+as+a+gazelle+is+to+a+gazebo">good explanation</a> of the difference highlights the reservation that people have about user stories as being too narrowly focused. With requirements as with architecture, it is important not only to keep the big picture in mind, but to find a good balance between the big picture and the details. Some companies have a good grip on the big picture, while losing sight of the details, while some other companies focus on the detail without a big picture, resulting with an inflexible system.</p>
<p><em>Architecture without executable code is a hallucination</em><br />
This is something that I feel strongly about. I call myself a hands-on architect &#8211; perhaps I should call it non-ivory-tower architect. <a href="http://www.agilemodeling.com/essays/agileArchitecture.htm" target="Agile Modelling">The real world is not perfect like it seems from the ivory tower.</a> Architecture is only valuable when it has been proven. Ivar says: Start by building a skinny system to demonstrate that all critical risks have been eliminated.</p>
<p><em>Law of Nature: People don&#8217;t read documentation</em><br />
Only write the essentials and leave room for conversations and self-discovery later. In school, we are taught to think for ourselves, but often in the workplace, especially a big company, we are asked on our first day to read endless documentation. Honestly, I do a skim through of the table of contents and maybe the first pages. It is a pain to read through a big document. Write down the essentials with attention to bringing across the main ideas in a few words as possible.</p>
<p><em>The smart way to do testing: We are all testers!</em><br />
Clean up after ourselves. Testers are the real thinkers.</p>
<p>I really agree with what Ivar ended the talk with:</p>
<blockquote><p>
We cannot all be equally smart, but we can all become smarter.
</p></blockquote>
<p>You got a team of people, so why not make sure everyone is working at their best potential.</p>
]]></content:encoded>
			<wfw:commentRss>http://javapulse.net/2008/12/24/smart-agile-by-ivar-jacobson/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java Test Tools</title>
		<link>http://javapulse.net/2008/05/29/java-test-tools/</link>
		<comments>http://javapulse.net/2008/05/29/java-test-tools/#comments</comments>
		<pubDate>Thu, 29 May 2008 08:44:30 +0000</pubDate>
		<dc:creator>Clara Ko</dc:creator>
				<category><![CDATA[testing]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://javapulse.net/2008/05/29/web-test-tools/</guid>
		<description><![CDATA[List of JavaTest Tools
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.softwareqatest.com/qatweb1.html">List of JavaTest Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://javapulse.net/2008/05/29/java-test-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium &#8211; automated functional web testing</title>
		<link>http://javapulse.net/2008/05/27/selenium-automated-functional-web-testing/</link>
		<comments>http://javapulse.net/2008/05/27/selenium-automated-functional-web-testing/#comments</comments>
		<pubDate>Tue, 27 May 2008 13:58:39 +0000</pubDate>
		<dc:creator>Clara Ko</dc:creator>
				<category><![CDATA[selenium]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://javapulse.net/2008/05/27/selenium-automated-functional-web-testing/</guid>
		<description><![CDATA[Last week, I set up automated functional testing for the test team using Selenium. So far, I&#8217;m thoroughly impressed with it.
Selenium comes in several version: IDE, core, remote-control, grid.
First, Selenium IDE is used to create tests and run them during test development. It comes as a Firefox plugin, which means that installation happens in one [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I set up automated functional testing for the test team using <a href="http://selenium.openqa.org/">Selenium</a>. So far, I&#8217;m thoroughly impressed with it.</p>
<p>Selenium comes in several version: IDE, core, remote-control, grid.</p>
<p>First, Selenium IDE is used to create tests and run them during test development. It comes as a Firefox plugin, which means that installation happens in one click. One of the biggest advantages of Selenium is that the tests are stored in HTML, which is easy to understand and easy to manage even without a lot of technical knowledge, making it perfect for functional testers. In addition to creating tests by recording user interactions, tests can also be manually built up from a large list of <a href="http://release.openqa.org/selenium-core/0.8.2/reference.html">commands</a>, implemented in Javascript. Some of these commands use XPath or DOM for specifying elements within a web page.</p>
<p>If the HTML/Javascript solution is not enough to expression your test scenarios, tests can be written in Java, C#, Perl, PHP, Python, or Ruby. Selenium IDE even converts an HTML script to any of the above languages for you as a starting point. But once code that cannot be converted back to HTML are introduced in the test, the test can no longer be run within the IDE, but must be compiled (if necessary) and run with Selenium RC (see below).</p>
<p>Second, Selenium RC (remote-control) is used for running the tests from the command line and remote from the application server, making it easy to integrate into a nightly build. Since Selenium is Java-based, it can be run in any OS that supports Java. Selenium RC encapsulates Selenium Core, which was the initial product that requires tests to be deployed together with a web app. This means that Selenium core is probably no longer used by itself.</p>
<p>Lastly, Selenium Grid encapsulates several Selenium RC servers and allows the tests to be run in parallel on multiple machines. This is useful to start the tests on several different OS at the same time, driven from one process.</p>
<p>Selenium seems to be perfect for functional testing. It is easy to adopt, but is flexible enough for more complicated test scenarios which can be written in a variety of languages.</p>
<p>Selenium references:</p>
<ul>
<li><a href="http://wiki.openqa.org/display/SIDE/Home">Selenium IDE documentation</a></li>
<li><a href="http://release.openqa.org/selenium-core/0.8.2/reference.html">Selenium command reference</a></li>
<li><a href="http://www.nabble.com/Selenium-f14083.html">Selenium forum</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://javapulse.net/2008/05/27/selenium-automated-functional-web-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test Development with TestNG and Maven</title>
		<link>http://javapulse.net/2007/03/11/test-development-with-testng-and-maven/</link>
		<comments>http://javapulse.net/2007/03/11/test-development-with-testng-and-maven/#comments</comments>
		<pubDate>Sun, 11 Mar 2007 09:15:08 +0000</pubDate>
		<dc:creator>Clara Ko</dc:creator>
				<category><![CDATA[debugging]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://javapulse.net/?p=67</guid>
		<description><![CDATA[Update following the discussion in the comments:
The reason for not running/debugging my tests from within Netbeans is because the Netbeans TestNG plugin is not up-to-date. I&#8217;m using TestNG 5.5 while the plugin is written for 4.6 or something like that. I&#8217;m sure that if I&#8217;m using either Eclipse with TestNG or JUnit with Netbeans, the [...]]]></description>
			<content:encoded><![CDATA[<p>Update following the <a href="http://javapulse.net/?p=67#comments">discussion</a> in the comments:<br />
The reason for not running/debugging my tests from within Netbeans is because the Netbeans TestNG plugin is not up-to-date. I&#8217;m using TestNG 5.5 while the plugin is written for 4.6 or something like that. I&#8217;m sure that if I&#8217;m using either Eclipse with TestNG or JUnit with Netbeans, the plugins might be more up-to-date. But, the solution below works for me for now.</p>
<hr/>
<p>As part of a huge refactoring effort, I&#8217;m working with the TestNG, Maven, Netbeans. Not surprisingly, everything has not been a breeze. So I put together these steps to set up test development using TestNG and Maven, and debugging with any IDE. In fact, TestNG can be easily replaced by JUnit here. It&#8217;s more about getting around the <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html">Maven build life cycle</a> during test development.</p>
<p><b>1) Skipping the Maven test phase until test development is complete</b></p>
<p>The first problem I encountered was that the jars get created at the install phase near the end of the Maven build life cycle, which means that if the tests fail, the jar never gets created. Apparently, this is not meant for test development. The solution is to turn off the test phase by setting skip to true in the configuration of the surefire plugin, until all tests pass and can be used for automated testing.<br />
            &lt;plugin&gt;<br />
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
                &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br />
                &lt;configuration&gt;<br />
                    <b>&lt;skip&gt;true&lt;/skip&gt;</b><br />
                    &lt;suiteXmlFiles&gt;<br />
                        &lt;suiteXmlFile&gt;src/test/config/testng.xml&lt;/suiteXmlFile&gt;<br />
                    &lt;/suiteXmlFiles&gt;<br />
                &lt;/configuration&gt;<br />
            &lt;/plugin&gt;</p>
<p><b><a name="copy">2) Copying all dependencies to target/lib</a></b></p>
<p>This is usually done for any jar that is an executable (contains a main method), so that you can reference the dependencies easily from within the jar manifest.</p>
<p>            &lt;plugin&gt;<br />
                &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;<br />
                &lt;artifactId&gt;dependency-maven-plugin&lt;/artifactId&gt;<br />
                &lt;executions&gt;<br />
                    &lt;execution&gt;<br />
                        &lt;id&gt;copy-dependencies&lt;/id&gt;<br />
                        &lt;phase&gt;package&lt;/phase&gt;<br />
                        &lt;goals&gt;<br />
                            &lt;goal&gt;copy-dependencies&lt;/goal&gt;<br />
                        &lt;/goals&gt;<br />
                        &lt;configuration&gt;<br />
                            &lt;outputDirectory&gt;${project.build.directory}/lib&lt;/outputDirectory&gt;<br />
                            &lt;overWriteReleases&gt;false&lt;/overWriteReleases&gt;<br />
                            &lt;overWriteSnapshots&gt;true&lt;/overWriteSnapshots&gt;<br />
                        &lt;/configuration&gt;<br />
                    &lt;/execution&gt;<br />
                &lt;/executions&gt;<br />
            &lt;/plugin&gt;</p>
<p><b><a name="manifest">3) Referencing dependencies in the jar manifest</a></b></p>
<p>The following creates a manifest in the jar with references to all the dependencies previously copied to lib. Note that the classPrefix is lib.</p>
<p>            &lt;plugin&gt;<br />
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
                &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;<br />
                &lt;configuration&gt;<br />
                    &lt;jarName&gt;myapp&lt;/jarName&gt;<br />
                    &lt;archive&gt;<br />
                        &lt;manifest&gt;<br />
                            &lt;mainClass&gt;com.mycompany.MyApp&lt;/mainClass&gt;<br />
                            &lt;addClasspath&gt;true&lt;/addClasspath&gt;<br />
                            &lt;classpathPrefix&gt;lib&lt;/classpathPrefix&gt;<br />
                        &lt;/manifest&gt;<br />
                    &lt;/archive&gt;<br />
                &lt;/configuration&gt;<br />
            &lt;/plugin&gt;</p>
<p><b>4) Packaging the tests</b></p>
<p>Next, I add a Maven goal to produce a jar of the test sources.</p>
<p>  mvn clean install <b>jar:test-jar</b></p>
<p>This produces a jar (myapp-tests.jar) in your target directory next to your normal jar (myapp.jar)</p>
<p><b>5) Running the tests with TestNG</b></p>
<p>Then, I run the tests on the command line using TestNG instead of via Maven.</p>
<p>java -cp ./target/myapp.jar;./target/myapp-tests.jar; org.testng.TestNG ./src/test/config/testng.xml</p>
<p>I put the testng.xml in the config directory instead of resources because it is a runtime configuration and does not need to be part of the jar. Everything in the resources directory gets added to the jar.</p>
<p><b>6) Debugging the tests</b><br />
Debugging the tests is simple.</p>
<p>java <b>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=8888</b> -cp ./target/myapp.jar;./target/myapp-tests.jar; org.testng.TestNG ./src/test/config/testng.xml</p>
<p>From your IDE, attach your debugger to port 8888 using a SocketAttach to attach to an external program.</p>
]]></content:encoded>
			<wfw:commentRss>http://javapulse.net/2007/03/11/test-development-with-testng-and-maven/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Current Class and Method</title>
		<link>http://javapulse.net/2007/03/01/current-class-and-method/</link>
		<comments>http://javapulse.net/2007/03/01/current-class-and-method/#comments</comments>
		<pubDate>Thu, 01 Mar 2007 14:28:41 +0000</pubDate>
		<dc:creator>Clara Ko</dc:creator>
				<category><![CDATA[debugging]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://javapulse.net/?p=68</guid>
		<description><![CDATA[Current class is easy:

  String currentClass() {
    return this.getClass().getSimpleName();
  }

Current method:

  String currentMethod() {
    return Thread.currentThread().getStackTrace()[3].getMethodName();
  }

The number in the stack trace changes depending on how far down you bury this call.
Really handy for unit testing or debug logging (remember to wrap debug logging with [...]]]></description>
			<content:encoded><![CDATA[<p>Current class is easy:<br />
<code><br />
  String currentClass() {<br />
    return this.getClass().getSimpleName();<br />
  }<br />
</code></p>
<p>Current method:<br />
<code><br />
  String currentMethod() {<br />
    return Thread.currentThread().getStackTrace()[3].getMethodName();<br />
  }<br />
</code><br />
The number in the stack trace changes depending on how far down you bury this call.<br />
Really handy for unit testing or debug logging (remember to wrap debug logging with logger.isDebug()).</p>
]]></content:encoded>
			<wfw:commentRss>http://javapulse.net/2007/03/01/current-class-and-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestNG: An Alternative to JUnit</title>
		<link>http://javapulse.net/2007/01/12/testing-under-pressure-testng-vs-junit/</link>
		<comments>http://javapulse.net/2007/01/12/testing-under-pressure-testng-vs-junit/#comments</comments>
		<pubDate>Fri, 12 Jan 2007 08:38:12 +0000</pubDate>
		<dc:creator>Clara Ko</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://javapulse.net/?p=63</guid>
		<description><![CDATA[In my experience, testing has always been a necessary but much neglected area of development. The reason for the neglect is often the huge backlog of tests to be created against a mountain of existing code. The compromise in this situation is to test at a higher level than the lowest &#8220;unit&#8221; in unit testing. [...]]]></description>
			<content:encoded><![CDATA[<p>In my experience, testing has always been a necessary but much neglected area of development. The reason for the neglect is often the huge backlog of tests to be created against a mountain of existing code. The compromise in this situation is to test at a higher level than the lowest &#8220;unit&#8221; in unit testing. In testing, I prefer a wide-coverage strategy rather than deep-coverage.</p>
<p>While most of us know JUnit, <a href="http://testng.org/">TestNG</a> is a similar test framework that was designed to test at a slightly higher level than JUnit. On the surface TestNG and JUnit are very similar, especially since JUnit 4 makes use of annotations. In addition to flexible method naming, TestNG provides features that I often missed in JUnit &#8211; namely, test order and dependency.</p>
<p>First of all, TestNG has the concept of a test suite that is more useful than just a dumb grouping in JUnit. You can specify <strong>order</strong> and have <strong>dependency</strong> testing &#8211; skipping, instead of running tests that depend on others that failed. This reminds me of having to name the tests in alphabetical order in JUnit just to impose an order. Dependency testing helps enormously with continuous integration by allowing the test run to finish and report earlier when something goes wrong. The idea is to have an early warning system.</p>
<p>Secondly, TestNG provides <strong>parametric</strong> testing, which means you can run the same test code with different parameters allowing more thorough testing of an area of code. In TestNG, parameters are specified in the annotations. Parametric testing is reminiscent of the <a href="http://fitnesse.org/">FitNesse</a> framework, where parameters are specify in HTML tables. However, as a developer, I prefer to work with XML (testng.xml) than HTML. Also, I find it extremely unlikely that someone (even if non-technical) would feel more comfortable with HTML than XML.</p>
<p>In the end, no matter what test framework you use, it is just a tool. You still have to come up with the right testing strategy. For me, TestNG is a very useful option, especially for higher level comprehensive test coverage.</p>
<p><em>Reference:</em></p>
<ul>
<li><a href="http://www-128.ibm.com/developerworks/java/library/j-cq08296/">In pursuit of code quality: JUnit 4 vs. TestNG</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://javapulse.net/2007/01/12/testing-under-pressure-testng-vs-junit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
