<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>codecentric Blog</title>
	
	<link>http://blog.codecentric.de/en/</link>
	<description>Expertenwissen rund um agile Softwareentwicklung, Java und Performance Solutions.</description>
	<lastBuildDate>Wed, 15 May 2013 14:39:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/codecentric_en" /><feedburner:info uri="codecentric_en" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>codemotion Berlin 2013 technology lab: The aftermath</title>
		<link>http://feedproxy.google.com/~r/codecentric_en/~3/SaKjMBsFTaI/</link>
		<comments>http://blog.codecentric.de/en/2013/05/codemotion-berlin-2013-technology-lab/#comments</comments>
		<pubDate>Wed, 15 May 2013 14:39:03 +0000</pubDate>
		<dc:creator>Ben Ripkens</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Agile Testing]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Flexible Architectures]]></category>
		<category><![CDATA[JavaScript @en]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[2013]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[berlin]]></category>
		<category><![CDATA[codemotion]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[neo4j]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[tech lab]]></category>
		<category><![CDATA[technology lab]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://blog.codecentric.de/?p=18236</guid>
		<description><![CDATA[Two days ago, at the codemotion Berlin 2013, we, i.e. Michael Lex and Ben Ripkens, gave a technology lab. We had an ambitious plan: In three hours we wanted to show typical agile development practices like test-driven development (TDD), acceptance &#8230; <a href="http://blog.codecentric.de/en/2013/05/codemotion-berlin-2013-technology-lab/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Two days ago, at the <a title="codemotion Berlin website" href="http://berlin.codemotionworld.com/">codemotion Berlin 2013</a>, we, i.e. Michael Lex and Ben Ripkens, gave a technology lab. We had an ambitious plan: In three hours we wanted to show typical agile development practices like test-driven development (TDD), acceptance test-driven development (ATDD), continuous integration (CI), continuous delivery (CD) and more while having the attendees work on a small demo project.<span id="more-18236"></span></p>
<p>The idea for this lab is based on the <a title="PSD course" href="http://www.codecentric.de/portfolio/schulungen-und-workshops/professional-scrum-developer/">professional scrum development training course</a> and the <a title="More information about the agile code camp" href="http://www.codecentric.de/portfolio/agile-software-factory/agile-code-camp/">agile code camp</a>. Both events take place over the course of multiple days and additionally focus on agile processes. The professional scrum developer course even covers a few software craftsmanship topics. Shrinking the course duration from several days to a few hours sounds like magic. Unfortunately, we are no magicians (and we failed trying to be).</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://blog.codecentric.de/files/2013/05/2013-05-11-10.42.47.jpg"><img class="aligncenter  wp-image-18246" title="Attendees hacking on the project" alt="Attendees hacking on the project" src="http://blog.codecentric.de/files/2013/05/2013-05-11-10.42.47-1024x768.jpg" width="512" height="384" /></a></p>
<p style="text-align: center;">
<p style="text-align: center;">
<h2>Goal</h2>
<p>Originally it was planned to solely focus the technology lab on shiny new technologies like Neo4j, Riak and Node.JS. We shifted to development practices though as we figured that this is exactly what Berlin&#8217;s developer community needs: The start-up scene, of which there is a highly active one in Berlin, has little need for big data technologies. Sure, many of them are helpful, but would it not be more useful to help them ship awesome products and through this help them reach a state where they might actually need to cope with big data issues?</p>
<p>A plan was made: Avoid bureaucracy, avoid some of the overhead that typically comes with development methods (we should probably avoid our agile evangelists for the next few weeks after publishing this) and instead show them techniques and practices, that are cheap, easy to follow, and result in a higher software quality.</p>
<p>The Legendary <em>movie database</em> project was chosen for the lab. The domain is simple: You have movies and actors. Actors can play roles in movies. That’s it! The application would therefore support basic CRUD (create, read, update, delete) operations for movies. Attendees would add CRUD support for actors and work on some usability improvements.</p>
<p><em>In case you lost count: This is actually the fourth instalment of the movie database! There are also versions that implement <a title="The project hosted on GitHub" href="https://github.com/tobiasflohre/movie-database">ROCA</a>, use <a title="The source code on GitHub" href="https://github.com/bripkens/movie-database-spa">AngularJS with requireJS</a> and a <a title="The sources on GitHub" href="https://github.com/mlex/sencha-touch-demo">mobile version with Sencha Touch</a>.</em></p>
<h2>Technology Stack</h2>
<p>As far as the chosen technologies are concerned, we deviated from codecentric’s standard technology stack and chose one which attendees can easily dive into while leveraging existing knowledge. Specifically, we chose JavaScript as the main language. By doing so we were able to use the same language for server and client code. This led to the next technologies: Node.JS for the server side combined with express as a web framework and AngularJS for the front end. Data persistence was done using Neo4j. While not actually necessary, Neo4j is interesting and simple at the same time and therefore a good match for the technology lab.</p>
<p>We further integrated a fair share of testing libraries and frameworks. On the server side, the choice fell on the mocha framework, which is great for testing asynchronous code. For the unit tests, we mocked the Neo4j service using Sinon.JS. On the client side, we used Karma together with Jasmine for both unit-tests and end-to-end-tests.</p>
<p>You can check out <a title="The source on GitHub" href="https://github.com/codecentric/movie-database-node">the project on GitHub</a> to see the whole technology stack. The project comes with a readme that explains all necessary steps for building, testing and running the application. Dependencies are properly declared in the <em>package.json</em> and can be looked up through the <a title="The NPM registry. A service similar to Maven Central" href="https://npmjs.org/">NPM registry</a>.</p>
<h2>Preparation</h2>
<p>The timebox was the hardest challenge. The goal required every team to have a continuous integration and delivery infrastructure as well as local development environments and a version control system. To cope with this, we set up everything in advance:</p>
<ul>
<li>Six forks of the project on GitHub under six different users that were created just for this purpose. Attendees were organised in groups in the beginning of the technology lab and added to these projects as collaborators (which grants them commit permissions).</li>
<li>The six repositories were connected to Travis-CI for continuous integration. Every commit would therefore result in an execution of a static source code analysis, unit and integration test execution as well as deployment to Heroku.</li>
<li>Heroku was used as the target platform. Each team got his own Heroku app. The redeployment was triggered automatically by Travis-CI.</li>
</ul>
<p>This resulted in a time frame of about 10 minutes from the push to GitHub until a finished deployment to Heroku. The best part: Attendees are not required to fiddle around with Travis-CI secure environments and Heroku configuration.</p>
<p>We prepared thumb drives with VirtualBox images for the attendees’ local development environments. The virtual box image contained everything necessary like an editor, a local database instance, all project dependencies, manuals and cheat sheets for the central frameworks and libraries and of course a fresh clone of the project’s repository.</p>
<h2>Lab Outcome</h2>
<p>As you might have expected, three hours were not enough time for this technology lab. In fact, the attendees just managed to get an overlook about the application’s sources and made a few modifications to the server and client side. Tests were not written by any of the participants, but questions were asked a lot about test execution and inner workings of the testing frameworks. Overall, the number of source files does not seem to have been a problem, but the number of libraries and their combination was too hard to grasp.</p>
<p>Agile practices suffered in the same way that tests suffered: While the interest in Travis-CI and Heroku was great and the simple configuration got much applause, the attendees had little use for continuous integration during the lab. It was simply not enough time to work independently on tasks and therefore to collaborate through the version control system and see the benefits of CI and CD. At least one agile practice got full attention: Pair programming was done throughout the three hours. Confronted with this bunch of new technologies, the attendees actively shared their insights and worked together by twos or threes on one machine.</p>
<p>On the other hand, preparation and setup went perfectly fine. Every attendee had VirtualBox installed and was able to import the virtual machine without any issues. The first participant to finish the setup was able to work on the code and commit something to their repository after 15 minutes. The decision to go without detailed setup instructions and instead rely completely on VirtualBox was proven right.</p>
<p>In the end, both, the attendees and we as coaches, were satisfied with the technology lab. The attendees further encouraged us to do the technology lab over the course of a full day as this would enable them to dive deeper into other interesting parts of the application like Neo4j and Karma (both of which the participants barely got in contact with). A full-day-course would also leave enough time, to not just learn about agile practices, but really use them. It is one thing to see how easy it is to configure Travis-CI and Heroku, but only by writing tests (and seeing the CI go red), that you can really appreciate it.</p>
<p>In addition to more time, code documentation combined with an architecture overview would surely help the participants. Most tasks were accompanied by hints, which proved to be very helpful for both teams. We need to evaluate how we further support the participants, without simply telling them the solution. Something which is not always easy.</p>
<p>We would love to do this technology lab again, either at a conference or as a separate event. We had a great time. The positive feedback and the great interest in the chosen practices and technologies confirmed that we are moving in the right direction. We hope to see you again next time, but then hopefully for more than just three hours <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .
<div class="dzone_button" style="float: right;     margin-top: 30px">
<iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&#038;url=http%3A%2F%2Fblog.codecentric.de%2Fen%2F2013%2F05%2Fcodemotion-berlin-2013-technology-lab%2F&#038;title=codemotion+Berlin+2013+technology+lab%3A+The+aftermath" height="25" width="155" scrolling="no" frameborder="0"></iframe>
</div>
<img src="http://feeds.feedburner.com/~r/codecentric_en/~4/SaKjMBsFTaI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.codecentric.de/en/2013/05/codemotion-berlin-2013-technology-lab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.codecentric.de/en/2013/05/codemotion-berlin-2013-technology-lab/</feedburner:origLink></item>
		<item>
		<title>Robot Framework Tutorial – Loops, Conditional Execution and more</title>
		<link>http://feedproxy.google.com/~r/codecentric_en/~3/W08nPJeTavI/</link>
		<comments>http://blog.codecentric.de/en/2013/05/robot-framework-tutorial-loops-conditional-execution-and-more/#comments</comments>
		<pubDate>Mon, 06 May 2013 19:44:01 +0000</pubDate>
		<dc:creator>Thomas Jaspers</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Agile Testing]]></category>
		<category><![CDATA[Robot Framework @en]]></category>

		<guid isPermaLink="false">http://blog.codecentric.de/?p=18118</guid>
		<description><![CDATA[So far this blog series was dealing more with the higher-level concepts of the Robot Framework. Now this means it is really about time to dig into some very basic features the Robot Framework is offering. All of those features &#8230; <a href="http://blog.codecentric.de/en/2013/05/robot-framework-tutorial-loops-conditional-execution-and-more/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>So far this blog series was dealing more with the <a href="http://blog.codecentric.de/en/2012/03/robot-framework-tutorial-overview/">higher-level</a>  <a href="http://blog.codecentric.de/en/2012/04/robot-framework-tutorial-a-complete-example/">concepts</a> of the <em>Robot Framework</em>. Now this means it is really about time to dig into some very basic features the <em>Robot Framework</em> is offering. All of those features are coming directly with the <a href="http://code.google.com/p/robotframework/wiki/TestLibraries">Standard Libraries</a> which are installed right away with every <em>Robot Framework</em> installation. Thus to follow the examples from this article there is nothing more needed that a pure <em>Robot Framework</em> installation. (Please note that you can download all examples at the end of this blog post.)</p>
<p><span id="more-18118"></span></p>
<h2>Loops and Repeating Keywords</h2>
<p>Let&#8217;s start with Loops. Those can come in quite handy at times and the Robot Framework is supporting them in quite some different flavours:</p>
<ul>
<li>Looping over a <b>list of elements</b>.</li>
<li>Looping over a <b>range of numbers</b>.</li>
<li><b>Repeating</b> a single keyword several times.</li>
</ul>
<p>The latter one is a bit different from the real loops as it means that all actions are really put into one <em>Keyword</em> (sometimes this might be meaningful and sometimes not). Furthermore it is not possible to exit (break) such a loop before all iterations have been finished.</p>
<p>Let&#8217;s take a look at some examples:</p>
<hr />
<p><b>The Tests</b></p>
<pre>
*** Settings ***
Library           String

*** Test Cases ***
For-Loop-In-Range
    : FOR    ${INDEX}    IN RANGE    1    3
    \    Log    ${INDEX}
    \    ${RANDOM_STRING}=    Generate Random String    ${INDEX}
    \    Log    ${RANDOM_STRING}

For-Loop-Elements
    @{ITEMS}    Create List    Star Trek    Star Wars    Perry Rhodan
    :FOR    ${ELEMENT}    IN    @{ITEMS}
    \    Log    ${ELEMENT}
    \    ${ELEMENT}    Replace String    ${ELEMENT}    ${SPACE}    ${EMPTY}
    \    Log    ${ELEMENT}

For-Loop-Exiting
    @{ITEMS}    Create List    Good Element 1    Break On Me    Good Element 2
    :FOR    ${ELEMENT}    IN    @{ITEMS}
    \    Log    ${ELEMENT}
    \    Run Keyword If    '${ELEMENT}' == 'Break On Me'    Exit For Loop
    \    Log    Do more actions here ...

Repeat-Action
    Repeat Keyword    2    Log    Repeating this ...
</pre>
<p><b>The Output</b></p>
<pre>
Starting test: StandardLoopDemo.For-Loop-In-Range
20130426 11:24:14.389 :  INFO : 1
20130426 11:24:14.390 :  INFO : ${RANDOM_STRING} = B
20130426 11:24:14.390 :  INFO : B
20130426 11:24:14.391 :  INFO : 2
20130426 11:24:14.392 :  INFO : ${RANDOM_STRING} = ih
20130426 11:24:14.392 :  INFO : ih
Ending test:   StandardLoopDemo.For-Loop-In-Range

Starting test: StandardLoopDemo.For-Loop-Elements
20130426 11:24:14.394 :  INFO : @{ITEMS} = [ Star Trek | Star Wars | Perry Rhodan ]
20130426 11:24:14.395 :  INFO : Star Trek
20130426 11:24:14.396 :  INFO : ${ELEMENT} = StarTrek
20130426 11:24:14.396 :  INFO : StarTrek
20130426 11:24:14.397 :  INFO : Star Wars
20130426 11:24:14.398 :  INFO : ${ELEMENT} = StarWars
20130426 11:24:14.398 :  INFO : StarWars
20130426 11:24:14.399 :  INFO : Perry Rhodan
20130426 11:24:14.400 :  INFO : ${ELEMENT} = PerryRhodan
20130426 11:24:14.400 :  INFO : PerryRhodan
Ending test:   StandardLoopDemo.For-Loop-Elements

Starting test: StandardLoopDemo.For-Loop-Exiting
20130426 11:24:14.402 :  INFO : @{ITEMS} = [ Good Element 1 | Break On Me | Good Element 2 ]
20130426 11:24:14.402 :  INFO : Good Element 1
20130426 11:24:14.403 :  INFO : Do more actions here ...
20130426 11:24:14.404 :  INFO : Break On Me
Ending test:   StandardLoopDemo.For-Loop-Exiting

Starting test: StandardLoopDemo.Repeat-Action
20130426 11:24:14.408 :  INFO : Repeating keyword, round 1/2
20130426 11:24:14.408 :  INFO : Repeating this ...
20130426 11:24:14.408 :  INFO : Repeating keyword, round 2/2
20130426 11:24:14.409 :  INFO : Repeating this ...
Ending test:   StandardLoopDemo.Repeat-Action
</pre>
<hr />
<p>Probably there is not too much to explain here as the syntax is pretty straight forward. One important thing to consider is that <em>Keywords</em> belonging to a loop-block have to be escaped as shown above using a &#8220;\&#8221;.</p>
<blockquote><p>
<b>FAIL : FOR loop contains no keywords.</b> &#8211; Not escaping the lines that belong to a certain loop will result in the before mentioned error message when executing the tests.
</p></blockquote>
<p>The above examples also already show some of the <em>String Operations</em> and features for <em>Conditional Execution</em> that are discussed in more detail in the following chapters.</p>
<h2>Conditional Execution of Keywords</h2>
<p><em>Conditional Execution</em> of test code is something that can lead to quite some controversial discussions. No worries, I am not going to dig into those. The only thing that we should keep in mind is that the implementation of tests should be as simple and clear as possible. Adding a lot of conditions might contradict this approach. </p>
<p>In the following examples these related <em>Keywords</em> have been used:</p>
<ul>
<li><b>Run Keyword</b> &#8211; This one is pretty cool as it allows to pass in a <em>Keyword</em> in a Variable. This makes it possible to create quite some dynamic to the tests as the Keyword to be executed could be returned from another keyword. Can be used to do either pretty neat things or to produce total chaos <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</li>
<li><b>Run Keyword If</b> &#8211; This is very helpful when testing complex structures. This could be for example dynamic web pages that enable/disable certain fields based on some input data. When used properly it can be used to create if/else-like structures. But be careful: The more programming there is inside the tests the more difficult it is to do troubleshooting if tests are failing.</li>
<li><b>Run Keyword And Ignore Error</b> &#8211; Honestly I did not yet had any real-life usecase for this. It is just another example what is possible with the <em>Robot Framework</em>.</li>
</ul>
<p>Looking into the <a href="http://robotframework.googlecode.com/hg/doc/libraries/BuiltIn.html?r=2.7.7#Run%20Keyword">documentation of the Build-In Library</a> one can see that there are a lot more of those <em>Keywords</em>. Especially <em>Keywords</em> like &#8220;Run Keyword If Test Failed&#8221; can be very useful for troubleshooting by putting for example screenshots or other information to the <em>Robot Log</em> in case of failing testcases.</p>
<hr />
<p><b>The Tests</b></p>
<pre>
*** Test Cases ***
Run-Keyword
    ${MY_KEYWORD}=    Set Variable    Log
    Run Keyword    ${MY_KEYWORD}    Test

Run-Keyword-If
    ${TYPE}=    Set Variable    V1
    Run Keyword If    '${TYPE}' == 'V1'    Log     Testing Variant 1
    Run Keyword If    '${TYPE}' == 'V2'    Log    Testing Variant 2
    Run Keyword If    '${TYPE}' == 'V3'    Log    Testing Variant 3

Run-Keyword-Ignore-Error
    @{CAPTAINS}    Create List    Picard    Kirk    Archer
    Run Keyword And Ignore Error    Should Be Empty    ${CAPTAINS}
    Log    Reached this point despite of error
</pre>
<p><b>The Output</b></p>
<pre>
Starting test: Robot Blog.StandardConditionDemo.Run-Keyword
20130426 13:34:50.840 :  INFO : ${MY_KEYWORD} = Log
20130426 13:34:50.841 :  INFO : Test
Ending test:   Robot Blog.StandardConditionDemo.Run-Keyword

Starting test: Robot Blog.StandardConditionDemo.Run-Keyword-If
20130426 13:34:50.843 :  INFO : ${TYPE} = V1
20130426 13:34:50.844 :  INFO : Testing Variant 1
Ending test:   Robot Blog.StandardConditionDemo.Run-Keyword-If

Starting test: Robot Blog.StandardConditionDemo.Run-Keyword-Ignore-Error
20130426 13:34:50.847 :  INFO : @{CAPTAINS} = [ Picard | Kirk | Archer ]
20130426 13:34:50.848 :  INFO : Length is 3
20130426 13:34:50.849 :  FAIL : '[u'Picard', u'Kirk', u'Archer']' should be empty
20130426 13:34:50.850 :  INFO : Reached this point despite of error
Ending test:   Robot Blog.StandardConditionDemo.Run-Keyword-Ignore-Error
</pre>
<hr />
<h2>Working with Strings and Lists</h2>
<p>Well, basically there is a full programming interface &#8211; as used from higher level programming languages &#8211; available here. The following short example shows some very basic usage. It is probably a very good idea to browse the available keywords of the <a href="https://code.google.com/p/robotframework/wiki/CollectionsLibrary">Collection Library</a> and the <a href="https://code.google.com/p/robotframework/wiki/StringLibrary">String Library</a> just to get an idea what functionality is available.</p>
<hr />
<p><b>The Tests</b></p>
<pre>
*** Settings ***
Library           String
Library           Collections

*** Test Cases ***
StringsAndLists
    ${SOME_VALUE}=    Set Variable    "Test Value"
    Log    ${SOME_VALUE}
    @{WORDS}=    Split String    ${SOME_VALUE}    ${SPACE}
    ${FIRST}=    Get From List    ${WORDS}    0
    Log    ${FIRST}
</pre>
<p><b>The Output</b></p>
<pre>
Starting test: Robot Blog.StandardStringsAndListsDemo.StringsAndLists
20130506 21:21:05.880 :  INFO : ${SOME_VALUE} = "Test Value"
20130506 21:21:05.881 :  INFO : "Test Value"
20130506 21:21:05.882 :  INFO : @{WORDS} = [ "Test | Value" ]
20130506 21:21:05.882 :  INFO : ${FIRST} = "Test
20130506 21:21:05.883 :  INFO : "Test
Ending test:   Robot Blog.StandardStringsAndListsDemo.StringsAndLists
</pre>
<hr />
<p>So far to get some ideas of the more basic functionality of the <em>Robot Framework</em>. At the time of writing this blog I was also trying out the latest version (in this case 1.1) <a href="https://github.com/robotframework/RIDE/wiki">of the Robot-IDE (RIDE)</a>. And I have to say it worked really well and tests could be executed right away from the IDE without any problems. Here are two screenshots to give some impressions.</p>
<div id="attachment_18181" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.codecentric.de/files/2013/05/ride_1.png"><img src="http://blog.codecentric.de/files/2013/05/ride_1-300x232.png" alt="Editing Testcases with RIDE" width="300" height="232" class="size-medium wp-image-18181" /></a><p class="wp-caption-text">Editing Testcases with RIDE</p></div>
<div id="attachment_18182" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.codecentric.de/files/2013/05/ride_2.png"><img src="http://blog.codecentric.de/files/2013/05/ride_2-300x232.png" alt="Executing Testcases from RIDE" width="300" height="232" class="size-medium wp-image-18182" /></a><p class="wp-caption-text">Executing Testcases from RIDE</p></div>
<p>You can download all examples from the <a href="http://blog.codecentric.de/files/2013/05/robot_blog.zip">following ZIP-file</a>.</p>
<hr />
<strong>Robot Framework Tutorial</strong></p>
<p>Part I: <a href="http://blog.codecentric.de/en/2012/03/robot-framework-tutorial-overview/">Robot Framework Tutorial – Overview</a><br />
Part II: <a href="http://blog.codecentric.de/en/2012/04/robot-framework-tutorial-a-complete-example/">Robot Framework &#8211; A complete example</a><br />
Part III: <a href="http://blog.codecentric.de/en/2012/01/robot-framework-ide-ride-overview/">Robot Framework IDE</a><br />
Part IV: <a href="http://blog.codecentric.de/en/2010/07/how-to-structure-a-scalable-and-maintainable-acceptance-test-suite/">How to Structure a Scalable And Maintainable Acceptance Test Suite</a><br />
Part V: <a href="http://blog.codecentric.de/en/2012/06/robot-framework-tutorial-writing-keyword-libraries-in-java/">Robot Framework Tutorial – Writing Keyword Libraries in Java</a><br />
Part VI: Robot Framework Tutorial &#8211; Loops, Conditional Execution and more
<div class="dzone_button" style="float: right;     margin-top: 30px">
<iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&#038;url=http%3A%2F%2Fblog.codecentric.de%2Fen%2F2013%2F05%2Frobot-framework-tutorial-loops-conditional-execution-and-more%2F&#038;title=Robot+Framework+Tutorial+%26%238211%3B+Loops%2C+Conditional+Execution+and+more" height="25" width="155" scrolling="no" frameborder="0"></iframe>
</div>
<img src="http://feeds.feedburner.com/~r/codecentric_en/~4/W08nPJeTavI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.codecentric.de/en/2013/05/robot-framework-tutorial-loops-conditional-execution-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.codecentric.de/en/2013/05/robot-framework-tutorial-loops-conditional-execution-and-more/</feedburner:origLink></item>
		<item>
		<title>Monitoring Spring Batch with AppDynamics</title>
		<link>http://feedproxy.google.com/~r/codecentric_en/~3/1Q3dWoJ1NjY/</link>
		<comments>http://blog.codecentric.de/en/2013/04/monitoring-spring-batch-with-appdynamics/#comments</comments>
		<pubDate>Sun, 28 Apr 2013 19:45:53 +0000</pubDate>
		<dc:creator>Tobias Flohre</dc:creator>
				<category><![CDATA[Java @en]]></category>
		<category><![CDATA[Performance @en]]></category>
		<category><![CDATA[Spring @en]]></category>

		<guid isPermaLink="false">http://blog.codecentric.de/?p=18112</guid>
		<description><![CDATA[When running Spring Batch in production it&#8217;s always good to keep an eye on performance. And in pre-production it&#8217;s helpful to have a tool that points to the weak spots. One option you have is to use Application Performance Management &#8230; <a href="http://blog.codecentric.de/en/2013/04/monitoring-spring-batch-with-appdynamics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>When running Spring Batch in production it&#8217;s always good to keep an eye on performance. And in pre-production it&#8217;s helpful to have a tool that points to the weak spots. One option you have is to use Application Performance Management (APM) tools, and one of them is AppDynamics. In this post I describe how you need to configure AppDynamics to efficiently monitor Spring Batch jobs.<br />
<span id="more-18112"></span></p>
<h2>Business transactions</h2>
<p>AppDynamics has the concept of business transactions that you monitor. Business transactions have an entry point, and everything that happens afterwards belongs to the transaction, in our case it&#8217;s a call graph of Java objects, some SQL communication with a database and optionally other resources that may be accessed.<br />
There are different possibilities to define entry points for a transaction, one very common entry point is a Servlet for web applications. AppDynamics is able to autodetect different business transactions for different types of entry points.<br />
For each business transaction type AppDynamics collects data depending on your configuration. In general it counts the number of calls and measures the time needed for it. If there are some calls that are very slow it starts a diagnostic session and records call graphs for the calls. And even without slow calls AppDynamics records a call graph here and there. You can even see the SQL statements made during the call.</p>
<h2>A business transaction for Spring Batch</h2>
<p>So, what is a good business transaction in batch processing? If our batch program is started by a web request, we could define this request as the entry point of our business transaction. Is that a good choice? A call would then span the whole batch job execution, and that&#8217;s a bad idea. Just think of the possible call graph, it would be really really big if AppDynamics wouldn&#8217;t cut it anyway. And we cannot compare performance if we just get one call per week (or how often your batch job runs).<br />
A better choice is having the execution of a tasklet as a business transaction. Implementations of the interface <code>org.springframework.batch.core.step.tasklet.Tasklet</code> are responsible for processings inside a step. Its method execute is called as long as it returns <code>RepeatStatus.CONTINUABLE</code>, and each call is done in its own transaction. If you&#8217;re now asking yourself what the <code>Tasklet</code> has to do with your batch job, because you&#8217;re only using chunk based processing:  There&#8217;s the implementation <code>ChunkOrientedTasklet</code>, which is used whenever you do chunk based processing, so even then the interface <code>Tasklet</code> is an adequate entry point for monitoring.<br />
One more thing to think about: if we configure a business transaction for the interface <code>Tasklet</code> we cannot tell for which kind of batch job the tasklet was run. We need to find a way to distinguish between different jobs. And we will, as you can see in the next paragraph.</p>
<h2>How to configure the business transaction</h2>
<p>We will configure a POJO business transaction. Click Configure -> Instrumentation and select your application. If you&#8217;re not on the tab &#8216;Transaction Detection&#8217;, switch to it. Scroll down to &#8216;Custom Rules&#8217; and hit the &#8216;+&#8217; button to add a custom match rule.<br />
Choose &#8216;POJO&#8217; as the Entry Point type, then choose a name for the transaction. In the tab &#8216;Transaction Match Criteria&#8217; choose &#8216;Match Classes that implements an Interface which Equals <code>org.springframework.batch.core.step. tasklet.Tasklet</code>&#8216;. As &#8216;Method Name&#8217; type in &#8216;<code>execute</code>&#8216;.<br />
<a href="http://blog.codecentric.de/files/2013/04/Tasklet.png"><img src="http://blog.codecentric.de/files/2013/04/Tasklet-1024x626.png" alt="Tasklet" width="640" height="391" class="alignnone size-large wp-image-18162" /></a></p>
<p>If we would leave the transaction definition like that, we could not tell which call is for which job. We definitely want different transaction definitions for different jobs. We can accomplish this via &#8216;Transaction Splitting&#8217;, so switch to the tab with the same name. Check &#8216;Split POJO Transactions using one of the following mechanisms&#8230;&#8217;, then check &#8216;Use a method parameter to name Transactions&#8217;. The second parameter of the <code>execute</code> method is the <code>ChunkContext</code>, and if we call <code>getStepContext().getJobName()</code> on it, we get the job name, which would be a perfect discriminator for our business transaction. So we choose &#8217;1&#8242; as &#8216;Parameter Index&#8217; and &#8216;<code>getStepContext().getJobName()</code>&#8216; as &#8216;Getter Chain to run on method parameter&#8217;.<br />
<a href="http://blog.codecentric.de/files/2013/04/TransactionSplitting.png"><img src="http://blog.codecentric.de/files/2013/04/TransactionSplitting-1024x360.png" alt="TransactionSplitting" width="640" height="225" class="alignnone size-large wp-image-18164" /></a></p>
<p>Then click on the &#8216;Save&#8217; button and restart the batch server.</p>
<h2>An even better choice?</h2>
<p>If you&#8217;re using <code>Tasklet</code>&#8216;s execute method as the entry point to your business transaction, you don&#8217;t catch all processings that are done in one chunk. You are missing the update-methods of all <code>ItemStream</code>s, you are missing the updates on Spring Batch&#8217;s meta data tables, and you are missing the actual commit of the transaction. If that&#8217;s important for you, you can choose the following &#8216;Transaction Match Criteria&#8217; in your POJO configuration:<br />
&#8216;Match Classes that extends a Super Class that Equals <code>org.springframework.batch.core.scope. context.StepContextRepeatCallback</code>&#8216;.<br />
&#8216;Method Name Equals <code>doInChunkContext</code>&#8216;.<br />
Since the second parameter of the <code>doInChunkContext</code> method is the <code>ChunkContext</code>, the &#8216;Transaction Splitting&#8217; settings can stay the same as above.<br />
<a href="http://blog.codecentric.de/files/2013/04/EvenBetter.png"><img src="http://blog.codecentric.de/files/2013/04/EvenBetter-1024x355.png" alt="EvenBetter" width="640" height="221" class="alignnone size-large wp-image-18165" /></a></p>
<h2>Conclusion</h2>
<p>Monitoring Spring Batch with AppDynamics is a good way to keep an eye on the performance of your batch jobs. I described the instrumentation you need for monitoring Spring Batch jobs, try it out!</p>
<div class="dzone_button" style="float: right;     margin-top: 30px">
<iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&#038;url=http%3A%2F%2Fblog.codecentric.de%2Fen%2F2013%2F04%2Fmonitoring-spring-batch-with-appdynamics%2F&#038;title=Monitoring+Spring+Batch+with+AppDynamics" height="25" width="155" scrolling="no" frameborder="0"></iframe>
</div>
<img src="http://feeds.feedburner.com/~r/codecentric_en/~4/1Q3dWoJ1NjY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.codecentric.de/en/2013/04/monitoring-spring-batch-with-appdynamics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.codecentric.de/en/2013/04/monitoring-spring-batch-with-appdynamics/</feedburner:origLink></item>
		<item>
		<title>Struggling with Test Automation – Potential problems and how to approach them</title>
		<link>http://feedproxy.google.com/~r/codecentric_en/~3/BBFB2HjnHAg/</link>
		<comments>http://blog.codecentric.de/en/2013/04/struggling_with_test-automation_problems_solutions/#comments</comments>
		<pubDate>Fri, 12 Apr 2013 10:43:32 +0000</pubDate>
		<dc:creator>Thomas Jaspers</dc:creator>
				<category><![CDATA[Agile Testing]]></category>
		<category><![CDATA[Agiles Testen]]></category>

		<guid isPermaLink="false">http://blog.codecentric.de/?p=17578</guid>
		<description><![CDATA[Implementing automated acceptance or integration tests as part of a project is a very common thing to do nowadays. Even though already in &#8220;the earlier days&#8221; of software development often some scripting was done to automate certain testing functionality, this &#8230; <a href="http://blog.codecentric.de/en/2013/04/struggling_with_test-automation_problems_solutions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Implementing automated acceptance or integration tests as part of a project is a very common thing to do nowadays. Even though already in &#8220;the earlier days&#8221; of software development often some scripting was done to automate certain testing functionality, this has gained a lot more momentum with the move towards <a href="http://en.wikipedia.org/wiki/Agile_software_development">Agile Software Development</a>. On one side this has let to much better tool support as there is a huge variety of &#8211; freely available &#8211; <em>Test Automation Frameworks</em> available nowadays. But on the other side the complexity of the Software under Test (SuT) and also the demand towards the Automated Tests in complicacy and number is increasing.</p>
<p>The following shows a kind of my personal top-5 list of problems that pop up quite regulary in the context of <em>Test Automation</em> for &#8220;bigger&#8221; (read non-trivial) projects. For sure there is no universally valid solution to those problems, but I nevertheless tried to give some ideas on how to tackle those from my personal experience. If you do not have &#8211; or finally overcome &#8211; these problems I would be very interested to read more on this in the comments section. The same is of course true for different or additional problems (and potential solutions).<br />
<span id="more-17578"></span></p>
<h2>Testdata &#8211; Preparing the database</h2>
<p>Almost any application nowadays depends on some kind of database. And the automated tests rely heavily on the data in that database to produce repeatable results. Now what are some of the problems with setting up this data?</p>
<ul>
<li>Often one is <strong>depending on other systems</strong> and their database contents which is kind of &#8220;out of reach&#8221; to influence from within ones own project.</li>
<li>There is &#8211; for different reasons &#8211; <strong>no dedicated database instance available</strong> that can be used exclusively for the automated tests. This can be quite annoying as manual usage might disturb the results of the automated tests and the automated tests might corrupt the data of &#8220;other users&#8221; of that system.</li>
<li>Defining and/or <strong>finding a proper set of testdata can be difficult</strong> and sometimes requires sevaral iterations. Typically the need for testdata is growing together with the advancement in the development of the SuT.</li>
</ul>
<p>Let&#8217;s not consider some more extreme scenarios where a legacy backend application might make use of some quite special database systems like <a href="http://en.wikipedia.org/wiki/IBM_Information_Management_System">IMS</a> for example. That can make it really hard to initialize testdata from within a <em>Test Framework</em> or some <em>CI-Environment</em>.</p>
<p><strong>The ideas!</strong></p>
<p>The single most important thing to do here is probably communication (which by the way helps with a lot of problems <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). Often people outside the project (sharing the environment) do not really know what we are doing and aiming for with the automated tests. This is especially important if there is no chance to get an own database instance for the <em>CI-Environment</em>, which is quite often the case. If a shared environment is used it might be possible to define a certain set of testdata that can then be exclusively used in the automated tests. Of course organisational solutions are never perfect, but that can work quite well.</p>
<p>The bigger problem might be setting up the testdata, especially when this can be invalidated by changes in other systems outside the project scope. Trying to find a perfect solution here might sometimes simply be impossible. If the potential changes to the external systems are not happening too frequently a reproducable approach in generating valid testdata might be a good choice. In a recent project we have done this by having reusable scripts to load new data to the system and export this into SQL-Scripts. Those can now be re-executed in the initialize phase of the test execution. Using the <a href="http://blog.codecentric.de/en/2012/03/robot-framework-tutorial-overview/">Robot Framework</a> we have then created variables that contain the names/ids of that testdata. By using then only the variables in the actual tests it is possible to switch to a new testdata set without too many problems. (Of course this will work in a similar way also with other <em>Test Frameworks</em>.) </p>
<p>One idea that almost always shows up in the context of testdata creatin is using the own application for it. Often you anyway want to test creating new data sets using the application. Then way not use that data for further tests and in the end also test the deletion using the SuT? Well, it almost never works out. First of all it means that the SuT must be able to create all data that is required, which might be often enough the case. But then for testing with a lot of data the tests will become slow and potentially unstable. And even worth all tests will now depend on the tests creating the data. If those fail there is no chance to tell if any other part of the application is working or not. The tests deleting the data again might also fail leading to quite some dead data in the system that might be growing quickly as these tests are executed often.</p>
<p>Probably the bottom line here is that it is better to have a reproducable approach in creating testdata even if it means some re-work every now and then, than strifing for a perfect solution that might take really a lot of time and might still break in the end.</p>
<h2>Web-Applications &#8211; Fighting with Selenium &#038; Co.</h2>
<p>A lot of <em>Test Automation</em> is done for modern web applications. And <a href="http://docs.seleniumhq.org/">Selenium is the tool of choice</a> quite often here. This is not bad in itself as the problems would be similar with other tools. Nevertheless Selenium is a kind of synonym for testing &#8211; and the corresponding problems &#8211; of web applications.</p>
<p>What are typical problems?</p>
<ul>
<li>Tests are <b>not stable and show different results</b> without any changes in the SuT.</li>
<li>The SuT is based on <b>web frameworks that are hard to test</b>. Luckily I even forgot the name of a web framework that was changing id-values of HTML-elements every time a page was accessed.</li>
<li>Typically the <b>cool things (AJAX) are the ones that are hard to test.</b></li>
</ul>
<p><strong>What can be done?</strong></p>
<p>Again this depends of course heavily on the project environment. Any new project development should have <em>Test Automation</em> in mind from the very beginning. Just do not make your life more complicated than it is anyway. Of course working in or expanding existing systems might not offer too many choices with respect to chosen technologies.</p>
<blockquote><p>
&#8220;Insanity: doing the same thing over and over again and expecting different results.&#8221; -Albert Einstein
</p></blockquote>
<p>One approach that is often missed is to minimize the amount of tests that make use of the GUI. Often we want to test the underlying services and even though it might seem to be more work to implement specific tests accessing the service-layer directly than reusing the GUI for this, it is often the much better solution in the long run. The tests are more stable this way and run a lot faster. </p>
<p>Of course there is always a need to test the application through its GUI as well. But if there are any prerequisites required for certain tests try to perform those not using the GUI (as mentioned above). Again this will minimize the amount of GUI operations using Selenium.</p>
<p>Finally one should of course evaluate new or different approaches for GUI tests if possible. Using the Robot Framework under Java it was for example long time not possible to switch to <a href="https://github.com/rtomac/robotframework-selenium2library">Selenium2Library</a> as it was only working using Python. But luckily now there is <a href="https://groups.google.com/forum/?fromgroups=#!topic/robotframework-users/eD8_iPWjvzk">a port available that supports the Java-side of the Robot Framework</a>. This is just an example that shows that one should always keep an eye on the development of the <em>Test Framework</em> one is using. In early phases of a project availability of certain test functionality will for sure also affect the choice of the <em>Test Framework</em>.</p>
<h2>CI-Server &#8211; Accessing the System</h2>
<p>Your tests will run &#8211; and potentially fail <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  &#8211; on the <a href="http://blog.codecentric.de/en/2009/11/continuous-integration-overview/">CI-environment</a> most of the time. Having a CI-environment is of course an essential part of any test automation solution, but it also can have some stumbling blocks.</p>
<ul>
<li>Developers <b>do not have proper access to the system</b> to perform required configuration tasks. This can slow down the whole development to some extend.</li>
<li>The system is <b>shared among too many projects</b>. This can be especially a problem with the server running the selenium-server. If the tests of one project go mad and is producing for example tons of open browser windows this will have negative impact on all other projects as well.</li>
<li>There is <b>no possibility to login to all parts of the system</b> &#8211; potentially as admin &#8211; to perform for example certain tests steps manually to reproduce error situations that do not occur when testing locally.</li>
</ul>
<p>Unfortunetly these are the kind of problems where often no too many things can be done. Depending on the size of the organisation these things might be simply hard to tackle. In case of problems try to get hold of some &#8220;system guy&#8221; who can help you accessing the system <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . </p>
<h2>Complexity &#8211; Lost in Test Automation</h2>
<p>The complexity of designing a good test automation suite is often highly underestimated. (This goes then also hand in hand with the next point about the project effort.) Writing the tests in a way that those are still maintainable once there are many of them is one challenge. The other challenge is making the tests as independent from changes in the SuT as they can possibly be.</p>
<p>The tool support for refactoring tests is also often not as good as for a programming language like Java for example. Bigger changes to the structure of the tests might be hard to implement of at least they will require a lot of effort. Therefore the &#8220;design-phase&#8221; of the test suite is really really important. The following <a href="http://blog.codecentric.de/en/2010/07/how-to-structure-a-scalable-and-maintainable-acceptance-test-suite/">blog post from my collegue Andreas shows one approach to reach this goal</a>. Of course this has always to be adepted to ones own needs.</p>
<p>Another thing to look at is the amount vs. the quality of the tests. It is most often the goal to test important error situations and of course certain &#8220;good cases&#8221; as well. But is there really a need to have a lot of tests all testing more or less the same functionality in the same way? All these tests have to be maintained as the worth thing that can happen to any test automation is that failed tests are accepted as normal. Be realistic in the amount of tests that can be handled in the project. This will also speed up the overall test execution.</p>
<h2>Test Automation &#8211; No additional project effort, please</h2>
<p>Writing automated tests is effort. And it can even be a lot of effort. Most of the time this effort is very well spent and will pay back by increasing the project quality and saving time in the long run over the lifetime of the project. Nevertheless this is often underestimated and the bad thing that happens then is that it is tried to implement and maintain these tests kind of &#8220;by-the-way&#8221;. Sometimes this might work, but more often the project will end up with tests that do not run properly or are hard to maintain. Quite some projects might also need to build up competences in writing automated tests (using a certain tool), which again takes some time that must be planned as part of the project.</p>
<p>In an agile environment we should clearly come to the point where writing the automated tests is part of every sprint as it is part of the team&#8217;s <em>Definition of Done</em>. Trying to implement the tests at the end of the project is not only a thing that will never work out, but at the end a lot of advantages from having the tests every sprint is then not utilized.
<div class="dzone_button" style="float: right;     margin-top: 30px">
<iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&#038;url=http%3A%2F%2Fblog.codecentric.de%2Fen%2F2013%2F04%2Fstruggling_with_test-automation_problems_solutions%2F&#038;title=Struggling+with+Test+Automation+%26%238211%3B+Potential+problems+and+how+to+approach+them" height="25" width="155" scrolling="no" frameborder="0"></iframe>
</div>
<img src="http://feeds.feedburner.com/~r/codecentric_en/~4/BBFB2HjnHAg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.codecentric.de/en/2013/04/struggling_with_test-automation_problems_solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.codecentric.de/en/2013/04/struggling_with_test-automation_problems_solutions/</feedburner:origLink></item>
		<item>
		<title>Again! – 10 Tips on Java Debugging with Eclipse</title>
		<link>http://feedproxy.google.com/~r/codecentric_en/~3/bJbSUWtoOek/</link>
		<comments>http://blog.codecentric.de/en/2013/04/again-10-tips-on-java-debugging-with-eclipse/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 05:17:57 +0000</pubDate>
		<dc:creator>Daniel Reuter</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java @en]]></category>

		<guid isPermaLink="false">http://blog.codecentric.de/?p=17295</guid>
		<description><![CDATA[You probably know some post of this kind. “n things about debugging” is a popular topic. For a good reason! I guess that I spent about 1 hour per day debugging my applications. That’s quite a lot time. This makes &#8230; <a href="http://blog.codecentric.de/en/2013/04/again-10-tips-on-java-debugging-with-eclipse/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>You probably know some post of this kind. “n things about debugging” is a popular topic. For a good reason! I guess that I spent about 1 hour per day debugging my applications. That’s quite a lot time. This makes it even more important to know all the handy features, that makes your life easier and helps you to safe some time. And it justifies another post on this topic!<br />
&nbsp;<br />
<span id="more-17295"></span></p>
<h4>- First Tip: Don’t debug too much!</h4>
<p>Crazy statement to start a post about debugging. <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  But it must be said! Try to split up your complex logic into many isolated units and write Unit-Tests to check the correct behaviour of your code. I see it very often, that people are clicking through large web-applications, filling out multiple forms, switching to different pages in the flow, just to check a calculation logic on the last page and after that implementing big parts of the logic in the debug view. Before starting your tomcat always ask yourself: Is there a way to check the behaviour with a unit test? But you can find tons of good material about good code design out there, from here I will focus on a few eclipse debugging tips, which you maybe don’t know or you have forgotten over the time.<br />
&nbsp;</p>
<h4>- Breakpoint View : Conditional Breakpoints</h4>
<p>Extreme useful if you are interested only in a special constellation of your application. For example if you want to see the 13th run in a loop or you are debugging functionality in an abstract super class and you only want to see one concrete implementation. You can setup the conditions in the breakpoint-view or with the contextmenu on the blue breakpoint-marker next to your code (“Breakpoint Properties”). You can choose to suspend when your code-snippet gets true or when the value of your snippet changes.<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Conditional-Breakpoints.png"><img src="http://blog.codecentric.de/files/2013/04/Conditional-Breakpoints-300x149.png" alt="Conditional Breakpoints" width="300" height="149" class="aligncenter size-medium wp-image-18026" /></a><br />
<a href="http://blog.codecentric.de/files/2013/04/Conditional-Breakpoints-II.png"><img src="http://blog.codecentric.de/files/2013/04/Conditional-Breakpoints-II-300x110.png" alt="Conditional Breakpoints II" width="300" height="110" class="aligncenter size-medium wp-image-18025" /></a><br />
&nbsp;</p>
<h4>- Variables View: Show Logical Structure</h4>
<p>If you want to see the values of a Map or a List in the variables view, it’s not always that easy with the default setting of eclipse. If you are using a HashMap for example, you have to click through the physical entries and you are confronted with implementation details of a HashMap. But there is a small button above the variables &#8211; “Show Logical Structure”. Very handy, especially if you don’t have meaningful toString()-methods for the objects in your structure. My boss showed me this feature a few weeks ago. You know, he is the guy who is working with PowerPoint or Excel the most time. What a shame for a developer like me <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
&nbsp;<br />
<center>Without &#8220;Show Logical Structure&#8221;</center><br />
<a href="http://blog.codecentric.de/files/2013/04/Logical-Structure-I.png"><img src="http://blog.codecentric.de/files/2013/04/Logical-Structure-I-300x175.png" alt="Logical Structure I" width="300" height="175" class="aligncenter size-medium wp-image-18031" /></a><br />
<center>With &#8220;Show Logical Structure&#8221;</center><br />
<a href="http://blog.codecentric.de/files/2013/04/Logical-Structure-II.png"><img src="http://blog.codecentric.de/files/2013/04/Logical-Structure-II-300x98.png" alt="Logical Structure II" width="300" height="98" class="aligncenter size-medium wp-image-18032" /></a><br />
&nbsp;</p>
<h4>- Variables View: Change Value&#8230;</h4>
<p>Instead of restarting your debug session with some slightly changed input data, let’s say entered in a web-form &#8211; you can also change the values of your variables directly during debugging. Sometimes you can safe some time and sometimes you can simulate some strange behaviour with that feature a bit easier.<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Change-Value.png"><img src="http://blog.codecentric.de/files/2013/04/Change-Value-300x134.png" alt="Change Value" width="300" height="134" class="aligncenter size-medium wp-image-18023" /></a><br />
&nbsp;</p>
<h4>- Display View</h4>
<p>Do you know the “Display View”? You can activate it during debugging via “Window” -&gt; “Show View” -&gt; “Display”. Now there should be a blank new view in your Eclipse. You can use this view to enter and evaluate new code. The code is executed within the context of the current debugging positions, which means that you can use all your variables and even content assist. To execute your code, just mark it and use the context-menu or CTRL+U (execute) or CTRL+SHIFT+I (inspect).<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Display-View.png"><img src="http://blog.codecentric.de/files/2013/04/Display-View-300x188.png" alt="Display View" width="300" height="188" class="aligncenter size-medium wp-image-18029" /></a><br />
&nbsp;</p>
<h4>- Navigation: Drop to Frame</h4>
<p>I think everybody knows “Step Into”, “Step over” and maybe “Step return”. That are the basics to navigate through your code while you are debugging. I want to name 2 further ways to navigate, which I like very much. The first is “Drop to Frame”. With that feature you have the possibility to go back in time <img src='http://blog.codecentric.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  You can simply go to a point in your java stackframe where you have been before. It happens to me quite often, that I am debugging and then missing the point where I have to pay attention. With the “Drop to Frame”-Feature I can then run the code again very simple.<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Drop-to-Frame.png"><img src="http://blog.codecentric.de/files/2013/04/Drop-to-Frame-300x177.png" alt="Drop to Frame" width="300" height="177" class="aligncenter size-medium wp-image-18030" /></a><br />
&nbsp;</p>
<h4>- Navigation: Step into Selection</h4>
<p>The second one is “Step into Selection”. This is a pretty easy one, but not many people are using it. For that, you just have to press Ctrl+Alt and click on a method name, where you want to go. Very handy, very fast. Compared to the usual “Step Into” this is much better for example if you want to enter a method with many parameters and you one step trough all the parameter evaluations. &#8220;Run to line&#8221; is also a nice feature. Just place your cursor in front of the line where you want to stop and hit &#8220;CTRL+R&#8221;.<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Step-Into-Selection.png"><img src="http://blog.codecentric.de/files/2013/04/Step-Into-Selection-300x240.png" alt="Step Into Selection" width="300" height="240" class="aligncenter size-medium wp-image-18035" /></a><br />
&nbsp;</p>
<h4>- Navigation: Use your keyboard</h4>
<p>You are faster, if you avoid to use the mouse. You should know at least the following Shortcuts:</p>
<ul>
<li>F5 &#8211; “Step Into”</li>
<li>F6 &#8211; “Step Over”</li>
<li>F7 &#8211; “Step Return”</li>
<li>F8 &#8211; “Resume”</li>
<li>Ctrl+Shift+B &#8211; “Toggle Breakpoint”</li>
<li>Ctrl+Shift+I &#8211; “Inspect”</li>
</ul>
<p>&nbsp;</p>
<h4>- Breakpoint View: Watchpoints</h4>
<p>What the hell is changing this variable?! Sometimes it is usefull to create a watchpoint. Then the debugger stops, whenever the watched field is changed or just read &#8211; you can configure that. Just doubleclick on a field, then you can see the watchpoint in the Breakpoint View and edit the properties. You can even configure a hit count, means that the debugger only stops, when the entered hit count is reached. This also works for usual breakpoints.<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Watch-Point.png"><img src="http://blog.codecentric.de/files/2013/04/Watch-Point-300x124.png" alt="Watch Point" width="300" height="124" class="aligncenter size-medium wp-image-18036" /></a><br />
&nbsp;</p>
<h4>- Human Readable Objects</h4>
<p>The Variables View is using the toString-Method of your objects to display the value. Because of this it is very, very helpful<br />
to provide good toString-implementations. The javadoc of the default-toString-implementation in java.lang.Object recommends the same:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #339933;">*</span> Returns a string representation of the object. <span style="color: #006633;">In</span> general, the
<span style="color: #339933;">*</span> <span style="color: #339933;">&lt;</span>code<span style="color: #339933;">&gt;</span>toString<span style="color: #339933;">&lt;</span>/code<span style="color: #339933;">&gt;</span> method returns a string that
<span style="color: #339933;">*</span> <span style="color: #0000ff;">&quot;textually represents&quot;</span> <span style="color: #000000; font-weight: bold;">this</span> object. <span style="color: #006633;">The</span> result should
<span style="color: #339933;">*</span> be a concise but informative representation that is easy <span style="color: #000000;  font-weight: bold;">for</span> a
<span style="color: #339933;">*</span> person to read.
<span style="color: #339933;">*</span> It is recommended that all subclasses override <span style="color: #000000; font-weight: bold;">this</span> method.
<span style="color: #009900;">&#91;</span>...<span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p>You can have a look at the <a href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/builder/ToStringBuilder.html" title="ToStringBuilder" target="_blank">ToStringBuilder</a> in commons-lang. It provides some functionality to write &#8211; quote from the javadoc &#8211; “good and consistent” toString-methods.<br />
<center>Default-ToString</center><br />
<a href="http://blog.codecentric.de/files/2013/04/Default-ToString.png"><img src="http://blog.codecentric.de/files/2013/04/Default-ToString-300x180.png" alt="Default-ToString" width="300" height="180" class="aligncenter size-medium wp-image-18027" /></a><br />
<center>Example from ToStringBuilder &#8211; Default</center><br />
<a href="http://blog.codecentric.de/files/2013/04/ReflectionToStringBuilder.png"><img src="http://blog.codecentric.de/files/2013/04/ReflectionToStringBuilder-300x146.png" alt="ReflectionToStringBuilder" width="300" height="146" class="aligncenter size-medium wp-image-18033" /></a><br />
<center>Example from ToStringBuilder &#8211; Multiline-Style</center><br />
<a href="http://blog.codecentric.de/files/2013/04/ReflectionToStringBuilderMultiLine.png"><img src="http://blog.codecentric.de/files/2013/04/ReflectionToStringBuilderMultiLine-300x153.png" alt="ReflectionToStringBuilderMultiLine" width="300" height="153" class="aligncenter size-medium wp-image-18034" /></a><br />
&nbsp;<br />
If you cannot modify the toString-implementation, for example if you are working with frameworks or you have to use a foreign API, it might be an option to create an “Detail Formatter” in Eclipse. To do that, you have to right click an object in the variables view and click on “New Detail Formatter&#8230;”. Then you can provide some code to display this type of Object in the future.<br />
&nbsp;<br />
<a href="http://blog.codecentric.de/files/2013/04/Detail-Formatter.png"><img src="http://blog.codecentric.de/files/2013/04/Detail-Formatter-300x142.png" alt="Detail Formatter" width="300" height="142" class="aligncenter size-medium wp-image-18028" /></a>
<div class="dzone_button" style="float: right;     margin-top: 30px">
<iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&#038;url=http%3A%2F%2Fblog.codecentric.de%2Fen%2F2013%2F04%2Fagain-10-tips-on-java-debugging-with-eclipse%2F&#038;title=Again%21+%26%238211%3B+10+Tips+on+Java+Debugging+with+Eclipse" height="25" width="155" scrolling="no" frameborder="0"></iframe>
</div>
<img src="http://feeds.feedburner.com/~r/codecentric_en/~4/bJbSUWtoOek" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.codecentric.de/en/2013/04/again-10-tips-on-java-debugging-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.codecentric.de/en/2013/04/again-10-tips-on-java-debugging-with-eclipse/</feedburner:origLink></item>
		<item>
		<title>Quick tip: automatically applying Liquibase changesets to HSQL</title>
		<link>http://feedproxy.google.com/~r/codecentric_en/~3/pWcOtpyjF8o/</link>
		<comments>http://blog.codecentric.de/en/2013/04/liquibase-changesets-hsql-automatic-apply/#comments</comments>
		<pubDate>Fri, 05 Apr 2013 06:44:02 +0000</pubDate>
		<dc:creator>Ben Ripkens</dc:creator>
				<category><![CDATA[Java @en]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[featue branch]]></category>
		<category><![CDATA[hsql]]></category>
		<category><![CDATA[inotify]]></category>
		<category><![CDATA[Liquibase]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[schema]]></category>

		<guid isPermaLink="false">http://blog.codecentric.de/?p=17990</guid>
		<description><![CDATA[This is a quick tip for usage of Liquibase with HSQL. You may use the former tool for relational database schema migrations and the latter as in-memory database on the developers&#8217; machines. Today, with feature branches and project customisation, i.e. &#8230; <a href="http://blog.codecentric.de/en/2013/04/liquibase-changesets-hsql-automatic-apply/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>
This is a quick tip for usage of Liquibase with HSQL. You may use the former tool for relational database schema migrations and the latter as in-memory database on the developers&#8217; machines. Today, with feature branches and project customisation, i.e. changes that are specific for a single customer, you may have to shutdown the database, restart and reapply the migrations on a regular basis. Of course, this is a task that can be automated!
</p>
<p><span id="more-17990"></span></p>
<p>
Typical situation: you are working on the project&#8217;s main development branch, but you now wish to review a colleague&#8217;s new feature, which has been developed in a feature branch. You switch to the feature branch, start the server, open the application and <em>BAM</em>, an exception occurs due a failed schema validation. The reason: your colleague made some schema changes in the feature branch that you forgot to apply.
</p>
<p>
Improving your Liquibase and HSQL workflow is rather simple: restart the database whenever the schema changes and apply the migrations! This is how you can do it in bash (sorry Windows users).
</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: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span>
&nbsp;
<span style="color: #007800;">HSQL_PID</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">PROJECT</span>=<span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$1</span> = <span style="color: #ff0000;">&quot;customisation&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Using customer specific changelogs...&quot;</span>
    <span style="color: #007800;">PROJECT</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PROJECT_REPO</span>/customisation&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Using default changelogs...&quot;</span>
    <span style="color: #007800;">PROJECT</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PROJECT_REPO</span>/database&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
control_c<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #007800;">$HSQL_PID</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">trap</span> control_c SIGHUP SIGINT SIGTERM <span style="color: #000000;">0</span>
&nbsp;
start<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># Start HSQL</span>
    java <span style="color: #660033;">-cp</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$M2_REPO</span>/org/hsqldb/hsqldb/2.2.9/hsqldb-2.2.9.jar&quot;</span> \
         org.hsqldb.Server \
         -database.0 mem:myDB \
         -dbname.0 myDB <span style="color: #000000; font-weight: bold;">&amp;</span>
    <span style="color: #007800;">HSQL_PID</span>=<span style="color: #007800;">$!</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Schema update</span>
    mvn <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PROJECT</span>/pom.xml&quot;</span> liquibase:update <span style="color: #660033;">-Plocal</span> <span style="color: #660033;">--no-snapshot-updates</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
start
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">hash</span> inotifywait <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">WATCH_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PROJECT</span>/src/changelogs&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Watching <span style="color: #007800;">$WATCH_DIR</span> for changes...&quot;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Wait for changelog changes</span>
        inotifywait <span style="color: #660033;">--recursive</span> <span style="color: #007800;">$WATCH_DIR</span> \
                    <span style="color: #660033;">--event</span> modify \
                    <span style="color: #660033;">--event</span> move \
                    <span style="color: #660033;">--event</span> create \
                    <span style="color: #660033;">--event</span> delete
&nbsp;
        <span style="color: #666666; font-style: italic;"># Just a precaution: wait until the VCS is done changing the branch</span>
        <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;[Press any key to discard the schema and apply a new one...]&quot;</span>
        <span style="color: #c20cb9; font-weight: bold;">read</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># kill HSQL and wait until it is actually shut down</span>
    <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #007800;">$HSQL_PID</span>
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-0</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$HSQL_PID</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">0.1</span>
    <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
    start
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>
You need to make sure that you have two environment variables setup. There should be a variable <i>PROJECT_REPO</i> which points to the root directory of your project&#8217;s repository and <i>M2_REPO</i> which points to the Maven repository. You may also need to tweak a few paths, e.g. the version of HSQL that you are using as well as the Maven project and profile names. At last, you should install the inotify-tools (unfortunately not available on OS X). inotifywait (part of the inotify-tools) is used to watch the changelog directory for changes. The project&#8217;s Wiki has a section <a href="https://github.com/rvoicilas/inotify-tools/wiki">on installation</a>.
</p>
<p>
Once setup, usage is pretty easy: start the script and let it do the rest. When the inotify-tools are not installed, you need to switch to your terminal and hit <em>&#8220;the any key&#8221;</em> in order to discard the current and apply a new schema.
</p>
<style>
i {
    background: #eee;
    font-family: Monospace;
    font-style: normal;
    font-size: 0.9em;
}
</style>
<div class="dzone_button" style="float: right;     margin-top: 30px">
<iframe src="http://widgets.dzone.com/links/widgets/zoneit.html?t=2&#038;url=http%3A%2F%2Fblog.codecentric.de%2Fen%2F2013%2F04%2Fliquibase-changesets-hsql-automatic-apply%2F&#038;title=Quick+tip%3A+automatically+applying+Liquibase+changesets+to+HSQL" height="25" width="155" scrolling="no" frameborder="0"></iframe>
</div>
<img src="http://feeds.feedburner.com/~r/codecentric_en/~4/pWcOtpyjF8o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.codecentric.de/en/2013/04/liquibase-changesets-hsql-automatic-apply/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.codecentric.de/en/2013/04/liquibase-changesets-hsql-automatic-apply/</feedburner:origLink></item>
	</channel>
</rss><!-- This Quick Cache file was built for ( 80 blog.codecentric.de/en/feed/ ) in 0.78154 seconds, on May 15th, 2013 at 2:48 pm UTC. --><!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 15th, 2013 at 3:48 pm UTC --><!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --><!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for ( 80 blog.codecentric.de/en/feed/ ) in 0.00049 seconds, on May 15th, 2013 at 3:19 pm UTC. -->
