<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://doc.expecco.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jv</id>
	<title>expecco Wiki (Version 25.x) - Benutzerbeiträge [de]</title>
	<link rel="self" type="application/atom+xml" href="https://doc.expecco.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jv"/>
	<link rel="alternate" type="text/html" href="https://doc.expecco.de/wiki/Spezial:Beitr%C3%A4ge/Jv"/>
	<updated>2026-04-26T14:32:09Z</updated>
	<subtitle>Benutzerbeiträge</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Expecco_API/en&amp;diff=4749</id>
		<title>Expecco API/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Expecco_API/en&amp;diff=4749"/>
		<updated>2015-02-03T09:55:34Z</updated>

		<summary type="html">&lt;p&gt;Jv: Make Groovy code in section &amp;quot;Defining a New Class in the System Under Test using Groovy&amp;quot; compilable.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== expecco API ==&lt;br /&gt;
&lt;br /&gt;
The expecco API provides functions and access to the underlying class library for the use in [[Elementary Block|elementary blocks]] written in Smalltalk and JavaScript (i.e. for code which is executed inside expecco itself). This API is not available for elementary blocks written in other languages which are executed by external script engines (Shell, Batch, Python etc.) or inside a Java Virtual Machine (Groovy). &lt;br /&gt;
&lt;br /&gt;
For an short introduction to the Smalltalk programming language,&lt;br /&gt;
please read the [http://live.exept.de/doc/online/english/getstart/tut_2.html Smalltalk tutorial in the Smalltalk/X online manual].&lt;br /&gt;
For a full book on learning Smalltalk, read [http://live.exept.de/doc/books/JoyOfST/JoyOfST.pdf &amp;quot;The joy of Smalltalk, An introduction to Smalltalk&amp;quot; by Ivan Tomek].&lt;br /&gt;
&lt;br /&gt;
The [[#Groovy Elementary Blocks|API for Groovy elementary blocks]] is different and described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;DIV ID=&amp;quot;Smalltalk_Elementary_Blocks&amp;quot;&amp;gt; &amp;lt;/DIV&amp;gt;&lt;br /&gt;
&amp;lt;DIV ID=&amp;quot;JavaScript_Elementary_Blocks&amp;quot;&amp;gt; &amp;lt;/DIV&amp;gt;&lt;br /&gt;
== JavaScript and Smalltalk Elementary Blocks ==&lt;br /&gt;
&lt;br /&gt;
The JavaScript and the Smalltalk API consist of the same functions - both call into the underlying [http://www.smalltalk-x.de Smalltalk/X] system, &lt;br /&gt;
for which extensive documentation is available as &lt;br /&gt;
[http://live.exept.de/doc/online/english/TOP.html Online Documentation] and&lt;br /&gt;
as [http://live.exept.de/ClassDoc Class Reference]. &lt;br /&gt;
&lt;br /&gt;
JavaScript and Smalltalk only differ slightly in their syntax; semantically they are very similar:&lt;br /&gt;
{|  Border &lt;br /&gt;
! JavaScript&lt;br /&gt;
! Smalltalk&lt;br /&gt;
! &lt;br /&gt;
|- &lt;br /&gt;
| this&lt;br /&gt;
| self&lt;br /&gt;
| the current activity&lt;br /&gt;
|- &lt;br /&gt;
| this.functionName()&lt;br /&gt;
| self functionName&lt;br /&gt;
| a call without arguments&lt;br /&gt;
|- &lt;br /&gt;
| this.functionName(&#039;&#039;arg&#039;&#039;)&lt;br /&gt;
| self functionName:&#039;&#039;arg&#039;&#039;&lt;br /&gt;
| a call with one argument&lt;br /&gt;
|- &lt;br /&gt;
| this.namePart1_part2(&#039;&#039;arg1&#039;&#039;,&#039;&#039;arg2&#039;&#039;)&lt;br /&gt;
| self namePart1:&#039;&#039;arg1&#039;&#039; part2:&#039;&#039;arg2&#039;&#039;&lt;br /&gt;
| two arguments&lt;br /&gt;
|- &lt;br /&gt;
| functionName(...)&lt;br /&gt;
| self functionName...&lt;br /&gt;
| implicit this/self receiver&lt;br /&gt;
|- &lt;br /&gt;
| accessor&lt;br /&gt;
| self accessor&lt;br /&gt;
| slot access - implicit this/self send&lt;br /&gt;
|-&lt;br /&gt;
| stat1 ; stat2&lt;br /&gt;
| stat1 . stat2&lt;br /&gt;
| statement terminator / separator&amp;lt;br&amp;gt;(in ST: required to terminate every statement&amp;lt;br&amp;gt;in JS: required to separate)&lt;br /&gt;
|-  &lt;br /&gt;
| if (cond) {&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;ifStats&amp;lt;br&amp;gt;} else {&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;elseStats&amp;lt;br&amp;gt;}&lt;br /&gt;
| cond ifTrue:[&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;ifStats&amp;lt;br&amp;gt;] ifFalse:[&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;elseStats&amp;lt;br&amp;gt;]&lt;br /&gt;
| conditional execution&lt;br /&gt;
|- &lt;br /&gt;
| while (cond) {&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;stats&amp;lt;br&amp;gt;}&lt;br /&gt;
| [ cond ] whileTrue:[&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;stats&amp;lt;br&amp;gt;]&lt;br /&gt;
| while-loop. Notice the extra brackets in Smalltalk&lt;br /&gt;
|- &lt;br /&gt;
| function () { stats }&lt;br /&gt;
| [ stats ]&lt;br /&gt;
| an anonymous (inner) function (called &amp;quot;block&amp;quot; in ST)&lt;br /&gt;
|- &lt;br /&gt;
| function (a1, a2,...) { stats }&lt;br /&gt;
| [:a1 :a2 ...&amp;amp;#124; stats ]&lt;br /&gt;
| in ST: blocks are a reference to an anonymous function&lt;br /&gt;
|- &lt;br /&gt;
| var v1, v2, ... ;&lt;br /&gt;
| &amp;amp;#124; v1 v2 ... &amp;amp;#124;&lt;br /&gt;
| local variables inside a function (or block)&lt;br /&gt;
|- &lt;br /&gt;
| return expr;&lt;br /&gt;
| ^ expr&lt;br /&gt;
| return a value.&amp;lt;br&amp;gt;In ST: a return from within a block returns the enclosing top-level function&amp;lt;br&amp;gt;In JS: a return returns from the inner function&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Smalltalk beginners may be irritated by the missing binary operator precedence rules. In Smalltalk, all operators have the same precedence and are evaluated left to right. Thus, &amp;quot;a + b * 5&amp;quot; in JavaScript means &amp;quot;a + (b * 5)&amp;quot;, whereas in Smalltalk, it is evaluated as &amp;quot;(a + b) * 5&amp;quot;. For this, as a guideline (and actually a strict convention), all Smalltalk expression should be parenthesized to make the intention clear, whenever it conflicts with the intuitive (standard mathematical) precedence. &lt;br /&gt;
&lt;br /&gt;
All functions are actually implemented in Smalltalk and follow the standard Smalltalk naming conventions. The same function names are used for Javascript. As seen above, this scheme works well for functions without or with a single argument, but requires a name translation for functions with more than one argument. This translation is done by the JavaScript compiler by replacing every colon (:) of the Smalltalk name by an underline (_) character, except for the last colon. Thus for example, the Smalltalk name &amp;quot;at:put:&amp;quot; will be replaced to &amp;quot;at_put&amp;quot; in JavaScript.&lt;br /&gt;
&lt;br /&gt;
In JavaScript, a function-name alone (i.e. without explicit receiver) is translated into a self-send; thus &amp;quot;this.foo()&amp;quot; and &amp;quot;foo()&amp;quot; are equivalent.&lt;br /&gt;
&lt;br /&gt;
Also, for non-argument accessor functions (getters), the empty argument list can be omitted in JavaScript; therefore, &amp;quot;foo&amp;quot; and &amp;quot;this.foo&amp;quot;, &amp;quot;foo()&amp;quot; and &amp;quot;this.foo()&amp;quot; are all equivalent.  &lt;br /&gt;
&lt;br /&gt;
For example, the JavaScript call:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;    this.environmentAt(&amp;quot;foo&amp;quot;)&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
is written in Smalltalk as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;    self environmentAt:&#039;foo&#039;&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and, to demonstrate the multi-argument translation rule,&lt;br /&gt;
the Smalltalk code:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;    self environmentAt:&#039;foo&#039; put:1234&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
is written in JavaScript as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;    this.environmentAt_put(&amp;quot;foo&amp;quot;, 1234)&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
For a formal specification of the JavaScript and Smalltalk languages, see the appendixes below.&lt;br /&gt;
The following gives a rough overview over the most common syntactic constructs.&lt;br /&gt;
&lt;br /&gt;
{|  Border &lt;br /&gt;
! JavaScript&lt;br /&gt;
! Smalltalk&lt;br /&gt;
! Notes&lt;br /&gt;
|- &lt;br /&gt;
| this&lt;br /&gt;
| self&lt;br /&gt;
| the current activity&lt;br /&gt;
|- &lt;br /&gt;
| null&lt;br /&gt;
| nil&lt;br /&gt;
| a null reference (UndefinedObject)&lt;br /&gt;
|- &lt;br /&gt;
| ;&lt;br /&gt;
| .&lt;br /&gt;
| Statement Terminator/Separator&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;...&amp;quot;&lt;br /&gt;
| &#039;...&#039;&lt;br /&gt;
| a String constant (JavaScript allows single quotes too)&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| #&#039;...&#039;&lt;br /&gt;
| a Symbol constant (not available in JavaScript)&lt;br /&gt;
|-  &lt;br /&gt;
| [ el1 , el2 , ... ]&lt;br /&gt;
| #( el1 el2 ... )&lt;br /&gt;
| an Array constant (elements must be constants)&lt;br /&gt;
|-&lt;br /&gt;
| [ expr1 , expr2 , ... ]&lt;br /&gt;
| { expr1 . expr2 . ... }&lt;br /&gt;
| a computed Array (notice the expression terminators in ST)&lt;br /&gt;
|-  &lt;br /&gt;
| &lt;br /&gt;
| #[ el1 el2 ... ]&lt;br /&gt;
| a ByteArray constant (not available in JavaScript)&lt;br /&gt;
|-  &lt;br /&gt;
| &lt;br /&gt;
| ( num / den )&lt;br /&gt;
| a Fraction constant (not available in JavaScript)&lt;br /&gt;
|-&lt;br /&gt;
| rcvr.f ()&lt;br /&gt;
| rcvr f&lt;br /&gt;
| function call&lt;br /&gt;
|- &lt;br /&gt;
| rcvr.f (arg)&lt;br /&gt;
| rcvr f: arg&lt;br /&gt;
| with 1 arg&lt;br /&gt;
|- &lt;br /&gt;
| rcvr.a_b (arg1, arg2)&lt;br /&gt;
| rcvr a: arg1 b: arg2&lt;br /&gt;
| with 2 args&amp;lt;br&amp;gt;notice the different names of the function&amp;lt;br&amp;gt;&amp;quot;a_b&amp;quot; vs.&amp;quot;a:b:&amp;quot; &lt;br /&gt;
|- &lt;br /&gt;
| return;&lt;br /&gt;
| ^ self&lt;br /&gt;
| without return value (in ST: from outer function; in JS: from current function)&lt;br /&gt;
|- &lt;br /&gt;
| return expr;&lt;br /&gt;
| ^ expr&lt;br /&gt;
| with return value (in ST: from outer function; in JS: from current function)&lt;br /&gt;
|- &lt;br /&gt;
| return from execute;&lt;br /&gt;
| ^ self&lt;br /&gt;
| return outer from inner function&lt;br /&gt;
|- &lt;br /&gt;
| ! expr&lt;br /&gt;
| expr not&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| e1 &amp;amp;&amp;amp; e2&lt;br /&gt;
| (e1 and:[ e2 ])&lt;br /&gt;
| non evaluating and (e2 is not evaluated if e1 is false)&lt;br /&gt;
|-&lt;br /&gt;
| e1 || e2&lt;br /&gt;
| (e1 or:[ e2 ])&lt;br /&gt;
| non evaluating or (e2 is not evaluated if e1 is true)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Syntactic Sugar ===&lt;br /&gt;
&lt;br /&gt;
Some syntactic constructs of the JavaScript language are implemented as library functions in Smalltalk. Among otherse, most noteworthy are conditional execution (if-the-else) and loops. &lt;br /&gt;
&amp;lt;br&amp;gt;The JavaScript syntax is mapped to corresponding Smalltalk library functions as follows:&lt;br /&gt;
{|  Border &lt;br /&gt;
! JavaScript&lt;br /&gt;
! Smalltalk&lt;br /&gt;
! Notes&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|if (expr) { .. }&lt;br /&gt;
| (expr) ifTrue:[ ... ]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|if (! expr) { .. }&lt;br /&gt;
| (expr) ifFalse:[ ... ]&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| if (expr) { .. }&amp;lt;BR&amp;gt;else { ... }&lt;br /&gt;
| (expr) ifTrue:[ ... ]&amp;lt;BR&amp;gt; ifFalse:[...]&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| while (expr) { .. }&lt;br /&gt;
| [expr] whileTrue:[ ... ]&lt;br /&gt;
| Notice the square brackets&lt;br /&gt;
|- &lt;br /&gt;
| for (expr1;expr2;expr3) { .. }&lt;br /&gt;
| expr; [expr2] whileTrue:[ ... expr3 ]&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| for (var i=start; i &amp;lt;= stop; i += incr) { .. }&lt;br /&gt;
| start to: stop by: incr do:[:i &amp;amp;#124; ... ]&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| try { .. } finally {...}&lt;br /&gt;
| [...] ensure:[...]&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| try { .. } catch(e) {...}&lt;br /&gt;
| [...] on:Error do:[:e &amp;amp;#124; ...]&lt;br /&gt;
|&lt;br /&gt;
|- &lt;br /&gt;
| try { .. } catch(e) {...} finally {...}&lt;br /&gt;
| [ [...] on:Error do:[:e &amp;amp;#124; ...] ] ensure:[ ... ]&lt;br /&gt;
|  &lt;br /&gt;
|- &lt;br /&gt;
| var++&lt;br /&gt;
| var := var + 1&lt;br /&gt;
|&lt;br /&gt;
|- &lt;br /&gt;
| var--&lt;br /&gt;
| var := var - 1&lt;br /&gt;
|&lt;br /&gt;
|- &lt;br /&gt;
| arr[ idx ]&lt;br /&gt;
| arr at: idx&lt;br /&gt;
| Array and Dictionary indexed read&amp;lt;br&amp;gt;Notice that in expecco, JavaScript uses 1-based indexing &lt;br /&gt;
|- &lt;br /&gt;
| arr[ idx ] = expr&lt;br /&gt;
| arr at: idx put: expr&lt;br /&gt;
| Array and Dictionary indexed write&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
{|  Border &lt;br /&gt;
! JavaScript&lt;br /&gt;
! Smalltalk&lt;br /&gt;
! Notes&lt;br /&gt;
|- &lt;br /&gt;
| %&lt;br /&gt;
| \&lt;br /&gt;
| modulu operator&lt;br /&gt;
|- &lt;br /&gt;
| &amp;amp;lt;&amp;amp;lt;&lt;br /&gt;
| bitShift:&lt;br /&gt;
| left-shift; negative shift count is right-shift&lt;br /&gt;
|- &lt;br /&gt;
| &amp;amp;gt;&amp;amp;gt;&lt;br /&gt;
| rightShift:&lt;br /&gt;
| right-shift; negative shift count is left-shift&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Inner Functions ===&lt;br /&gt;
==== Inner Functions in JavaScript ====&lt;br /&gt;
&lt;br /&gt;
It is possible to create functions within the elementary block&#039;s code. This example shows how to do so:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
  execute() {&lt;br /&gt;
    ...&lt;br /&gt;
    function f(arg1, arg2) {&lt;br /&gt;
      return(arg1 + arg2);&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
A inner function f is created with two arguments (arg1, arg2), which returns the sum of both. The function is called like this:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
   f(3,5)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
Inner functions can be used for example to filter specific elements from collections.&lt;br /&gt;
&lt;br /&gt;
Inner functions are &#039;&#039;&#039;first class objects&#039;&#039;&#039;: they can be stored in variables, collections, passed as argument or returned from functions. They can even be passed to other blocks via input- and output pins or via environment variables. Functions can be anonymous; the above example could also be written as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
  execute() {&lt;br /&gt;
    var f;&lt;br /&gt;
    ...&lt;br /&gt;
    f = function (arg1, arg2) {&lt;br /&gt;
      return(arg1 + arg2);&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
(notice the missing function name after the &amp;quot;function&amp;quot; keyword).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice, that there is a difference in the behavior of the return statement between JavaScript inner functions&lt;br /&gt;
and Smalltalk blocks: a JavaScript &amp;quot;return&amp;quot; statement inside an inner function returns from that inner function only, whereas a return in Smalltalk always returns from the outer-most method.&lt;br /&gt;
To return from the outermost function in JavaScript, use the &amp;quot;&amp;lt;CODE&amp;gt;return from &amp;amp;lt;&#039;&#039;fnName&#039;&#039;&amp;amp;gt;&amp;lt;/CODE&amp;gt;&amp;quot; statement form.&lt;br /&gt;
&lt;br /&gt;
In expecco, where the outermost function is always named &amp;quot;&#039;&#039;execute&#039;&#039;&amp;quot;, write:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
    execute&lt;br /&gt;
       ...&lt;br /&gt;
       function myFunction() {&lt;br /&gt;
           ...&lt;br /&gt;
           return from execute;&lt;br /&gt;
       }&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
(notice that the execute function is not supposed to return a value)&lt;br /&gt;
&lt;br /&gt;
==== Inner Functions in Smalltalk (Blocks) ====&lt;br /&gt;
&lt;br /&gt;
In Smalltalk, inner functions are called &amp;quot;block&amp;quot;, and are defined as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
   f := [:arg1 :arg2 | arg1 + arg2 ].&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
This block can be called by sending at a &amp;quot;value:value:&amp;quot; message (one &amp;quot;value:&amp;quot; for each argument):&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
   f value:3 value:5&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
Blocks without argument are defined as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
   f := [ Transcript showCR:&#039;blabla: Euler was great&#039; ].&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
and invoked with a simple &amp;quot;value&amp;quot; message.&lt;br /&gt;
&lt;br /&gt;
Smalltalk blocks and JavaScript inner functions can be used interchangable - i.e. it is possible to pass a JS inner function to a collection method such as &amp;quot;collect:&amp;quot; or &amp;quot;select:&amp;quot;. It is also possible, to pass either via input/output pins to other activities (which is not considered good style, as it could make the program quite hard to understand, if not used with caution).&lt;br /&gt;
&lt;br /&gt;
Notice again, that the behavior of the Smalltalk return (&amp;quot;^&amp;quot;) is different from a JavaScript return (&amp;quot;return-Statement&amp;quot;) inside inner functions. The JavaScript return returns a value from the inner function, whereas the Smalltalk return forces a return from the containing method (the block&#039;s &amp;quot;execute&amp;quot; method). The Smalltalk return always behaves like the &amp;quot;&amp;lt;I&amp;gt;return from execute&amp;lt;/I&amp;gt;&amp;quot; JavaScript special form.&lt;br /&gt;
&lt;br /&gt;
==== Example uses for Inner Functions ====&lt;br /&gt;
&lt;br /&gt;
In Smalltalk, blocks are very often used when enumerating collections. &lt;br /&gt;
For example, code corresponding to a C# 3.0 collection select (where(x =&amp;gt; ...)) is written in Smalltalk as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
    |names namesStartingWithA|&lt;br /&gt;
&lt;br /&gt;
    names := #( &#039;Alice&#039; &#039;Ann&#039; &#039;Bob&#039; &#039;Mallory&#039; ).&lt;br /&gt;
    namesStartingWithA := names select:[:n | n startsWith:&#039;A&#039;].&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
or in JavaSript as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
    var names, namesStartingWithA;&lt;br /&gt;
&lt;br /&gt;
    names = [ &amp;quot;Alice&amp;quot; , &amp;quot;Ann&amp;quot; , &amp;quot;Bob&amp;quot; , &amp;quot;Mallory&amp;quot; ];&lt;br /&gt;
    namesStartingWithA = names.select( function(n) { n.startsWith(&amp;quot;A&amp;quot;); } );&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To find the first element in a collection, for which some condition is true, use:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
    |names firstNameContainingAnO|&lt;br /&gt;
&lt;br /&gt;
    names := #( &#039;Alice&#039; &#039;Ann&#039; &#039;Bob&#039; &#039;Mallory&#039; ).&lt;br /&gt;
    firstNameContainingAnO:= names detect:[:n | n includesString:&#039;o&#039;].&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
or in JavaSript as:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
    var names, firstNameContainingAnO;&lt;br /&gt;
&lt;br /&gt;
    names = [ &amp;quot;Alice&amp;quot; , &amp;quot;Ann&amp;quot; , &amp;quot;Bob&amp;quot; , &amp;quot;Mallory&amp;quot; ];&lt;br /&gt;
    firstNameContainingAnO = names.detect( function(n) { n.includesString(&amp;quot;o&amp;quot;); } );&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
For more information on the Smalltalk syntax, see [[http://live.exept.de/doc/online/english/getstart/tut_2.html Smalltalk Basics]] in the [[http://live.exept.de/doc/online/english/getstart/tutorial.html Smalltalk Online Tutorial]].&lt;br /&gt;
&lt;br /&gt;
=== Builtin Data Types ===&lt;br /&gt;
&lt;br /&gt;
The builtin types below and user defined primary types are mapped to corresponding classes of the underlying Smalltalk runtime system.&lt;br /&gt;
An introductionary overview and links to the detailed documentation of individual classes is found in the &lt;br /&gt;
[http://live.exept.de/doc/online/english/classDoc\TOP.html Smalltalk Class Documentation] of the [http://live.exept.de/doc/online/english/TOP.html Smalltalk/X online documentation]. The following gives a rough summary of the main concepts. A good entry point for further learning is the [http://live.exept.de/doc/online/english/overview/basicClasses/TOP.html Smalltalk/X Basic Classes Overview Document], which provides links to the most heavily used classes and more detailed information.&lt;br /&gt;
&lt;br /&gt;
==== Numeric Types ====&lt;br /&gt;
&lt;br /&gt;
The underlying numeric type implementation supports multiple number represenations. These can be used transparently in mixed-operations, and values are automatically converted as required. For example, the division of two integers returns another integer iff the division does not produce a remainder. Otherwise, a fraction object is returned, if there was a remainder.&lt;br /&gt;
Although very very rarely required in practice,&lt;br /&gt;
values can be converted explicitly, via one of the &amp;quot;asXXX&amp;quot; messages, if required:&lt;br /&gt;
* asFloat()&lt;br /&gt;
* asInteger()&lt;br /&gt;
* asFraction()&lt;br /&gt;
* asFixedPoint(scale)&lt;br /&gt;
&lt;br /&gt;
Thus, if you want to avoid fractions (why would you?), process the result of an integer division using one of the asFloat(), truncated(), floor(), ceiling() or rounded() functions. But be aware that fractions provide an exact result, whereas float arithmetic is inherently inprecise and rounds on the the last bit.&lt;br /&gt;
&lt;br /&gt;
===== Integer =====&lt;br /&gt;
&lt;br /&gt;
This represents arbitrary precision integral numbers. Conversion and memory allocation is completely automatic. Thus, you can write:&lt;br /&gt;
 x = 100.factorial();&lt;br /&gt;
to get the huge number:&lt;br /&gt;
 933262154439441526816992388562667004907159682643816214685929638952175999932299156089&lt;br /&gt;
 41463976156518286253697920827223758251185210916864000000000000000000000000&lt;br /&gt;
&lt;br /&gt;
Small integer values (&amp;lt;32bit or &amp;lt;64bit, depending in the underlying hardware&#039;s native wordlength) are stored more efficiently than large integers - however, the conversion and representation as used by the system is completely transparent and automatic. &lt;br /&gt;
The same is true for mixed mode arithmetic between small and large integers.&lt;br /&gt;
&lt;br /&gt;
Occasionally it is required to perform modulo arithmetic in 32 or 64bit, for example to reproduce or check values as generated by C or Java programs. For this, use methods from the &amp;quot;special modulo&amp;quot; category, such as &amp;quot;add_32:&amp;quot;, &amp;quot;add_32u&amp;quot;, &amp;quot;mul_32&amp;quot; etc. Use a  class browser to find those methods.&lt;br /&gt;
&lt;br /&gt;
Integer constants (of arbitrary size) can be given in hexadecimal (Smalltalk: 16rxxx, JavaScript 0xXXXX), octal (Smalltalk: 8rxxx, JavaScript 0XXXX), and binary (only in Smalltalk: 2rxxx).&lt;br /&gt;
&lt;br /&gt;
[[http://live.exept.de/doc/online/english/overview/basicClasses/numeric.html#INTEGER More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Integer Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Float =====&lt;br /&gt;
&lt;br /&gt;
Float represents double precision IEEE floating point numbers (64bit).&lt;br /&gt;
Although seldom needed, conversion to single precision (32bit) and high precision (80bit/128bit, depending on the underlying hardware) is possible via the &#039;&#039;asShortFloat()&#039;&#039; and &#039;&#039;asLongFloat()&#039;&#039; conversion functions.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/numeric.html#FLOAT More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Float Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Fraction =====&lt;br /&gt;
&lt;br /&gt;
Fractions are arbitrary-precision rational numbers. You will get them when dividing two integers and the result is not integral. For example:&lt;br /&gt;
 1 / 3&lt;br /&gt;
returns a fraction result with a numerator of 1 and a denominator of 3 (as opposed to the // operator, which truncates the result of the division to an integer). Fractions have the advantage of avoiding rounding errors; thus, when the above fraction is divided by 3, you will get &#039;&#039;(1/9)&#039;&#039;, which we can multiply by 9 to get the exact &#039;&#039;1&#039;&#039; (an integer) without any rounding error. Be reminded that this is typically not the case with Float or Double precision numbers. Due to rounding errors on the last bit, you will often get 0.9999999 as a result there. &lt;br /&gt;
&lt;br /&gt;
Fractions automatically reduce themself - therefore, when adding &#039;&#039;(1/3) + (2/6)&#039;&#039;, you will get &#039;&#039;(2/3)&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/numeric.html#FRACTION More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Fraction Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== FixedPoint=====&lt;br /&gt;
&lt;br /&gt;
FixedPoint numbers are decimals, with a configurable number of post-decimal digits. They are typically used when dealing with money. Like fractions, they avoid rounding errors. However, when printed, they round in their last digit (however, the exact information is always kept for further processing). FixedPoint numbers are perfect to represent money and other fractional data, which must be represented with a fixed number of post-decimal digits.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/numeric.html#FIXEDPOINT More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,FixedPoint Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Number =====&lt;br /&gt;
&lt;br /&gt;
The Number type is an abstract union type which includes all of the above types. Thus, a variable declared as being of &amp;quot;Number&amp;quot; type can take any of the above values. Due to the polymorphic implementation of the underlying numeric class library, most operations can be passed any of the above values (even mixing arguments is possible). For example, the &amp;quot;Add&amp;quot; elementary block, which is implemented by simply calling the Smalltalk &amp;quot;+&amp;quot; operation, is able to deal with any combination of argument types. &lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/numeric.html#NUMBER More Info]]&lt;br /&gt;
&lt;br /&gt;
==== String Types ====&lt;br /&gt;
&lt;br /&gt;
Strings can come in two flavours, depending on how many bits are required to encode the character&#039;s codePoint. In general, UNICODE is used internally as the encoding. However, converters are available to translate into other encodings, such as JIS or ISO8859-x. &lt;br /&gt;
&lt;br /&gt;
===== String=====&lt;br /&gt;
&lt;br /&gt;
This is used to represent character strings, where each individual character has a one-byte encoding. I.e. the values are 0..255.&lt;br /&gt;
Individual characters can be accessed by an integral index starting with 1 in both Smalltalk and JavaScript.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#STRING More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,String Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Unicode16String =====&lt;br /&gt;
&lt;br /&gt;
This is used to represent character strings, where at least one character needs a two-byte encoding. I.e. any value is in the range 0x0100 .. 0xFFFF. In fact, there is even a Unicode32String class, which supports the full four-byte unicode character set. But in practice, such strings are very rarely ever encountered or needed.&lt;br /&gt;
&lt;br /&gt;
===== Character =====&lt;br /&gt;
Individual characters (as extracted from a string or possibly read from a file) are represented as instances of the Character class. Queries are available to ask the character for its type (isLetter, isDigit etc.) or its unicode encoding (codePoint).&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/misc.html#CHARACTER More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Character Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
==== Collection Types ====&lt;br /&gt;
&lt;br /&gt;
An introductionary overview on the collection classes is found in the &lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html Collections Overview]] of the [[http://live.exept.de/doc/online/english/TOP.html Smalltalk/X online documentation]].&lt;br /&gt;
&lt;br /&gt;
===== Array =====&lt;br /&gt;
&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1 in both Smalltalk and JavaScript.&lt;br /&gt;
Can store any type of object, and storage requirements are 1 machine word per element. As the size is fixed (when created), adding and removing of&lt;br /&gt;
elements is not possible. Use one of the other collections (OrderedCollection, Set or Dictionary) if the number&lt;br /&gt;
of elements needs to change later or is not known in advance.&lt;br /&gt;
When accessing elements by index, access time is constant O(1). Searching for an element in an Array (using the &#039;&#039;includes:&#039;&#039; or &#039;&#039;indexOf:&#039;&#039; method), time complexity is O(N), because the search is linear through all elements of the array. &lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#ARRAY More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Array Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== ByteArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store very small byte-valued unsigned integers (0..255), and allocates 1 byte per element.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#BYTEARRAY More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,ByteArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== BitArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store tiny bit-valued unsigned integers (0..1), but only needs one byte of storage for every 8 elements.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,BitArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== BooleanArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store booleans (false..true), but only needs 1 byte for every 8 stored boolean elements.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,BooleanArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== FloatArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store short IEEE floats (32bit) and allocates 4 bytes per element&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#FLOATARRAY More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,FloatArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== DoubleArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store IEEE doubles (64bit) and allocates 8 bytes per element.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#FLOATARRAY More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,DoubleArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== HalfFloatArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store IEEE half floats (16bit) and allocates 2 bytes per element.&lt;br /&gt;
&amp;lt;br&amp;gt;Notice that half floats have a very low precision and are seldom used (exceptions are game programs or 3D graphics accelerators, to preserve memory by using this very compact format for depth information)&lt;br /&gt;
&lt;br /&gt;
===== IntegerArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store small 32bit unsigned integer values (0..FFFFFFFF) and allocates 4 bytes per element.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,IntegerArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== SignedIntegerArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store small 32bit signed integer values (-800000000..7FFFFFFF), allocating 4 bytes per element.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,SignedIntegerArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== LongIntegerArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store small 64bit unsigned integer values (0..FFFFFFFFFFFFFF), allocating 8 bytes per element.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,LongIntegerArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== SignedLongIntegerArray =====&lt;br /&gt;
Ordered, fixed size, indexed by an integral index starting with 1.&lt;br /&gt;
Can only store small 64bit signed integer values (-80000000000000000..7FFFFFFFFFFFFFFF), allocating 8 bytes per element.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,SignedLongIntegerArray Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== OrderedCollection =====&lt;br /&gt;
Ordered, variable size, indexed by an integral index starting with 1.&lt;br /&gt;
Can store any type of object. OrderedCollections are specifically tuned for adding/removing elements&lt;br /&gt;
at either end. Access time to elements via index has a complexity of O(1). &lt;br /&gt;
When searching for an element in an OrderedCollection (using the &#039;&#039;includes&#039;&#039;: or &#039;&#039;indexOf:&#039;&#039; method), time complexity is O(n), because a linear search is done.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#ORDCOLL More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,OrderedCollection Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== SortedCollection =====&lt;br /&gt;
Sorts itself, variable size, indexed by an integral index starting with 1.&lt;br /&gt;
Can store any type of object. By default, sorting is by ascending order. However, the sort order can be arbitrarily changed by setting the sortBlock, a two-argument JS-function or a two-argument Smalltalk block which should return true, if its first argument is to be &amp;quot;considered&amp;quot; smaller than the order (i.e. the default sort block is &amp;quot;[:a :b | a &amp;lt; b]&amp;quot;).&lt;br /&gt;
Access by numeric index is O(1). Insertion and remove is O(1) for the first and last element, O(n) for others, because the elements are moved inside a linear container. When searching for an element in a SortedCollection (using the &#039;&#039;includes:&#039;&#039; or &#039;&#039;indexOf:&#039;&#039; method), time complexity is O(log n), because a binary search can be done. When a big sorted collection is created, it is faster to first create it as a non-sorted collection (OrderedCollection) and then converting the whole collection via asSortedCollection(), instead of adding individual elements one-by-one.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#SORTCOLL More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,SortedCollection Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Set =====&lt;br /&gt;
Unordered, variable size, keeps a single reference only, per equal element.&lt;br /&gt;
Can store any type of object. When searching for an element in a Set (using the &#039;&#039;includes:&#039;&#039; method), time complexity approaches O(1), because the search can be done based on a hashing algorithm in asymptotic constant time. &lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#SET More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Set Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Bag =====&lt;br /&gt;
Unordered, variable size, keeps a count, per equal element. Adding, removing and insertion check are all asymptotical O(1).&lt;br /&gt;
Can store any type of object. &lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,Bag Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Dictionary =====&lt;br /&gt;
Unordered, variable size, implements arbitrary key-value mappings.&lt;br /&gt;
Can store any type of object.&lt;br /&gt;
When accessing or searching an element in a Dictionary (using the &#039;&#039;at:&#039;&#039; or &#039;&#039;includesKey:&#039;&#039; method), time complexity asymptotically approaches O(1), because the key search can be done based on a hashing algorithm. Notice, that the same value may be stored multiple times in a dictionary (i.e. stored under multiple keys); therefore, asking for the presence of a particular &#039;&#039;&#039;value&#039;&#039;&#039; in the dictionary (the reverse query) still has O(N) time complexity.&lt;br /&gt;
&lt;br /&gt;
If you need access both via the key and the value, either use an additional reverse mapping dictionary, or store&lt;br /&gt;
an additional value -&amp;gt; key mapping in the same dictionary (if the key and value spaces are disjoint).&lt;br /&gt;
 &lt;br /&gt;
Java users will know a subset of the dictionary functionality as &amp;quot;Hashtable&amp;quot;. &lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#DICTIONARY More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Dictionary Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== OrderedDictionary =====&lt;br /&gt;
Ordered, variable size, implements arbitrary key-value mappings.&lt;br /&gt;
Can store any type of object.&lt;br /&gt;
Being similar to dictionaries, these remember the order by which elements were added. It provides both access by hash-key and access by index (which is the order in which elements have been added). Creation of an OrderedDictionary is somewhat slower than for Dictionary or OrderedCollection, but access by either numeric or hashkey is fast O(1).&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,OrderedDictionary Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Queue =====&lt;br /&gt;
Ordered, variable size.&lt;br /&gt;
Can store any type of object. Queues are especially tuned for adding elements at one end, and removing them at the other. The internal representation uses a buffer in round-robin fashion. Both adding and removal are done on O(1) time.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/collections.html#QUEUE More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Queue Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
If multiple processes are accessing the same queue concurrently, use a SharedQueue, which is implicitly synchronized.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,SharedQueue Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== BTree, AATree, BinaryTree =====&lt;br /&gt;
Combining the functionality of Dictionaries and SortedCollection, these keep their elements in a sorted order, indexed by a key-object.&lt;br /&gt;
In contrast to Dictionaries, which use hashing, these use a tree-like representation and guarantee both asymptotic O(log N) worstcase and average runtime. (Dictionaries have a much better average runtime of O(C), but also a worstcase of O(N), if the hash keys are badly distributed). These trees are self balancing to avoid the linear worst case access time of non balanced trees. [[http://live.exept.de/ClassDoc/classDocOf:,BTree Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
There is also a non-balancing BinaryTree, which is slightly faster (by not balancing), but its worst case access times may degenerate to O(N) if elements are added non-randomly. [[http://live.exept.de/ClassDoc/classDocOf:,BinaryTree Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
==== Stream Types ====&lt;br /&gt;
&lt;br /&gt;
Streams are accessors for either internal collections or external files, sockets and other character oriented I/O devices.&lt;br /&gt;
They are created by either &amp;quot;&#039;&#039;opening&#039;&#039;&amp;quot; a file or device or by creation &amp;quot;&#039;&#039;on&#039;&#039;&amp;quot; a numerical indexable collection object (String, Array, OrderedCollection etc.).&lt;br /&gt;
Once created, read streams deliver the next element via a &amp;quot;&#039;&#039;next&#039;&#039;()&amp;quot; operation, write streams append elements via the &amp;quot;&#039;&#039;nextPut(e)&#039;&#039;&amp;quot; operation.&lt;br /&gt;
In addition to the above elementary functions, bulk read/write and linewise read/write and various other functionality is provided.&lt;br /&gt;
&lt;br /&gt;
An introductionary overview on the stream classes is found in the &lt;br /&gt;
[[http://live.exept.de/doc/online/english/overview/basicClasses/streams.html Streams Overview]] of the [[http://live.exept.de/doc/online/english/TOP.html Smalltalk/X online documentation]].&lt;br /&gt;
&lt;br /&gt;
===== ExternalStream =====&lt;br /&gt;
A common superclass providing bytewise or linewise access to any stream of the underlying operating system. Concrete subclasses are Socket, Filestream, Console Streams, PTYStream etc.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/streams.html#FILESTREAM More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,ExternalStream Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== FileStream =====&lt;br /&gt;
Provide bytewise or linewise access to the underlying file system.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/streams.html#FILESTREAM More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,FileStream Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== CharacterWriteStream =====&lt;br /&gt;
A special stream usable for mixed single- and multibyte characters (i.e. Unicode).&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,CharacterWriteStream Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Socket =====&lt;br /&gt;
Provides low level bytewise or linewise access to a communication socket. Typically, but not limited to TCP/IP connections.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/streams.html#FILESTREAM More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Socket Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
There are a number of useful companion classes which deal with host addresses:&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,SocketAddress SocketAddress]],&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,SocketAddress IPSocketAddress]] and&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,SocketAddress IPv6SocketAddress]].&lt;br /&gt;
&lt;br /&gt;
==== Other useful Types ====&lt;br /&gt;
&lt;br /&gt;
===== Date =====&lt;br /&gt;
Represents a calendar date.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/misc.html#DATE More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Date Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Time =====&lt;br /&gt;
Represents a time-of-day in second resolution.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/misc.html#TIME More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Time Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Timestamp (Date and Time) =====&lt;br /&gt;
Represents a timestamp in millisecond resolution. Due to the internal representation (Unix format), only timestamps back to 1.1.1970 can be represented.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/misc.html#TIMESTAMP More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Timestamp Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== TimeDuration =====&lt;br /&gt;
Represents an amount of time, to represent time intervals in millisecond resolution. When reading, a unit-specifier character is allowed to specify milliseconds (ms), seconds (s), minutes (m), hours (h) or days (d). For example, &amp;quot;1h 20s&amp;quot; specifies 1 hour and 20 seconds.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/doc/online/english/overview/basicClasses/misc.html#TIMEDURATION More Info]]&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,TimeDuration Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Delay =====&lt;br /&gt;
Utility providing delay functions. Most useful are (in Smalltalk) &amp;lt;code&amp;gt;&amp;quot;Delay waitForSeconds: n&amp;quot;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;quot;Delay waitUntil: timestamp&amp;quot;&amp;lt;/code&amp;gt;,&lt;br /&gt;
or (in JavaScript) &amp;lt;code&amp;gt;&amp;quot;Delay.waitForSeconds(n)&amp;quot;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;quot;Delay.waitUntil(timestamp)&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
[[http://live.exept.de/ClassDoc/classDocOf:,Delay Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
===== Filename =====&lt;br /&gt;
Represents names of files in the filesystem. Provides many useful query functions for file size, access- and modification time, parent directory, children, path queries etc.&lt;br /&gt;
&amp;lt;br&amp;gt;[[http://live.exept.de/ClassDoc/classDocOf:,Filename Class Documentation]]&lt;br /&gt;
&lt;br /&gt;
=== Standard Objects for JavaScript ===&lt;br /&gt;
&lt;br /&gt;
In order for a &amp;quot;well known&amp;quot; environment to be provided to those who know JS, but do not know Smalltalk, mimicri classes (Math) and mimicri protocol has been added to the underlying Smalltalk system. These functions simply call corresponding Smalltalk functions and only exist to provide a JavaScript compatible API which is described below. Notice that this represents only a small fraction (less than 1/100th) of the real functionality of the base system. In order to find out more about all existing classes, you should open a class browser and navigate through the system yourself.&lt;br /&gt;
There is also a more detailed introduction to the basic classes found in the &lt;br /&gt;
[http://live.exept.de/doc/online/english/overview/basicClasses/TOP.html Smalltalk/X Base Classes Documentation].&lt;br /&gt;
&lt;br /&gt;
==== Math ==== &lt;br /&gt;
&lt;br /&gt;
===== Constants =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;E&#039;&#039;&#039;&amp;lt;br&amp;gt;Euler&#039;s constant, the base of the natural logarithm (approximately 2.718).&amp;lt;br&amp;gt;Same as &amp;quot;&amp;lt;code&amp;gt;Float e&amp;lt;/code&amp;gt;&amp;quot; in Smalltalk.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;LN10&#039;&#039;&#039;&amp;lt;br&amp;gt;Natural logarithm of 10 (approximately 2.302). In Smalltalk, you can use &amp;quot;&amp;lt;code&amp;gt;Math LN10&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;LN2&#039;&#039;&#039;&amp;lt;br&amp;gt;Natural logarithm of 2 (approximately 0.693).&amp;lt;br&amp;gt;Same as &amp;quot;Float ln2&amp;quot; in Smalltalk.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;LOG10E&#039;&#039;&#039;&amp;lt;br&amp;gt;Base 10 logarithm of E (approximately 0.434)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;LOG2E&#039;&#039;&#039;&amp;lt;br&amp;gt;Base 2 logarithm of E (approximately 1.442)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;PI&#039;&#039;&#039;&amp;lt;br&amp;gt;Pi (approximately 3.14159).&amp;lt;br&amp;gt;Same as &amp;quot;Float pi&amp;quot; in Smalltalk.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;SQRT1_2&#039;&#039;&#039;&amp;lt;br&amp;gt;Square root of 1/2 (approximately 0.707)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;SQRT2&#039;&#039;&#039;&amp;lt;br&amp;gt;Square root of 2 (approximately 1.414).&amp;lt;br&amp;gt;Same as &amp;quot;Float sqrt2&amp;quot; in Smalltalk.&lt;br /&gt;
&lt;br /&gt;
===== Min &amp;amp; Max =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;max&#039;&#039;&#039; (&#039;&#039;number1 , number2,...&#039;&#039;)&amp;lt;br&amp;gt;Returns the largest of 0 to 5 arguments&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;min&#039;&#039;&#039; (&#039;&#039;number1, number2,...&#039;&#039;)&amp;lt;br&amp;gt;Returns the smallest of 0 to 5 arguments&lt;br /&gt;
&lt;br /&gt;
===== Miscellaneous =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;abs&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the absolute value of aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;binco&#039;&#039;&#039; (&#039;&#039;n, k&#039;&#039;) &amp;lt;br&amp;gt;Returns the binomial coefficient C(n,k) (n over k, choose k from n)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;ceil&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the smallest integer greater than or equal to aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;exp&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns E&amp;lt;sup&amp;gt;aNumber&amp;lt;/sup&amp;gt;, where aNumber is the argument, and E is Euler&#039;s constant, the base of the natural logarithm&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;fac&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the factorial of aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;floor&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the greatest integer less than or equal to aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;gcd&#039;&#039;&#039; (&#039;&#039;a, b&#039;&#039;)&amp;lt;br&amp;gt;Returns the greatest common divisor of a and b&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;log10&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the log base 10 of aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;log&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the log base E of aNumber&lt;br /&gt;
&amp;lt;!--ATTENTION:&lt;br /&gt;
    In JavaScript log is a base E log&lt;br /&gt;
    In Smalltalk log is a base 10 log (use ln for base E)&lt;br /&gt;
    In JavaScript, better use log10 to make things explicit.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pow&#039;&#039;&#039; (&#039;&#039;base, exp&#039;&#039;)&amp;lt;br&amp;gt;Returns base to the exponent power, that is, base&amp;lt;sup&amp;gt;exp&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;random&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a pseudo random number between 0 and 1&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;round&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the value of aNumber rounded to the nearest integer&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;sqrt&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the square root of aNumber&lt;br /&gt;
&lt;br /&gt;
===== Trigonometric =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;acos&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the arccosine (in radians) of aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;asin&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the arcsine (in radians) of aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;atan2&#039;&#039;&#039; (&#039;&#039;x, y&#039;&#039;)&amp;lt;br&amp;gt;Returns the arctangent of the quotient of its arguments (in radians)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;atan&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the arctangent (in radians) of aNumber&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;cos&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the cosine of aNumber (given in radians)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;sin&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the sine of aNumber (given in radians)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;tan&#039;&#039;&#039; (&#039;&#039;aNumber&#039;&#039;)&amp;lt;br&amp;gt;Returns the tangent of aNumber (given in radians)&lt;br /&gt;
&lt;br /&gt;
==== Number ====&lt;br /&gt;
===== Properties =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;MAX_VALUE&#039;&#039;&#039;&amp;lt;br&amp;gt;The largest representable number. The returned number is 0x7FFFFFFFFFFFFFFF, to mimicri a 64 limit on numbers for JS programs ported from other systems. In fact, expecco does not impose any such limit in integer values.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;MIN_VALUE&#039;&#039;&#039;&amp;lt;br&amp;gt;The smallest representable number. The returned number is -0x8000000000000000, to mimicri a 64 limit on numbers for JS programs ported from other systems. In fact, expecco does not impose any such limit in integer values.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;NEGATIVE_INFINITY&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the special &#039;negative infinity&#039; value&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;NaN&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the special &#039;not a number&#039; value&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;POSITIVE_INFINITY&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the special &#039;positive infinity&#039; value&lt;br /&gt;
&lt;br /&gt;
===== Methods =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;asFloat&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Returns a floating-point version of the receiver object. For example: &amp;quot;1.asFloat()&amp;quot; yields the floating point number: &amp;quot;1.0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;asInteger&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Returns an integer version of the receiver object (truncating). For example: &amp;quot;1.0.asInteger()&amp;quot; yields the integer number: &amp;quot;1&amp;quot;. Alternatives are ceiling(), floor() and rounded().&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;ceiling&#039;&#039;&#039; ()&amp;lt;br&amp;gt;For non-integral values, ceiling returns the smallest integer which is larger than the receiver. For integers, the original value is returned. For example: &amp;quot;1.4.ceiling()&amp;quot; yields the integer number: &amp;quot;2&amp;quot;, whereas &amp;quot;1.ceiling()&amp;quot; returns &amp;quot;1&amp;quot;. See also: floor() and rounded().&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;floor&#039;&#039;&#039; ()&amp;lt;br&amp;gt;For non-integral values, floor returns the largest integer which is smaller than the receiver. For integers, the original value is returned. For example: &amp;quot;1.4.floor()&amp;quot; yields the integer number: &amp;quot;1&amp;quot;, whereas &amp;quot;1.floor()&amp;quot; returns &amp;quot;1&amp;quot;. See also: ceiling() and rounded().&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;rounded&#039;&#039;&#039; ()&amp;lt;br&amp;gt;For non-integral values, rounded returns the nearest integer from rounding. For integers, the original value is returned. For example: &amp;quot;1.4.rounded()&amp;quot; yields the integer number: &amp;quot;1&amp;quot;, &amp;quot;1.6.rounded()&amp;quot; yields the integer number: &amp;quot;2&amp;quot; and whereas &amp;quot;1.rounded()&amp;quot; returns &amp;quot;1&amp;quot;. See also: ceiling() and floor().&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;roundTo&#039;&#039;&#039; (&#039;&#039;r&#039;&#039;)&amp;lt;br&amp;gt;Rounds towards the nearest multiple of r. For example, &amp;quot;1.543.roundedTo(0.01)&amp;quot; returns &amp;quot;1.54&amp;quot; and &amp;quot;1.567.roundedTo(0.01)&amp;quot; returns &amp;quot;1.57&amp;quot;. See also: ceiling(), floor() and rounded().&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;toExponential&#039;&#039;&#039; (&#039;&#039;nDigits&#039;&#039;)&amp;lt;br&amp;gt;Returns a string representing the number in exponential notation, where nDigits is the number of digits to appear after the decimal point&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;toExponential&#039;&#039;&#039; (&#039;&#039;nDigits, nDigitsAfter&#039;&#039;)&amp;lt;br&amp;gt;Returns a string representing the number in exponential notation&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;toFixed&#039;&#039;&#039; (&#039;&#039;nDigits&#039;&#039;)&amp;lt;br&amp;gt;Returns a string representing the number in fixed notation, where nDigits is the number of digits to appear after the decimal point&lt;br /&gt;
&lt;br /&gt;
==== Random ====&lt;br /&gt;
&lt;br /&gt;
A built in random generator, which generates linear congruential pseudo random numbers itself. On Unix/Linux operating systems, an additional class called &amp;quot;RandomGenerator&amp;quot;  uses the operating system&#039;s random generator (/dev/rand). In addition, alternative generators are available as &amp;quot;RandomParkMiller&amp;quot; and &amp;quot;RandomTT800&amp;quot;. For most applications, the default generator named Random should provide a reasonable random sequence.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;next ()&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a random number between 0 and 1 (float)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nextBoolean ()&#039;&#039;&#039;&amp;lt;br&amp;gt;Randomly returns either true or false&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nextBetween_and_&#039;&#039;&#039; (&#039;&#039;min, max&#039;&#039;)&amp;lt;br&amp;gt;Returns a random float between min and max&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nextIntegerBetween_and_&#039;&#039;&#039; (&#039;&#039;min, max&#039;&#039;)&amp;lt;br&amp;gt;Returns a random integer between min and max (use 1 and 6, to simulate a dice)&lt;br /&gt;
&lt;br /&gt;
==== Time / Date ====&lt;br /&gt;
&lt;br /&gt;
Time and Date instances provide a rich protocol for all kinds of queries. The list below is only a short extract of the most used methods:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;getDate&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the day of the month (1..31)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;getDay&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the day of the week (0..6); Sunday is 0&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;getFullYear&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the year&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;getHours&amp;lt;br&amp;gt;&#039;&#039;&#039;Returns the hours (0..24)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;getMinutes&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the minutes (0..60)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;getMonth&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns the day of the month (1..12)&lt;br /&gt;
&lt;br /&gt;
==== String ====&lt;br /&gt;
&lt;br /&gt;
Be reminded that the String class inherits from CharacterArray, ByteArray, SequentialCollection, Collection and Object. Thus all of those methods are also available (and useful) to be used with strings. Use the browser or take a look at the online documentation for the full protocol.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;charAt0&#039;&#039;&#039; (&#039;&#039;index&#039;&#039;)&amp;lt;br&amp;gt;Returns the n&#039;th character as a Character instance object, using a 0-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;charAt1&#039;&#039;&#039; (&#039;&#039;index&#039;&#039;)&amp;lt;br&amp;gt;Returns the n&#039;th character as a Character instance object, using a 1-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;charCodeAt0&#039;&#039;&#039; (&#039;&#039;index&#039;&#039;)&amp;lt;br&amp;gt;Returns the code of the n&#039;th character, using a 0-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;charCodeAt1&#039;&#039;&#039; (&#039;&#039;index&#039;&#039;)&amp;lt;br&amp;gt;Returns the code of the n&#039;th character, using a 1-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;indexOf0&#039;&#039;&#039; (&#039;&#039;aCharacter&#039;&#039;)&amp;lt;br&amp;gt;Returns the index of aCharacter, using a 0-based indexing scheme; -1 if not found &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;indexOf1&#039;&#039;&#039; (&#039;&#039;aCharacter&#039;&#039;)&amp;lt;br&amp;gt;Returns the index of aCharacter, using a 1-based indexing scheme; 0 if not found &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;lastIndexOf0&#039;&#039;&#039; (&#039;&#039;aCharacter&#039;&#039;)&amp;lt;br&amp;gt;Returns the last index of aCharacter, using a 0-based indexing scheme; -1 if not found &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;lastIndexOf1&#039;&#039;&#039; (&#039;&#039;aCharacter&#039;&#039;)&amp;lt;br&amp;gt;Returns the last index of aCharacter, using a 1-based indexing scheme; 0 if not found &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;quote()&#039;&#039;&#039;&amp;lt;br&amp;gt;Wraps the receiver into double quotes (&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;split&#039;&#039;&#039; (&#039;&#039;separator&#039;&#039;)&amp;lt;br&amp;gt;Splits the string into a collection of substrings using the separator&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;substr0&#039;&#039;&#039; (&#039;&#039;index, count&#039;&#039;)&amp;lt;br&amp;gt;Extracts a substring starting at the index with the given length, using a 0-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;substr1&#039;&#039;&#039; (&#039;&#039;index, count&#039;&#039;)&amp;lt;br&amp;gt;Extracts a substring starting at the index with the given length, using a 1-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;substring0&#039;&#039;&#039; (&#039;&#039;index1&#039;&#039;)&amp;lt;br&amp;gt;Extracts a substring starting at the index, using a 0-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;substring0&#039;&#039;&#039; (&#039;&#039;index1, index2&#039;&#039;)&amp;lt;br&amp;gt;Extracts a substring between the given indices, using a 0-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;substring1&#039;&#039;&#039; (&#039;&#039;index1&#039;&#039;)&amp;lt;br&amp;gt;Extracts a substring starting at the index, using a 1-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;substring1&#039;&#039;&#039; (&#039;&#039;index1, index2&#039;&#039;)&amp;lt;br&amp;gt;Extracts a substring between the given indices, using a 1-based indexing scheme &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;toLowerCase&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a copy of the receiver with all chars in lower case&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;toUpperCase&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a copy of the receiver with all chars in upper case&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;trim&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a copy of the receiver with all leading and trailing white space removed&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;trimLeft&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a copy of the receiver with all leading white space removed&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;trimRight&#039;&#039;&#039;&amp;lt;br&amp;gt;Returns a copy of the receiver with all trailing white space removed&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Collection (Array) ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;concat&#039;&#039;&#039; (&#039;&#039;aCollection&#039;&#039;)&amp;lt;br&amp;gt;Returns a new collection consisting of the concatenation of the receiver and the argument&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;every&#039;&#039;&#039; (&#039;&#039;filterFunction&#039;&#039;)&amp;lt;br&amp;gt;Returns true, if &amp;quot;filterFunction&amp;quot; returns true for all elements&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;filter&#039;&#039;&#039; (&#039;&#039;filterFunction&#039;&#039;)&amp;lt;br&amp;gt;Selects elements for which &amp;quot;filterFunction&amp;quot; returns true&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;forEach&#039;&#039;&#039; (&#039;&#039;function&#039;&#039;)&amp;lt;br&amp;gt;Applies &amp;quot;function&amp;quot; for each element&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;join&#039;&#039;&#039; (&#039;&#039;seperator&#039;&#039;)&amp;lt;br&amp;gt;Joins the strings of the receiver into a single string using the separator&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;map&#039;&#039;&#039; (&#039;&#039;function&#039;&#039;)&amp;lt;br&amp;gt;Returns a new collection collecting the results of applying &amp;quot;function&amp;quot; to each element in sequence&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pop&#039;&#039;&#039;&amp;lt;br&amp;gt;Removes and returns the last element of the collection&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;push&#039;&#039;&#039; (&#039;&#039;value&#039;&#039;)&amp;lt;br&amp;gt;Adds an element to the end of the collection&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;reduce0&#039;&#039;&#039; (&#039;&#039;filterFunction&#039;&#039;)&amp;lt;br&amp;gt;Applies &amp;quot;function&amp;quot; against two values, reducing from left to right. Function must be declared as: f(previousValue, currentValue, index, arr). Pass 0-based indices to the filter.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;reduce0&#039;&#039;&#039; (&#039;&#039;filterFunction, initialValue&#039;&#039;)&amp;lt;br&amp;gt;Applies &amp;quot;function&amp;quot; against two values, reducing from left to right. Function must be declared as: f(previousValue, currentValue, index, arr). Pass 0-based indices to the filter.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;reduce1&#039;&#039;&#039; (&#039;&#039;filterFunction&#039;&#039;)&amp;lt;br&amp;gt;Applies &amp;quot;function&amp;quot; against two values, reducing from left to right. Function must be declared as: f(previousValue, currentValue, index, arr). Pass 1-based indices to the filter.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;reduce1&#039;&#039;&#039; (&#039;&#039;filterFunction, initialValue&#039;&#039;)&amp;lt;br&amp;gt;Applies &amp;quot;function&amp;quot; against two values, reducing from left to right. Function must be declared as: f(previousValue, currentValue, index, arr). Pass 1-based indices to the filter.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;shift&#039;&#039;&#039;&amp;lt;br&amp;gt;Removes and returns the first element of the collection&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;slice0&#039;&#039;&#039; (&#039;&#039;index1, index2&#039;&#039;)&amp;lt;br&amp;gt;Extracts a subcollection, using a 0-based indexing scheme&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;slice1&#039;&#039;&#039; (&#039;&#039;index1, index2&#039;&#039;)&amp;lt;br&amp;gt;Extracts a subcollection, using a 1-based indexing scheme&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;some&#039;&#039;&#039; (&#039;&#039;filterFunction&#039;&#039;)&amp;lt;br&amp;gt;Returns true, if &amp;quot;filterFunction&amp;quot; returns true for any element&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;unshift&#039;&#039;&#039; (&#039;&#039;arg&#039;&#039;)&amp;lt;br&amp;gt;Adds an element to the beginning of the collection&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Transcript ==== &lt;br /&gt;
&lt;br /&gt;
The global variable &amp;quot;Transcript&amp;quot; refers to either the Transcript information window (if it is open) or the standard error stream. As such, it implements most of the stream interface functions. Most noteworthy are:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;cr&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Adds a linebreak (i.e. followup text will be shown on the next line)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;show&#039;&#039;&#039; (&#039;&#039;arg&#039;&#039;)&amp;lt;br&amp;gt;Adds a textual representation of the argument, which can be a string, number or any other object.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;showCR&#039;&#039;&#039; (&#039;&#039;arg&#039;&#039;)&amp;lt;br&amp;gt;A combination of show(), followed by a linebreak.&lt;br /&gt;
&lt;br /&gt;
and from the inherited write stream interface:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nextPut&#039;&#039;&#039; (&#039;&#039;aChar&#039;&#039;)&amp;lt;br&amp;gt;Sends a single character&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nextPutAll&#039;&#039;&#039; (&#039;&#039;aString&#039;&#039;)&amp;lt;br&amp;gt;Sends a string&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nextPutLine&#039;&#039;&#039; (&#039;&#039;aString&#039;&#039;)&amp;lt;br&amp;gt;Sends a string followed by a linebreak&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=== Expecco Objects ===&lt;br /&gt;
Many objects internal to expecco&#039;s execution machinery are reachable via elementary code (i.e. from within an elementary-coded action&#039;s code).&lt;br /&gt;
A lot of useful and required information can be aquired by consulting these objects.&lt;br /&gt;
The anchor to all those objects is the &amp;quot;&#039;&#039;current activity&#039;&#039;&amp;quot; object.&lt;br /&gt;
&lt;br /&gt;
==== Current Activity ====&lt;br /&gt;
Within elementary code the activity instance which is executing this piece of code can be accessed via the variable &amp;quot;&#039;&#039;this&#039;&#039;&amp;quot; (Smalltalk: &amp;quot;&#039;&#039;self&#039;&#039;&amp;quot;). For every executed action, a new activity object is created. It is usually alive during the execution only (i.e. it is destroyed and its memory reused automatically, after the block&#039;s action has finished).&lt;br /&gt;
&lt;br /&gt;
The current activity object supports the following functions:&lt;br /&gt;
&lt;br /&gt;
===== Reporting =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;error&#039;&#039;&#039; () &amp;lt;br&amp;gt;Report a defect (in the test). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;error&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) &amp;lt;br&amp;gt;Report a defect (in the test). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;fail&#039;&#039;&#039; () &amp;lt;br&amp;gt;Report a failure (in the SUT). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;fail&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) &amp;lt;br&amp;gt;Report a failure (in the SUT). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;inconclusive&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Report an inconclusive test. Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;inconclusive&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) &amp;lt;br&amp;gt;Report an inconclusive test. Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;success&#039;&#039;&#039; () OBSOLETE - see activitySuccess below&amp;lt;br&amp;gt;Finishes the current activity with success.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;success&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) OBSOLETE - see activitySuccess below&amp;lt;br&amp;gt;Finishes the current activity with success.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;activitySuccess&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Finishes the current activity with success. Actually not needed, because simply returning from an action&#039;s execute method is semantically equivalent.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;activitySuccess&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;)&amp;lt;br&amp;gt;Finishes the current activity with success.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pass&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Finishes the current testCase with success. Notice: this aborts the current activity and all of the callers up to the test case level.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pass&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;)&amp;lt;br&amp;gt;Finishes the current testCase with success.&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===== Logging =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logData&#039;&#039;&#039; (&#039;&#039;data&#039;&#039;) &amp;lt;br&amp;gt;Adds data to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logDataFile&#039;&#039;&#039; (&#039;&#039;fileName&#039;&#039;) &amp;lt;br&amp;gt;Adds a file attachment to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logError&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) &amp;lt;br&amp;gt;Adds a error message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logError&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, &#039;&#039;detail&#039;&#039;) &amp;lt;br&amp;gt;Adds a error message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logWarning&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) &amp;lt;br&amp;gt;Adds a warning to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logWarning&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, &#039;&#039;detail&#039;&#039;) &amp;lt;br&amp;gt;Adds a warning to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logInfo&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) &amp;lt;br&amp;gt;Adds an info message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logInfo&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, detail) &amp;lt;br&amp;gt;Adds an info message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logImageInfo&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, image) &amp;lt;br&amp;gt;Adds an info message with an image (screendump) to the activity log. There is an option in the report generator to include those in the generated pdf-report.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;alert&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) (1.8.1) &amp;lt;br&amp;gt;Adds an warning message to the activity log, and also shows a DialogBox, which has to be confirmed by the operator. The dialog box and confirmation can be disabled by a settings flag in the &amp;quot;Execution - Log -Settings&amp;quot; dialog (by default, it is disabled).&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;warn&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) (1.8.1) &amp;lt;br&amp;gt;Same as &#039;&#039;alert()&#039;&#039; (for Smalltalk compatibility).&lt;br /&gt;
&lt;br /&gt;
Notice the similarity and difference between &amp;quot;error()&amp;quot; and &amp;quot;logError()&amp;quot;: both actually create a log-data entry, but &amp;quot;error()&amp;quot; stops the execution, whereas &amp;quot;logError()&amp;quot; proceeds (maybe, the naming is a bit confusing here...)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===== Reflection, Information, Queries and Accessing =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;activityCreator&#039;&#039;&#039; () &amp;lt;br&amp;gt;The triggering activity (i.e. the caller). Except for special tricks, this is only useful to generate nice print messages (such as &amp;quot;activity foo, called from bar&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;activityProcess&#039;&#039;&#039; () &amp;lt;br&amp;gt;The thread executing the activity&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;blockDescription&#039;&#039;&#039; () &amp;lt;br&amp;gt;The definition of the activity (i.e. the tree definition item of the action&#039;s step)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;environment&#039;&#039;&#039; () &amp;lt;br&amp;gt;The currently valid environment variables of the compound step which contains this action, or (if none) of the test plan in which this action executes (see &amp;quot;[[#Environment Access|Environment Access]]&amp;quot; below)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;environmentAt&#039;&#039;&#039; (&#039;&#039;anEnvironmentVarName&#039;&#039;) &amp;lt;br&amp;gt;The value of an environment variable (in the above environment)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;environmentAt_put&#039;&#039;&#039; (&#039;&#039;anEnvironmentVarName&#039;&#039;, &#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt;Changing the value of an environment variable (in the above environment)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;executor&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns the current executor (see &amp;quot;[[#Executor Functions|Executor Functions]]&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;inputValueForPin&#039;&#039;&#039; (&#039;&#039;pinName&#039;&#039;)&amp;lt;br&amp;gt;The value of a certain pin&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;inventory&#039;&#039;&#039; () &amp;lt;br&amp;gt;The inventory of the activity&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;nameOfStep&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the corresponding step of the activity&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;resources&#039;&#039;&#039; () &amp;lt;br&amp;gt;All resources which have been aquired for the activity (as specified in the resource-definition of the action). Retrieves a collection of Resource objects, as described below.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;resourcesForId&#039;&#039;&#039; (&#039;&#039;skillId&#039;&#039;) &amp;lt;br&amp;gt;Resources which have been aquired for one particular skill-requirement. The argument &#039;&#039;skillId&#039;&#039; corresponds to the name as specified in the first column of the resource definition of the action). Notice, that a collection of Resource objects is returned - even if only one resource has been aquired.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;step&#039;&#039;&#039; () &amp;lt;br&amp;gt;The corresponding step of the activity&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===== Environment Access =====&lt;br /&gt;
&lt;br /&gt;
Starting at every compound activity, a nested stack of outer environments is present, ending in a top project environment. The following activity methods provide access to some of them. This can be used to automatically setup environment variables from a configuration or when autodetecting a system-under-test&#039;s configuration and leaving the values in a defined outer environment. Depending on the intended lifetime of those values, one of the following environments should be choosen as target of such operations:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;environment&#039;&#039;&#039; () &amp;lt;br&amp;gt; the environment of the compound in which the current elementary action is executing (as a step)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;executorEnvironment&#039;&#039;&#039; () &amp;lt;br&amp;gt; an environment which is only present during a single testplan execution&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;projectEnvironment&#039;&#039;&#039; () &amp;lt;br&amp;gt; an environment which is attached to the current test suite (but not persistent when the suite is saved/loaded from an ets file)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;browserEnvironment&#039;&#039;&#039; () &amp;lt;br&amp;gt; an environment which is present while the expecco application is running (i.e. the current session). (it is not made persistent)&lt;br /&gt;
&lt;br /&gt;
None of the following can be made persistent directly. However, every test suite, test plan and compound block provide a description of initial values and how to compute them in their environment description, which is edited using the [[ Environment Editor ]].&lt;br /&gt;
Also, such descriptions can be saved and loaded separately from the test suite via the &amp;quot;&#039;&#039;Load/Save Parameter Set&#039;&#039;&amp;quot; menu functions of the &amp;quot;&#039;&#039;File&#039;&#039;&amp;quot; menu.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Executor Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;executorsWorkingDirectory&#039;&#039;&#039; () &amp;lt;br&amp;gt;Temporary working directory. This is removed after the execution (i.e. useful only for very temporary files, which are generated in an action and read in another)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;testplan&#039;&#039;&#039; () &amp;lt;br&amp;gt;The currently executed testplan (nil if a block test blocks are executed)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;project&#039;&#039;&#039; () &amp;lt;br&amp;gt;Project (testsuite or library) in which the test is executed&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Resource Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the resource&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;skillNamed&#039;&#039;&#039; (&#039;&#039;nameOrUUID&#039;&#039;) &amp;lt;br&amp;gt;Fetch a concrete skill-value of that resource. The argument can be either a skill&#039;&#039;s name, or the functional-UUID of the skill element (in the project tree).&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;skillAttributeNamed&#039;&#039;&#039; (&#039;&#039;name&#039;&#039;) &amp;lt;br&amp;gt;Fetch a concrete skill-attribute-value of the resource&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Test Suite (Project) Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;documentation&#039;&#039;&#039; () &amp;lt;br&amp;gt;The documentation or nil&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;functionalId&#039;&#039;&#039; () &amp;lt;br&amp;gt;A unique ID which defines this testSuite independent of its name (remains constant after change)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;projectsWorkingDirectory&#039;&#039;&#039; () &amp;lt;br&amp;gt;Project directory -  i.a. all attachments. This directory is created when a project file is loaded and is deleted when expecco is closed. Do not use it for permanently needed files.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;modelLanguageStringFor&#039;&#039;&#039; (&#039;&#039;aString&#039;&#039;)&amp;lt;br&amp;gt;translates a string according to the model-language translation table&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;versionId&#039;&#039;&#039; () &amp;lt;br&amp;gt;A unique ID which defines this testSuite in exactly this version. (changed with any edit operation)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;elementWithName&#039;&#039;&#039; (&#039;&#039;aString&#039;&#039;) &amp;lt;br&amp;gt;Retrieve an element by name&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;elementWithId&#039;&#039;&#039; (&#039;&#039;aUUID&#039;&#039;) &amp;lt;br&amp;gt;Retrieve an element by its id&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;elementWithFunctionalId&#039;&#039;&#039; (&#039;&#039;aUUID&#039;&#039;)&amp;lt;br&amp;gt;Retrieve an element by its version id&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;typeNamed&#039;&#039;&#039; (&#039;&#039;aTypeName&#039;&#039;)&amp;lt;br&amp;gt;Retrieve a datatype. To instantiate a type, write &amp;quot;&amp;lt;code&amp;gt;(self project typeNamed:&#039;Foo&#039;) new&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Testplan Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;documentation&#039;&#039;&#039; () &amp;lt;br&amp;gt;The documentation or nil&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the Testplan&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;tags&#039;&#039;&#039; () &amp;lt;br&amp;gt;A collection of tags of the testplan&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;functionalId&#039;&#039;&#039; () &amp;lt;br&amp;gt;A unique ID which defines this testplan independent of its name (remains constant after change)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;versionId&#039;&#039;&#039; () &amp;lt;br&amp;gt;A unique ID which defines this testplan in exactly this version. (changed with any edit operation)&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Step Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the Step&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;tags&#039;&#039;&#039; () &amp;lt;br&amp;gt;A collection of tags of the Step&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Pin Functions ====&lt;br /&gt;
&lt;br /&gt;
The input and output pins can be referenced in elementary code by their name.&lt;br /&gt;
The name refers to the pin - &#039;&#039;&#039;NOT&#039;&#039;&#039; the passed value (this allows for the code to check, if a value is present). For indexed pins (i.e. in steps with a variable number of pins), which is a new feature in v2.1, the collection of pins is referred to by the name, and pins are accessed via an index (1..). See more about how to handle variable pins in the section below.&lt;br /&gt;
&lt;br /&gt;
===== Common to all Pins: =====&lt;br /&gt;
*&#039;&#039;&#039;datatype&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns the data type of the pin (Reflection-API)&lt;br /&gt;
&lt;br /&gt;
===== Input Pins: =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;hasValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns true if the pin has received a value (important for the trigger conditions ANDConnected and OR)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;hasEnvironmentFreezeValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns true if the pin has a freezeValue from an environment&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;hasFreezeValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns true if the pin has a freezeValue&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isConnected&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns true if the pin is connected (but not frozen)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns the value of the pin. Raises an error if the pin did not receive any value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;valueIfAbsent&#039;&#039;&#039; (&#039;&#039;alternativeValue&#039;&#039;) &amp;lt;br&amp;gt;Returns the value of a pin or the alternativeValue if the pin did not receive any value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;valueIfPresent&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns the value of a pin or nil if the pin did not receive any value. Similar to &amp;quot;value()&amp;quot;, but avoids the exception.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;waitForValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;The pin has to be a mailbox pin. The execution will be interrupted until the pin receives a value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;waitForValueWithTimeout&#039;&#039;&#039; (&#039;&#039;seconds&#039;&#039;)&amp;lt;br&amp;gt;Like above, but the execution will only wait for the specified time limit given in seconds. The parameter is typically an integer, but can also be a fraction (1/3) or a floating-point number (0.3).&lt;br /&gt;
&lt;br /&gt;
===== Output Pins: =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isBuffered&#039;&#039;&#039; () &amp;lt;br&amp;gt;True if the pin is buffered&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isConnected&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns true if the pin is connected&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; (&#039;&#039;data&#039;&#039; ) &amp;lt;br&amp;gt;Writes the value.&lt;br /&gt;
&lt;br /&gt;
===== Variable Input Pins =====&lt;br /&gt;
&lt;br /&gt;
Starting with expecco v2.0, steps can have a variable number of input pins (after placement of the step, pull the pin-handle, to add or remove pins). In elementary code, the following API call entries (to the variable pin) are provided to deal with this situation:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName&#039;&#039;&#039; &amp;lt;br&amp;gt; now refers to a collection of pins, representing the set of pins actually present at the step. In contrast regular pins, where pinName refers to a single pin. &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.numberOfVariablePins&#039;&#039;&#039; () &amp;lt;br&amp;gt; returns the number of actual pins present in the step for the (variable) schema pin named &amp;quot;pinName&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.at&#039;&#039;&#039; (&#039;&#039;idx&#039;&#039;) &amp;lt;br&amp;gt; returns the i&#039;th actual pin of the schema pin named &amp;quot;pinName&amp;quot;. Notice this retrieves the pin; to get to the value or query if t has a value, call &#039;&#039;value&#039;&#039;() / &#039;&#039;hasValue&#039;&#039;() on the returned pin.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.hasValueAt&#039;&#039;&#039; (&#039;&#039;idx&#039;&#039;) &amp;lt;br&amp;gt; true if the i&#039;th variable pin is connected and has received a value&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.values&#039;&#039;&#039; () &amp;lt;br&amp;gt;Retrieves the values passed to the pins as an array. The array contains nil entries for disconnected pins and those without a value&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.valuesPresent&#039;&#039;&#039; () &amp;lt;br&amp;gt;Retrieves the values as present; skips unconnected pins or those without a value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.valueAt&#039;&#039;&#039; (&#039;&#039;idx&#039;&#039;) &amp;lt;br&amp;gt; to get the i&#039;th pin&#039;s value; raises an error if no value was given or pin is not connected&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.valueIfPresentAt&#039;&#039;&#039; (&#039;&#039;idx&#039;&#039;) &amp;lt;br&amp;gt; to get the i&#039;th pin&#039;s value, or nil if no value was given or pin is not connected&lt;br /&gt;
&lt;br /&gt;
===== Variable Output Pins =====&lt;br /&gt;
&lt;br /&gt;
Starting with expecco v2.1, steps can have a variable number of output pins too (after placement of the step, pull the pin-handle, to add or remove pins). In elementary code, the following API call entries (to the variable pin) are provided to deal with this situation:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.numberOfVariablePins&#039;&#039;&#039; () &amp;lt;br&amp;gt; returns the number of actual pins present in the step for the (variable) schema pin named &amp;quot;pinName&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.at&#039;&#039;&#039; (&#039;&#039;idx&#039;&#039;) &amp;lt;br&amp;gt; returns the i&#039;th actual pin of the schema pin named &amp;quot;pinName&amp;quot;. Notice that this retrieves the pin; to write an output value to it, call &#039;&#039;value&#039;&#039;(v) on the returned pin.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pinName.outputPins&#039;&#039;&#039; () &amp;lt;br&amp;gt; returns a collection of all actual pins present in the step for the (variable) schema pin named &amp;quot;pinName&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Datatype Functions ====&lt;br /&gt;
&lt;br /&gt;
A datatype can be retrieved by asking a pin for its datatype. &lt;br /&gt;
This is sometimes useful in elementary code, in order to instantiate a new value (given the pin) or to ask for details of the type.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the Datatype&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isAnyType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is the builtin &amp;quot;Any&amp;quot; type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isArrayType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is an &amp;quot;Array&amp;quot; type (with any element type)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isCompoundType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is a compound (structure) type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isEnumType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is an enumeration type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isPrimaryType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is any builtin primary type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isRangeType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is a subrange of another type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isTupleType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is a tuple type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isUnionType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is a union type&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isStringPrimaryType&#039;&#039;&#039; () &amp;lt;br&amp;gt;true if the datatype is the builtin &amp;quot;String&amp;quot; primary type&lt;br /&gt;
&lt;br /&gt;
==== Enum Type Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;values&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns an array of enum-value names (Symbolic)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;integerValueOf&#039;&#039;&#039; (&#039;&#039;elementName&#039;&#039;) &amp;lt;br&amp;gt;returns the associated integer value. (new in expecco 2.8)&lt;br /&gt;
&lt;br /&gt;
==== Compound Type Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;namedFieldDescriptions&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns an array of descriptions of the named fields (if any)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;indexedFieldDescriptins&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns a description of indexed fields (if any)&lt;br /&gt;
&lt;br /&gt;
Each field description can be asked for the &amp;quot;fieldName()&amp;quot;, &amp;quot;fieldType()&amp;quot; and &amp;quot;defaultValue()&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== Primary Type Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;typeClass&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns the underlying Smalltalk class, of which values are instances of.&lt;br /&gt;
&lt;br /&gt;
==== Range Type Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;baseType&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns the underlying base type. Typically this will be the Integer primary type.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;minValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns the minimum value of the range&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;maxValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;returns the maximum value of the range&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Functions for Any Tree- or Diagram Element ====&lt;br /&gt;
&lt;br /&gt;
These include: BlockDescriptions, Types, TestPlans, TestCases, Steps, Connections, Pins, Annotations etc.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;versionId&#039;&#039;&#039; &amp;lt;br&amp;gt;A globally unique identifier (GUID or UUID) which is changed with every modification of the item&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;functionalId&#039;&#039;&#039; &amp;lt;br&amp;gt;A globally unique identifier (GUID or UUID) which is assigned once-and-for-all to the item&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;id&#039;&#039;&#039; &amp;lt;br&amp;gt;alias for versionId().&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;tags&#039;&#039;&#039; &amp;lt;br&amp;gt;A collection of tags.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isAnnotation&#039;&#039;&#039;&amp;lt;br&amp;gt;true, if it is an annotation (in a diagram)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isStep&#039;&#039;&#039;&amp;lt;br&amp;gt;true, if it is a step (in a diagram)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isConnection&#039;&#039;&#039;&amp;lt;br&amp;gt;true, if it is a connection (in a diagram)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isBlockdescription&#039;&#039;&#039;&amp;lt;br&amp;gt;true, if it is a block description (in the tree)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;taggedValueAt&#039;&#039;&#039; (&#039;&#039;aKey&#039;&#039;) &amp;lt;br&amp;gt;To retrieve a tagged value. These are usually preserved when objects are transported to/from other systems.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;taggedValueAt_put&#039;&#039;&#039; (&#039;&#039;aKey&#039;&#039;, &#039;&#039;anObject&#039;&#039;) &amp;lt;br&amp;gt;to change a tagged value. Only a limited set of datatypes are supported: anObject must be a &#039;&#039;&#039;String&#039;&#039;&#039; or a &#039;&#039;&#039;Number&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;propertyAt&#039;&#039;&#039; (&#039;&#039;aKey&#039;&#039;)&amp;lt;br&amp;gt;to retrieve an expecco property. These are expecco-internal properties. These are usually not recognized by other systems.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;propertyAt_put&#039;&#039;&#039; (&#039;&#039;aKey&#039;&#039;, &#039;&#039;anObject&#039;&#039;)&amp;lt;br&amp;gt;to set an expecco property. These are usually not recognized by other systems. Only a limited set of datatypes are supported: anObject must be a &#039;&#039;&#039;String&#039;&#039;&#039; or a &#039;&#039;&#039;Number&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Groovy Elementary Blocks ==&lt;br /&gt;
&lt;br /&gt;
Groovy is an open source interpreter and compiler for a Java like scripting language which runs on top of the Java Virtual machine. For details, visit [http://groovy.codehaus.org &amp;quot;Groovy: A dynamic language for the Java platform&amp;quot;] and especially the [http://groovy.codehaus.org/Documentation documentation portal]..&lt;br /&gt;
&lt;br /&gt;
Code written as a Groovy elementary block is not executed directly by expecco. Instead, the code is forwarded to a Groovy shell which runs inside a Java Virtual Machine (JVM). This may be a local JVM, whose sole purpose is to provide additional utility functions or which provides an interface to the actual system under test (SUT), or it may be the JVM which executes the tested application and is running physically on the system under test (SUT). By using Groovy blocks, expecco&#039;s basic black-box test functionality can be easiliy extended by many powerful gray- and white-box tests. You can access the internals of objects inside the SUT, call its functions and even define new classes and functions and call them. Groovy is especially useful, if you have to install callback- or hooks inside the SUT, which interacts back to expecco.&lt;br /&gt;
&lt;br /&gt;
The machinery to interact with a JVM (and therefore to execute Groovy code blocks) requires the JavaBridge plugin, which is not part of the basic expecco package. Groovy itself is avalable for free as a jar class library, which is loaded with or into the target application. The JavaBridge plugin already includes a prepackaged Groovy interpreter which can be loaded transparently into the SUT application whenever a Groovy block is executed. So except for the setting of the JVM path, no further setup or installation is required.&lt;br /&gt;
&lt;br /&gt;
=== Why use Groovy Elementary Blocks ? ===&lt;br /&gt;
The JavaBridge and especially Groovy code is very useful when testing GUI frameworks, communication protocols or machine control soft- and hardware which is written in Java. Especially, if you have to call functions internal to the SUT in order to trigger actions or if you need to be informed about state changes via listeners or callbacks, Groovy is the perfect tool for the task. Note that calls into the JVM are relatively straight forward, using the method forwarding mechanism, even from Smalltalk code. However, callbacks and listeners which must be special derived classes, are hard to realize without Groovy.&lt;br /&gt;
&lt;br /&gt;
=== Groovy Compilation Mechanism and Performance Issues ===&lt;br /&gt;
When a groovy action is executed for the very first time, the block&#039;s code is transmitted via the bridge to the Groovy shell on the target JVM as a string. There, the code is parsed and an anonymus jar is created, containing Java byte code. Thus, there is some initial overhead involved in both sending the code and more so in compiling the code in the JVM. However, for every followup call, the JWM will directly call the generated code and run at full Java speed (i.e. the execution speed is almost as if native Java code was executed).&lt;br /&gt;
&lt;br /&gt;
=== Using a Single Local JVM Connection / Executing Groovy Actions on the Local Machine ===&lt;br /&gt;
By default, a Groovy action is executed on a JVM which runs on the local machine; i.e. the machine on which expecco itself is running.&lt;br /&gt;
With the execution of the very first groovy action, a JVM is started as defined in the expecco settings dialog, then a bridge connection is established to that JVM, and the Groovy interpreter is loaded and instantiated on the JVM. Then a reference to that GroovyShell object is remembered and used for all followup Groovy actions which are to execute on that local JVM.&lt;br /&gt;
This default behavior is convenient if you want to use Java support libraries for reporting, statistics or other computations, or if your SUT is running inside a local JVM, or if you want to call interface functions (protocols) which actually talk to your SUT.&lt;br /&gt;
&lt;br /&gt;
=== Using a Particular JVM Connection  / Executing Groovy on a Possibly Remote Machine ===&lt;br /&gt;
If you either need to customize the JVM startup and/or your test scenario has to talk to one or multiple remote systems (or multiple java programs within one scenario), you have to setup multiple java connections, and pass the connection to use to your Groovy actions.&lt;br /&gt;
This can be done either via an input pin, or via an expecco environment variable.&lt;br /&gt;
The algorithm to provide this is as follows:&lt;br /&gt;
&lt;br /&gt;
* if the action has a pin named &amp;quot;groovy&amp;quot;, and it is connected, that pin&#039;s value is used as Groovy shell handle&lt;br /&gt;
* otherwise, if the environment contains a variable named &amp;quot;GROOVY&amp;quot;, that variable&#039;s value is used&lt;br /&gt;
* otherwise, a Groovy shell is instantiated and used, on the JVM which is given by:&lt;br /&gt;
** if the action has a pin named &amp;quot;java&amp;quot;, and it is connected, that pin&#039;s value is used as java-bridge handle&lt;br /&gt;
** otherwise, if the environment contains a variable named &amp;quot;JAVA&amp;quot;, that variable&#039;s value is used&lt;br /&gt;
** finally, otherwise a local JVM connection is used (a shared singleton connection).&lt;br /&gt;
&lt;br /&gt;
To use input pins, you have to create corresponding pins manually, and the pin names MUST be &amp;quot;java&amp;quot; / &amp;quot;groovy&amp;quot;.&lt;br /&gt;
You cannot use these two reserved names as regular input pin names.&lt;br /&gt;
&lt;br /&gt;
=== Calling Existing Code in the System Under Test via a Groovy Action===&lt;br /&gt;
&lt;br /&gt;
A Groovy block&#039;s code looks very similar to a regular JavaScript block&#039;s code. However, it is executed on the SUT, and can therefore instantiate Java objects and call static and member functions.&lt;br /&gt;
&lt;br /&gt;
For example, too call a static function named &amp;quot;&#039;&#039;foo&#039;&#039;&amp;quot; in a class named &amp;quot;&#039;&#039;MyTestClass&#039;&#039;&amp;quot;, use the following groovy block:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
def execute() {&lt;br /&gt;
    MyTestClass.foo(&amp;quot;hello world&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the class is located in another package (or especially: in one of your own), &lt;br /&gt;
use explicit package prefixes:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
def execute() {&lt;br /&gt;
    javax.swing.JFrame frame = new javax.swing.JFrame();&lt;br /&gt;
    javax.swing.JButton button = new javax.swing.JButton( &amp;quot;Press Me&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    frame.add(button);&lt;br /&gt;
    frame.setSize(300,100);&lt;br /&gt;
    frame.setVisible(true);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
or an import declaration:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
&lt;br /&gt;
// end of import definitions&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    JFrame frame = new JFrame();&lt;br /&gt;
    JButton button = new JButton( &amp;quot;Press Me&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    frame.add(button);&lt;br /&gt;
    frame.setSize(300,100);&lt;br /&gt;
    frame.setVisible(true);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
Notice that you may not remove the comment line starting with &amp;quot;// end of....&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;This separator pattern has been hardcoded into the Groovy machinery to separate any class and import&lt;br /&gt;
definitions from the execution method.&lt;br /&gt;
&lt;br /&gt;
=== Defining a New Class in the System Under Test using Groovy ===&lt;br /&gt;
You can define your own classes in a Groovy block:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
class MyClass extends Object {&lt;br /&gt;
    Object someState;&lt;br /&gt;
&lt;br /&gt;
    def set_someState(Object newValue) {&lt;br /&gt;
        someState = newValue;&lt;br /&gt;
    }&lt;br /&gt;
    def get_someState(Object newValue) {&lt;br /&gt;
        return someState;&lt;br /&gt;
    }&lt;br /&gt;
    def String toString() {&lt;br /&gt;
        return &amp;quot;a very\nlong\nmultiline\na\nb\nstring\n&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// end of local definitions&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    outputPin.value( new MyClass() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
Instances of new classes may be required especially to install listeners and callbacks when testing UI or server applications. A typical scenario is when you want expecco to be informed about mouse or keyboard events (MouseListener).&lt;br /&gt;
&lt;br /&gt;
=== Defining a Listener Class in the System Under Test using Groovy ===&lt;br /&gt;
A common pattern in Java communication frameworks is to define an abstract classes or interfaces which has to be subclassed by users of the framework. This pattern is common for callbacks or event listeners. The programmer has to define a listener class, create an instance of it, and register it towards the communication framework. To interact with such a framework in expecco, you will need a listener class, which responds to callbacks from the framework and either remembers them for later queries from a testcase&#039;s activity, or by directly calling back into expecco. The later is much harder to deal with, as those callbacks may come at any time, even when the test has already finished or the test is being debugged (remember that the JVM may run independent from expecco). So synchronization issues may be hard to solve. It is much easier and recommended to implement the first approach: the listener collects incoming events, until expecco is ready to process them.&lt;br /&gt;
&lt;br /&gt;
You will need an elementary Groovy block to instantiate and register the listener towards the framework similar to the conceptual code below:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
// a Groovy Elementary Block&lt;br /&gt;
&lt;br /&gt;
import &amp;lt;interface or abstract class from which to inherit&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
class MyListener extends AbstractListener {&lt;br /&gt;
    ArrayList eventQueue = new ArrayList();&lt;br /&gt;
    Object eventNotifier = new Object();&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
      * Called from a framework when an event occurs.&lt;br /&gt;
      */&lt;br /&gt;
    public void onExampleEvent(Object event) {&lt;br /&gt;
        synchronized (eventQueue) {&lt;br /&gt;
            eventQueue.add(event);            &lt;br /&gt;
        }&lt;br /&gt;
        synchronized (eventNotifier) {&lt;br /&gt;
            eventNotifier.notifyAll();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
      * Called from expecco to fetch next event. &lt;br /&gt;
      * &lt;br /&gt;
      * Of there is no event in the queue, blocks&lt;br /&gt;
      * until an event arrives (by means of #onExampleEvent())&lt;br /&gt;
      */&lt;br /&gt;
    public Object getNextEvent() {&lt;br /&gt;
        while (true) {&lt;br /&gt;
            synchronized (eventQueue) {&lt;br /&gt;
                if (! eventQueue.isEmpty()) {&lt;br /&gt;
                    return eventQueue.remove(0);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            synchronized (eventNotifier) {&lt;br /&gt;
                try {&lt;br /&gt;
                    eventNotifier.wait();&lt;br /&gt;
                } catch (InterruptedException ie) {&lt;br /&gt;
                    // Pass, try again&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// end of local definitions&lt;br /&gt;
&lt;br /&gt;
// called from expecco, to instantiate a listener&lt;br /&gt;
def execute() {&lt;br /&gt;
    var theListener = new MyListener();&lt;br /&gt;
&lt;br /&gt;
    framework.registerListener ( theListener );&lt;br /&gt;
    outputPin.value( theListener ); // return it to expecco&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure that the above elementary code is called from your activity diagram in the initialization/setup phase, and that the returned listener reference is either remembered in an environment variable of your suite, or passed down to the actual test case via input/output pins.&lt;br /&gt;
&lt;br /&gt;
Define an additional elementary block (here in JavaScript, but could also be Smalltalk or Groovy), which takes the listener as input pin and fetches the next event via #getNextEvent():&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
// a JavaScript Elementary Block&lt;br /&gt;
&lt;br /&gt;
execute() {&lt;br /&gt;
    var theListener;&lt;br /&gt;
    var event;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    theListener = inPin.value();&lt;br /&gt;
    event = theListener.getNextEvent();&lt;br /&gt;
    outpin.value ( event );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
In your test case, perform any stimulation required to make the framework generate an event, so that the listener&#039;s framework entry is called.&lt;br /&gt;
Then, invoke the #getNextEvent() action to suspend execution until an incoming event arrives (you will probably set a [[DiagramElements-Pin#Timelimit Input Pin|time limit]] on that step&#039;s execution). Once this action finishes, the event is  available in expecco as a reference to the realevent object (remember: the event object is an object inside the remote Java machine). However, all getters, setters and other methods of the event&#039;s implementation can be invoked from elementary code (any of the programming languages can do that, due to the message forwarding of the bridge).&lt;br /&gt;
For example, assuming that the event provides getEventID() and getMessageString() getters,&lt;br /&gt;
which can be called from a Smalltalk action with:&lt;br /&gt;
 id := theEvent getEventID. msg := theEvent getMessageString.&lt;br /&gt;
and from a JavaScript action or from another Groovy action witht:&lt;br /&gt;
 id = theEvent.getEventID(); msg = theEvent.getMessageString();.&lt;br /&gt;
&lt;br /&gt;
=== Groovy Datatype Limitations ===&lt;br /&gt;
&lt;br /&gt;
==== Integer types ====&lt;br /&gt;
As Groovy dynamically compiles to plain Java bytecode and executes on top of a regular JVM, the integer range is limited to 32bit (64bit for &amp;quot;long int&amp;quot; types).&lt;br /&gt;
No automatic conversion between small and large integers is performed. If required, you will have to use a BigNum package and/or cast int to long int. There is currently no automatic conversion or transparent support to pass large numbers from expecco to Groovy and vice versa. Integers passed from Java to expecco will be represented as instances of the Integer type there.&lt;br /&gt;
&lt;br /&gt;
==== Limited Object Conversion ====&lt;br /&gt;
Some limited form of object conversion is automatically performed when passing expecco&#039;s Smalltalk objects to Groovy, and back when returning values from Groovy. This conversion especially affects values passed to/from pins of a Groovy action.&lt;br /&gt;
&lt;br /&gt;
The following table summarizes the conversion process:&lt;br /&gt;
{|  Border &lt;br /&gt;
! from Smalltalk&lt;br /&gt;
! to Java and from Java&lt;br /&gt;
! to Smalltalk&lt;br /&gt;
! &lt;br /&gt;
|- &lt;br /&gt;
| String &lt;br /&gt;
| String &lt;br /&gt;
| String&lt;br /&gt;
|- &lt;br /&gt;
| Integer (up to 32/64 bit)&lt;br /&gt;
| int, long int, boxed Integer&lt;br /&gt;
| Integer&lt;br /&gt;
|- &lt;br /&gt;
| Float, Double&lt;br /&gt;
| float, double&lt;br /&gt;
| Float&lt;br /&gt;
|- &lt;br /&gt;
| Fraction&lt;br /&gt;
| float, double (danger alert: precision may be lost)&lt;br /&gt;
| Float&lt;br /&gt;
|- &lt;br /&gt;
| Boolean&lt;br /&gt;
| Boolean&lt;br /&gt;
| Boolean&lt;br /&gt;
|- &lt;br /&gt;
| Array of any above&lt;br /&gt;
| ArrayList of any above&lt;br /&gt;
| Array of any above&lt;br /&gt;
|- &lt;br /&gt;
| arbitrary Smalltalk Object (!) &lt;br /&gt;
| opaque reference to alien object (!) &lt;br /&gt;
| original Smalltalk Object (identity preserving) (!) &lt;br /&gt;
|- &lt;br /&gt;
| &lt;br /&gt;
| arbitrary Java Object -&amp;gt; opaque reference to alien Java Object&lt;br /&gt;
| original Java Object (identity preserving)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
(!) does not work, yet: at the time of writing, Smalltalk objects other than the basic types listed above cannot be passed to Java.&lt;br /&gt;
However, the reverse direction is possible, and Smalltalk includes a mechanisms to handle (and even inspect) remote Java objects.&lt;br /&gt;
&lt;br /&gt;
==== No Smallalk Classes, No Smalltalk Objects ====&lt;br /&gt;
Of course, no Smalltalk class can be used directly in Groovy code.&lt;br /&gt;
And Smalltalk objects can only be passed as opaque handles to/from Groovy as described above.&lt;br /&gt;
However, all Java classes are at your hands now!&lt;br /&gt;
Some limited interaction with expecco and underlying Smalltalk objects is possible via the &amp;quot;eval()&amp;quot; and &amp;quot;perform()&amp;quot; API described below.&lt;br /&gt;
&lt;br /&gt;
However, in general: if more complex objects need to be interchanged, this must be either done by converting them to an array (of objects), possibly an array of arrays, which is passed to a Groovy &amp;quot;interface function&amp;quot; first, which instantiates the required Java object(s). Or, alternatively to some ascii representation (XML or JSON, for a more lightweight approach) and convert this back and forth.&lt;br /&gt;
&lt;br /&gt;
=== Handling of Java Objects in expecco/Smalltalk ===&lt;br /&gt;
&lt;br /&gt;
==== Java Object References (Handles) ====&lt;br /&gt;
&lt;br /&gt;
Groovy elementary function can return references to Java objects via output pins. Because the actual object is located inside a JVM (i.e. outside of expecco), these references are treated like opaque handles by the underlying Smalltalk runtime system. However, a mechanism is provided to allow for almost transparent access to the referenced object&#039;s private slots, its classes&#039; static slots, its class hierarchy and method information. The object inspector is able to present that information in a convenient way, similar to how Smalltalk objects are presented. Also methods of the Java object can be called and values returned to expecco.&lt;br /&gt;
&lt;br /&gt;
==== Message Forwarding ====&lt;br /&gt;
&lt;br /&gt;
Smalltalk and JavaScript code can send regular messages to Java objects. This is possible via the Smalltalk &amp;quot;doesNotUnderstand:&amp;quot; mechanism, which intercepts any call, sends a message to the real object (via the JavaBridge), awaits an answer and returns the result, which is usually a reference to another Java object. All of this is transparent to the programmer of the elementary code, except for the fact that Java method naming is different from Smalltalk (and of course the performance penalty, due to the interprocess communication and marshalling overhead).&lt;br /&gt;
&lt;br /&gt;
==== Method Name Conversions ====&lt;br /&gt;
&lt;br /&gt;
When a message is sent from Smalltalk code to a Java object, a message translation mechanism similar to the Smalltalk &amp;lt;-&amp;gt; JavaScript mechanism is used:&lt;br /&gt;
 foo                  -&amp;gt; foo()&lt;br /&gt;
 foo:arg              -&amp;gt; foo(arg)&lt;br /&gt;
 foo:a1 _:a2 ... _:aN -&amp;gt; foo(a1, a2, ... aN) where the &amp;quot;_&amp;quot; are arbitrary strings.&lt;br /&gt;
&lt;br /&gt;
thus, to call a Java object&#039;s &amp;quot;installHandler(arg1, arg2, arg3)&amp;quot; function, you should write in Smalltalk:&lt;br /&gt;
 javaObject installHandler:arg1 _:arg2 _:arg3&lt;br /&gt;
and in JavaScript:&lt;br /&gt;
 javaObject.installhandler(arg1, arg2, arg3)&lt;br /&gt;
&lt;br /&gt;
It is obvious, that this kind of code is better written in JavaScript, being the same as a native Java call would look like.&lt;br /&gt;
&lt;br /&gt;
==== Current IDE Limitations ====&lt;br /&gt;
&lt;br /&gt;
The Smalltalk IDE has currently only limited support to extract and present Java&#039;s static type information. Currently, there is no  class- and function name completion in the editor, making elementary code development for Java/Groovy less pleasant. Therefore, for complicated setups, it is a good idea to open a specialized Java development environment (e.g. eclipse) in parallel, and test the setup code there before copy-pasting it into a Groovy block.&lt;br /&gt;
&lt;br /&gt;
Eclipse is also useful to find out class- and method names during development.&lt;br /&gt;
&lt;br /&gt;
=== Groovy Code API ===&lt;br /&gt;
&lt;br /&gt;
Groovy code supports a &#039;&#039;&#039;subset&#039;&#039;&#039; of the above activity functions, &lt;br /&gt;
which is intended provide an interface similar to the JavaScript and Smalltalk elementary code API. Of course, technically for every API function below, the elementary code executing in the remote Java VM has to make a remote procedure call back to expecco. On the JVM side, this is done very similar to the above described remote message mechanism, when messages are sent from Smalltalk to Java/Groovy. However, due to the static type system, it is not possible to call previously unknown interfaces. Therefore, only a fixed set of API entry points is supported.&lt;br /&gt;
&lt;br /&gt;
==== Attention / Warning ====&lt;br /&gt;
&lt;br /&gt;
Unless explicitely prevented by the &amp;quot;mayStillDoExpeccoCalls()&amp;quot; function ([[#Special_Functions |described below]]),&lt;br /&gt;
all called expecco functions listed below will ONLY work as expected WHILE the groovy action is still ACTIVE (i.e. while inside the Groovy &amp;quot;execute()&amp;quot; function).&lt;br /&gt;
&lt;br /&gt;
The reason is that expecco ensures that handlers, which are responsible for transferring information from the groovy code back to expecco,&lt;br /&gt;
will always be released, when the Groovy step has finished its execution. &lt;br /&gt;
This is mostly required to prevent memory leaks in the JavaVM,&lt;br /&gt;
because the observer instance object is registered inside the JVM and would remain there forever, if not unregistered. This observer object is a proxy for Java code, which implements all the functions below and forwards them (via an IPC mechanism) to expecco. One new such object is required for every Groovy action execution and if not released, they sooner or later consume huge amounts of JVM memory. Therefore, def default action after Groovy action execution is to release the observer. &lt;br /&gt;
&lt;br /&gt;
In most Groovy blocks this is not a problem, except for those which install callback methods,&lt;br /&gt;
AND those callbacks get called AFTER the Groovy block has finished (for example by another Java thread),&lt;br /&gt;
AND the callback code calls one of those expecco interface functions. This includes the Transcript output functions, notifications and pin value writers.&lt;br /&gt;
 &lt;br /&gt;
If any of them is called after the step has finished, they will be ignored and behave like a no-operation, unless the observer is still around.&lt;br /&gt;
Of course, writing to a pin from within a callback AFTER the execute() function has finished does not work in any case (with or without a kept observer). The behavior in this case is undefined; currently, it is a no-operation, but it may be changed to raise an error in future versions.&lt;br /&gt;
&lt;br /&gt;
==== Current Activity (Groovy) ====&lt;br /&gt;
The current activity instance is accessed as &amp;quot;&#039;&#039;this&#039;&#039;&amp;quot; (like in an elementary JavaScript block). For every executed action, a new activity object is created. It is usually alive during the execution only (i.e. it is destroyed and its memory reused automatically, after the block&#039;s action has finished). In Groovy (as in JavaScript or Java), if no receiver is given for a function call, &amp;quot;&#039;&#039;this&#039;&#039;&amp;quot; is the implicit receiver. Thus the statements &amp;quot;&amp;lt;CODE&amp;gt;this.logInfo(&amp;quot;hello&amp;quot;)&amp;lt;/CODE&amp;gt;&amp;quot; and &amp;quot;&amp;lt;CODE&amp;gt;logInfo(&amp;quot;hello&amp;quot;)&amp;lt;/CODE&amp;gt;&amp;quot; are equivalent.&lt;br /&gt;
&lt;br /&gt;
==== Reporting (Groovy) ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;error&#039;&#039;&#039; () &amp;lt;br&amp;gt;Report a defect (in the test). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;error&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) &amp;lt;br&amp;gt;Report a defect (in the test). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;fail&#039;&#039;&#039; () &amp;lt;br&amp;gt;Report a failure (in the SUT). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;fail&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) &amp;lt;br&amp;gt;Report a failure (in the SUT). Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;inconclusive&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Report an inconclusive test. Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;inconclusive&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;) &amp;lt;br&amp;gt;Report an inconclusive test. Stops execution.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;activitySuccess&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Finishes the current activity with success.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;activitySuccess&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;)&amp;lt;br&amp;gt;Finishes the current activity with success.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pass&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Finishes the current testCase with success.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;pass&#039;&#039;&#039; (&#039;&#039;infoString&#039;&#039;)&amp;lt;br&amp;gt;Finishes the current testCase with success.&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Logging (Groovy) ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logError&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) &amp;lt;br&amp;gt;Adds a error message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logError&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, &#039;&#039;detail&#039;&#039;) &amp;lt;br&amp;gt;Adds a error message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logWarning&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) &amp;lt;br&amp;gt;Adds a warning to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logWarning&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, &#039;&#039;detail&#039;&#039;) &amp;lt;br&amp;gt;Adds a warning to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logInfo&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;) &amp;lt;br&amp;gt;Adds an info message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;logInfo&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;, detail) &amp;lt;br&amp;gt;Adds an info message to the activity log.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;alert&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;)&amp;lt;br&amp;gt;Adds an warning message to the activity log, and also shows a DialogBox, which has to be confirmed by the operator. The dialog box and confirmation can be disabled by a settings flag in the &amp;quot;Execution - Log -Settings&amp;quot; dialog (by default it is disabled).&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;warn&#039;&#039;&#039; (&#039;&#039;messageString&#039;&#039;)&amp;lt;br&amp;gt;Same as &#039;&#039;alert()&#039;&#039; (for Smalltalk compatibility).&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Reflection, Information, Queries and Accessing (Groovy) ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;environmentAt&#039;&#039;&#039; (&#039;&#039;anEnvironmentVarName&#039;&#039;) &amp;lt;br&amp;gt;The value of an environment variable&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;environmentAt_put&#039;&#039;&#039; (&#039;&#039;anEnvironmentVarName&#039;&#039;, &#039;&#039;value&#039;&#039;) &amp;lt;br&amp;gt;Changing the value of an environment variable.&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;nameOfActiveTestPlan&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the currently executing text plan&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nameOfActiveTestPlanItem&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the currently executing text case&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;nameOfStep&#039;&#039;&#039; () &amp;lt;br&amp;gt;The name of the corresponding step of the activity&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Interaction with Expecco (Groovy) ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;eval&#039;&#039;&#039; (&#039;&#039;smalltalkCodeString&#039;&#039;) &amp;lt;br&amp;gt;Evaluate a piece of Smalltalk code inside expecco.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;evalJS&#039;&#039;&#039; (&#039;&#039;javascriptCodeString&#039;&#039;) &amp;lt;br&amp;gt;Evaluate a piece of JavaScript code inside expecco.&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Special Functions ====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;mayStillDoExpeccoCalls&#039;&#039;&#039; (&#039;&#039;boolean&#039;&#039;) &amp;lt;br&amp;gt;Make sure that the functions described here will still be callable (by Java callback functions from other threads) even after the step has finished execution. In other words, do NOT release the observer object which is responsible for the transfer of information between the two systems. Be aware that this object remains and will never be released, until the bridge connection is closed. I.e. there is a potential for a memory leak inside the Java VM here.&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==== Pin Functions (Groovy) ====&lt;br /&gt;
Currently, groovy blocks do not support a variable number of input or output pins.&lt;br /&gt;
&lt;br /&gt;
Attention:&lt;br /&gt;
&amp;lt;br&amp;gt;Groovy uses many more reserved keywords for syntax than JavaScript or Smalltalk. These keywords cannot be used as pin names, and you will get a syntax error (&amp;quot;&amp;lt;foo&amp;gt; token not expected&amp;quot;) if you try. Be careful to not name your pins as any of: &amp;quot;in&amp;quot;, &amp;quot;return&amp;quot;, &amp;quot;class&amp;quot;, &amp;quot;private&amp;quot;, &amp;quot;public&amp;quot;, etc. As a proven best practice, add a &amp;quot;Pin&amp;quot; suffix to your pin names (i.e. name it &amp;quot;inPin&amp;quot;, instead of &amp;quot;in&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===== Input Pins (Groovy) =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;hasValue&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns true if the pin has received a value&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; () &amp;lt;br&amp;gt;Returns the value of the pin. Raises an error if the pin did not receive any value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;valueIfAbsent&#039;&#039;&#039; (&#039;&#039;alternativeValue&#039;&#039;) &amp;lt;br&amp;gt;Returns the value of a pin or the alternativeValue if the pin did not receive any value.&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===== Output Pins (Groovy) =====&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;isBuffered&#039;&#039;&#039; () &amp;lt;br&amp;gt;True if the pin is buffered&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- *&#039;&#039;&#039;isConnected&#039;&#039;&#039;() &amp;lt;br&amp;gt;Returns true if the pin is connected&lt;br /&gt;
 --&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; (&#039;&#039;data&#039;&#039;) &amp;lt;br&amp;gt;Writes the value.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=== Transcript, Stderr and Stdout === &lt;br /&gt;
&lt;br /&gt;
The expecco &amp;quot;Transcript&amp;quot;, &amp;quot;Stderr&amp;quot; and &amp;quot;Stdout&amp;quot; are also accessable from Groovy code. However, only a limited subset of messages is supported:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;cr&#039;&#039;&#039; ()&amp;lt;br&amp;gt;Adds a linebreak (i.e. followup text will be shown on the next line)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;show&#039;&#039;&#039; (&#039;&#039;arg&#039;&#039;)&amp;lt;br&amp;gt;Adds a textual representation of the argument, which can be a string, number or any other object.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;showCR&#039;&#039;&#039; (&#039;&#039;arg&#039;&#039;)&amp;lt;br&amp;gt;A combination of show(), followed by a linebreak.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;writeLine&#039;&#039;&#039; (&#039;&#039;string&#039;&#039;)&amp;lt;br&amp;gt;For compatibility with Java&#039;s PrintStream protocol.&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== VisualBasic Script Elementary Blocks ==&lt;br /&gt;
&lt;br /&gt;
Support for VisualBasic Script elementary block execution is provided as an extension plugin, and requires a separate plugin license.&lt;br /&gt;
It is only available for expecco running on the MSWindows operating system.&lt;br /&gt;
&lt;br /&gt;
Code written as a VisualBasic elementary block is not executed directly by expecco. Instead, the code is forwarded to a VisualBasic scripting host which runs as another process either on the local or on a remote host. The scripting host must be a Microsoft Windows host (but expecco itself may run on any type of operating system). By using VisualBasic blocks, expecco&#039;s basic black box test functionality can be easiliy extended by many powerful gray- and white-box tests. Many libraries for device and equipment control, COM/DCOM and other technologies and UI interaction are possible with the VisualBasic plugin.&lt;br /&gt;
&lt;br /&gt;
Please consult the separate [[VBScript | VisualBasic plugin documentation]] for more detail.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Square Root Block ===&lt;br /&gt;
&lt;br /&gt;
A function, which computes the square root of its input value, could be implemented like that:&lt;br /&gt;
(the names of the pins are: &#039;&#039;in&#039;&#039; and &#039;&#039;out&#039;&#039;, their data type is &#039;&#039;Number):&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
(runs inside expecco, when executed)&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    var inValue;&lt;br /&gt;
&lt;br /&gt;
    inValue = in.value;          // Reading input pin value&lt;br /&gt;
    out.value( inValue.sqrt() ); // Writing to output pin&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
alternative:&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    var inValue;&lt;br /&gt;
&lt;br /&gt;
    inValue = in.value;              // Reading input pin value&lt;br /&gt;
    out.value( Math.sqrt(inValue) ); // Writing to output pin&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
(runs inside expecco, when executed)&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    |inValue|&lt;br /&gt;
&lt;br /&gt;
    inValue := in value.       &amp;quot;/ Reading input pin value&lt;br /&gt;
    out value: inValue sqrt.   &amp;quot;/ Writing to output pin&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Groovy=====&lt;br /&gt;
(runs inside the JVM, which may be the system under test or another machine running Java)&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
def execute {&lt;br /&gt;
    Object inValue;&lt;br /&gt;
&lt;br /&gt;
    inValue = inPin.value();           // Reading input pin value&lt;br /&gt;
    outPin.value(Math.sqrt(inValue));   // Writing to output pin&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
(Notice: &amp;quot;in&amp;quot; is a reserved keyword in Groovy and cannot be used as pin name)&lt;br /&gt;
&lt;br /&gt;
=== Random-Fail Block ===&lt;br /&gt;
&lt;br /&gt;
A block, which randomly fails (to demonstrate exception handling), could be implemented like:&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    var dice;&lt;br /&gt;
&lt;br /&gt;
    dice = Random.nextIntegerBetween_and_(1,6);&lt;br /&gt;
    if (dice &amp;lt;= 2) {&lt;br /&gt;
        fail();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    |dice|&lt;br /&gt;
&lt;br /&gt;
    dice := Random nextIntegerBetween:1 and:6.&lt;br /&gt;
    (dice &amp;lt;= 2) ifTrue:[&lt;br /&gt;
        self fail.&lt;br /&gt;
    ].&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Groovy =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    Random rand = new Random();&lt;br /&gt;
    int  dice = rand.nextInt(5)+1;&lt;br /&gt;
&lt;br /&gt;
    if (dice &amp;lt;= 2) {&lt;br /&gt;
        fail();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the Smalltalk/X Class Library (Smalltalk and JavaScript Blocks Only) ===&lt;br /&gt;
&lt;br /&gt;
Please note, that besides these direct interfaces with the expecco system described here, you can also use the whole class library of the runtime system. Please check the corresponding [http://live.exept.de/doc/online/english/programming/TOP.html Smalltalk/X Documentation] as well as the [http://live.exept.de/ClassDoc Documentation of the Class APIs]. &lt;br /&gt;
&lt;br /&gt;
Here are more examples, using that class library:&lt;br /&gt;
&lt;br /&gt;
=== Bulk-Data Reading from a File ===&lt;br /&gt;
&lt;br /&gt;
The following code reads a measurement data block of 100000 floating point values from file. The file was created beforehand by a recorder device, which was triggered by a dll-callout.&lt;br /&gt;
For the demonstration, the code below does not read its values from input pins. In a real world application, the size of the file and its fileName would probably be passed in via input pins, of course.&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    var N;  // should be read from an input-pin&lt;br /&gt;
    var fileName; // should be read from an input-pin&lt;br /&gt;
    var dataArray;&lt;br /&gt;
    var fileStream;&lt;br /&gt;
&lt;br /&gt;
    N = 100000;&lt;br /&gt;
    fileName = &#039;dataFile.dat&#039;;&lt;br /&gt;
    fileStream = fileName.asFilename().readStream();&lt;br /&gt;
    dataArray = Array.new(N);&lt;br /&gt;
    for (i=1; i&amp;lt;=N; i++) {&lt;br /&gt;
        dataArray[i] = fileStream.nextIEEESingle();&lt;br /&gt;
    }&lt;br /&gt;
    out.value(dataArray);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    |N fileName dataArray fileStream|&lt;br /&gt;
&lt;br /&gt;
    N := 100000.&lt;br /&gt;
    fileName := &#039;dataFile.dat&#039;.&lt;br /&gt;
    fileStream := fileName asFilename readStream.&lt;br /&gt;
    dataArray := (1 to:N) collect:[:i | fileStream nextIEEESingle].&lt;br /&gt;
    out value:dataArray.&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sending Messages to the Transcript ===&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    Transcript.showCR(&amp;quot;---------------------&amp;quot;);&lt;br /&gt;
    for (var y=1; y&amp;lt;=10; y++) {&lt;br /&gt;
        for (var x=1; x&amp;lt;=10; x++) {&lt;br /&gt;
            Transcript.show( x * y );&lt;br /&gt;
            Transcript.show( &amp;quot; &amp;quot; );&lt;br /&gt;
        }&lt;br /&gt;
        Transcript.cr();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    Transcript showCR:&#039;---------------------&#039;.&lt;br /&gt;
    1 to:10 do:[:y |&lt;br /&gt;
        1 to:10 do:[:x |&lt;br /&gt;
            Transcript show:(x * y); show:&#039; &#039;.&lt;br /&gt;
        ].&lt;br /&gt;
        Transcript cr.&lt;br /&gt;
    ].&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Groovy =====&lt;br /&gt;
&lt;br /&gt;
A few of the common messages and objects for logging and printing are also made available to Groovy code. Of course, a hidden inter-process mechanism is used, which forwards those calls back to expecco (remember: the Groovy code runs inside the system under test). The Transcript object seen by Groovy code is such a proxy object which implements a subset of the Smalltalk Transcript object but passes the argument strings via IPC back to expecco.&lt;br /&gt;
So although the code looks similar to the above, the internal implementation (and timing) is completely different.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
def execute() {&lt;br /&gt;
    Transcript.showCR(&amp;quot;---------------------&amp;quot;);&lt;br /&gt;
    for (int y=1; y&amp;lt;=10; y++) {&lt;br /&gt;
        for (int x=1; x&amp;lt;=10; x++) {&lt;br /&gt;
            Transcript.show( x * y );&lt;br /&gt;
            Transcript.show( &amp;quot; &amp;quot; );&lt;br /&gt;
        }&lt;br /&gt;
        Transcript.cr();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reading/Writing Pin Values ===&lt;br /&gt;
&lt;br /&gt;
Assuming that the block has two pins, named &amp;quot;in1&amp;quot; and &amp;quot;in2&amp;quot; and two output pins, named &amp;quot;out1&amp;quot; and &amp;quot;out2&amp;quot;,&lt;br /&gt;
the following blocks write concatenated strings to both outputs:&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    out1.value( in1.value() + in2.value() );&lt;br /&gt;
    out2.value( in2.value() + in1.value() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    out1 value:(in1 value , in2 value).&lt;br /&gt;
    out2 value:(in2 value , in1 value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Groovy =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
def execute() {&lt;br /&gt;
    out1.value( in1.value() + in2.value() );&lt;br /&gt;
    out2.value( in2.value() + in1.value() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reading/writing Environment Variables ===&lt;br /&gt;
&lt;br /&gt;
Assuming that a String-typed environment variable named &amp;quot;IncDec&amp;quot; and an Integer-typed variable named&lt;br /&gt;
&amp;quot;Counter&amp;quot; exist in the project&#039;s environment, and are writable,&lt;br /&gt;
the following blocks read and write to either variable:&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    if ( environmentAt(&amp;quot;IncDec&amp;quot;) == &amp;quot;inc&amp;quot; ) {&lt;br /&gt;
        environmentAt_put(&amp;quot;Counter&amp;quot;, environmentAt(&amp;quot;Counter&amp;quot;) + 1);&lt;br /&gt;
    } else {&lt;br /&gt;
        environmentAt_put(&amp;quot;Counter&amp;quot;, environmentAt(&amp;quot;Counter&amp;quot;) - 1);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    (self environmentAt:&#039;IncDec&#039;) = &#039;inc&#039; ) ifTrue:[&lt;br /&gt;
        self environmentAt:&#039;Counter&#039; put:(self environmentAt:&#039;Counter&#039;) + 1).&lt;br /&gt;
    ] ifFalse:[&lt;br /&gt;
        self environmentAt:&#039;Counter&#039; put:(self environmentAt:&#039;Counter&#039;) - 1).&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Groovy =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
def execute() {&lt;br /&gt;
    if ( environmentAt(&amp;quot;IncDec&amp;quot;) == &amp;quot;inc&amp;quot; ) {&lt;br /&gt;
        environmentAt_put(&amp;quot;Counter&amp;quot;, environmentAt(&amp;quot;Counter&amp;quot;) + 1);&lt;br /&gt;
    } else {&lt;br /&gt;
        environmentAt_put(&amp;quot;Counter&amp;quot;, environmentAt(&amp;quot;Counter&amp;quot;) - 1);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Opening/Using Smalltalk/X Applications, Dialogs and Components ===&lt;br /&gt;
&lt;br /&gt;
Any existing Smalltalk/X utility (both the one&#039;s which are provided with the base system, and even those coming from additional loaded Smalltalk code) can be called and used. For example, the following uses the builtin file dialog to ask for a directory.&lt;br /&gt;
&lt;br /&gt;
===== JavaScript =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute() {&lt;br /&gt;
    var answer;&lt;br /&gt;
&lt;br /&gt;
    answer = Dialog.requestDirectory(&amp;quot;Please select an output folder:&amp;quot;);&lt;br /&gt;
    if ( answer.notEmptyOrNil() ) {&lt;br /&gt;
        out.value( answer );&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    |answer|&lt;br /&gt;
&lt;br /&gt;
    answer := Dialog requestDirectory: &#039;Please select an output folder:&#039;.&lt;br /&gt;
    answer notEmptyOrNil ifTrue:[&lt;br /&gt;
        out value: answer&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Loading Additional Smalltalk/X Code ===&lt;br /&gt;
&lt;br /&gt;
You can even create whole library or application packages, compile it as separate package, and load it dynamically to be used from within an elementary block. Assuming that a package named &amp;quot;myPackage.dll&amp;quot; (or &amp;quot;myPackage.so&amp;quot; under Unix/Linux) containing an application class named &amp;quot;MyApplication&amp;quot; has been created and is located in the expecco bin folder, the code can be loaded and executed with:&lt;br /&gt;
&lt;br /&gt;
===== Smalltalk =====&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    |answer|&lt;br /&gt;
&lt;br /&gt;
    Smalltalk loadPackage:&#039;myPackage&#039;. &amp;quot;/ checks if already loaded, to only load the first time called&lt;br /&gt;
    MyApplication open.&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this, download the free [http://www.smalltalk-x.de Smalltalk/X development IDE ].&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
&lt;br /&gt;
=== Smalltalk Language Syntax (BNF) ===&lt;br /&gt;
&lt;br /&gt;
See also: [http://rosettacode.org/wiki/Category:Smalltalk Smalltalk Short Description ], [http://live.exept.de/doc/online/english/getstart/tut_2.html Smalltalk Basics]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
 ;; notice: an elementary Smalltalk Block&#039;s execute method is a unary method (no argument).&lt;br /&gt;
&lt;br /&gt;
 method ::= selectorSpec body&lt;br /&gt;
&lt;br /&gt;
 selectorSpec&amp;gt; ::= unarySelectorSpec | binarySelectorSpec | keywordSelectorSpec&lt;br /&gt;
&lt;br /&gt;
 unarySelectorSpec ::= symbol&lt;br /&gt;
&lt;br /&gt;
 binarySelectorSpec ::= binopSymbol identifier&lt;br /&gt;
&lt;br /&gt;
 keywordSelectorSpec ::= ( keywordSymbol identifier )+&lt;br /&gt;
&lt;br /&gt;
 body ::= [ &amp;quot;|&amp;quot; localVarList &amp;quot;|&amp;quot; ]  [statements]&lt;br /&gt;
&lt;br /&gt;
 localVarList ::= ( identifier )+&lt;br /&gt;
&lt;br /&gt;
 statements ::= statement &lt;br /&gt;
                        | statement &amp;quot;.&amp;quot; &lt;br /&gt;
                        | statement &amp;quot;.&amp;quot; statements&lt;br /&gt;
&lt;br /&gt;
 statement ::= expression&lt;br /&gt;
                      | returnStatement&lt;br /&gt;
&lt;br /&gt;
 returnStatement ::= &amp;quot;^&amp;quot; expression&lt;br /&gt;
&lt;br /&gt;
 expression ::= identifier &amp;quot;:=&amp;quot; expression&lt;br /&gt;
                        | keywordExpression&lt;br /&gt;
&lt;br /&gt;
 keywordExpression ::= binaryExpression&lt;br /&gt;
                                     | binaryExpression ( keywordSymbol binaryExpression )+&lt;br /&gt;
&lt;br /&gt;
 binaryExpression ::= unaryExpression&lt;br /&gt;
                                  | unaryExpression ( binopSymbol unaryExpression )+&lt;br /&gt;
&lt;br /&gt;
 unaryExpression ::= primary&lt;br /&gt;
                                 | primary ( unarySymbol )+&lt;br /&gt;
&lt;br /&gt;
 primary ::= identifier&lt;br /&gt;
                   | literalConstant&lt;br /&gt;
                   | braceArray&lt;br /&gt;
                   | &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot;&lt;br /&gt;
                   | block&lt;br /&gt;
                   | &amp;quot;self&amp;quot;&lt;br /&gt;
                   | &amp;quot;super&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 identifier ::= ( &amp;quot;_&amp;quot; | &amp;quot;a&amp;quot;-&amp;quot;z&amp;quot; | &amp;quot;A&amp;quot;-&amp;quot;Z&amp;quot;)   ( &amp;quot;_&amp;quot; | &amp;quot;a&amp;quot;-&amp;quot;z&amp;quot; | &amp;quot;A&amp;quot;-&amp;quot;Z&amp;quot; | &amp;quot;0&amp;quot;-&amp;quot;9&amp;quot; )* &lt;br /&gt;
&lt;br /&gt;
 literalConstant ::= integerConstant&lt;br /&gt;
                              | radixIntegerConstant&lt;br /&gt;
                              | floatConstant&lt;br /&gt;
                              | arrayConstant&lt;br /&gt;
                              | byteArrayConstant&lt;br /&gt;
                              | stringConstant&lt;br /&gt;
                              | characterConstant&lt;br /&gt;
                              | &amp;quot;true&amp;quot;&lt;br /&gt;
                              | &amp;quot;false&amp;quot;&lt;br /&gt;
                              | &amp;quot;nil&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 integerConstant ::= ( &amp;quot;0&amp;quot;-&amp;quot;9&amp;quot; )+&lt;br /&gt;
&lt;br /&gt;
 radixIntegerConstant ::= base &amp;quot;r&amp;quot; baseDigits+&lt;br /&gt;
&lt;br /&gt;
 base ::= integerConstant (2-31)&lt;br /&gt;
&lt;br /&gt;
 baseDigits := &amp;quot;0&amp;quot;-&amp;quot;9&amp;quot; | &amp;quot;A&amp;quot;-&amp;quot;Z&amp;quot; | &amp;quot;a&amp;quot;-&amp;quot;z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 floatConstant ::= [ &amp;quot;-&amp;quot; ] [ digits+ ] &amp;quot;.&amp;quot; [ digits+ ] [ (&amp;quot;e&amp;quot; | &amp;quot;E&amp;quot; | &amp;quot;d&amp;quot; | &amp;quot;D&amp;quot;) [ &amp;quot;-&amp;quot;] digits+ ]&lt;br /&gt;
&lt;br /&gt;
 arrayConstant ::= &amp;quot;#(&amp;quot; literalConstant* &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 byteArrayConstant ::= &amp;quot;#[&amp;quot; integerConstant(0..255)* &amp;quot;]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 stringConstant ::= &amp;quot; &#039; &amp;quot; character* &amp;quot; &#039; &amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 characterConstant ::= &amp;quot;$&amp;quot; character&lt;br /&gt;
&lt;br /&gt;
 braceArray ::= &amp;quot;{&amp;quot; [ expression | expression ( &amp;quot;.&amp;quot; expression )+ ] &amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 block ::= &amp;quot;[&amp;quot; [ blockArgList ] body &amp;quot;]”&lt;br /&gt;
&lt;br /&gt;
 blockArgList ::= (identifier&amp;quot;:&amp;quot; )*&lt;br /&gt;
&lt;br /&gt;
 comment ::= &amp;quot; &amp;quot; &amp;quot; any-character* &amp;quot; &amp;quot; &amp;quot; | eolComment&lt;br /&gt;
&lt;br /&gt;
 eolComment ::= &amp;quot; &amp;quot;/ &amp;quot; any-character-up-to-end-of-line&lt;br /&gt;
&lt;br /&gt;
 symbol ::= identifier&lt;br /&gt;
&lt;br /&gt;
 binopSymbol ::= ( &amp;quot;+&amp;quot; | &amp;quot;-&amp;quot; | &amp;quot;*&amp;quot; | &amp;quot;/&amp;quot; | &amp;quot;\&amp;quot; | &amp;quot;,&amp;quot; | &amp;quot;@&amp;quot; | &amp;quot;%&amp;quot; | &amp;quot;&amp;amp;&amp;quot; | &amp;quot;=&amp;quot; | &amp;quot;&amp;lt;&amp;quot; | &amp;quot;&amp;gt;&amp;quot; | &amp;quot;~&amp;quot; )+&lt;br /&gt;
&lt;br /&gt;
 keywordSymbol ::= identifier&amp;quot;:&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== JavaScript Language Syntax (BNF) ===&lt;br /&gt;
&lt;br /&gt;
-- incomplete w.r.t. expression syntax -- to be added&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
 ;; notice: an elementary JavaScript Block&#039;s execute function must be a unary function (no argument).&lt;br /&gt;
&lt;br /&gt;
 method ::= functionSpec functionBody&lt;br /&gt;
&lt;br /&gt;
 functionSpec ::= identifier &amp;quot;(&amp;quot;  [argList] &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 functionBody ::= &amp;quot;{&amp;quot; (statement)+ &amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 statement ::= varDeclaration&lt;br /&gt;
                      | ifStatement&lt;br /&gt;
                      | whileStatement&lt;br /&gt;
                      | doStatement&lt;br /&gt;
                      | forStatement&lt;br /&gt;
                      | tryCatchStatement&lt;br /&gt;
                      | switchStatement&lt;br /&gt;
                      | returnStatement&lt;br /&gt;
                      | &amp;quot;{&amp;quot; (statement)+ &amp;quot;}&amp;quot;&lt;br /&gt;
                      | expression&lt;br /&gt;
&lt;br /&gt;
 varDeclaration ::= &amp;quot;var&amp;quot; identifier ( &amp;quot;,&amp;quot;  identifier)* &amp;quot;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 ifStatement ::= &amp;quot;if&amp;quot; &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot; statement&lt;br /&gt;
                         [ &amp;quot;else&amp;quot; statement ]&lt;br /&gt;
&lt;br /&gt;
 whileStatement ::= &amp;quot;while&amp;quot; &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot; statement&lt;br /&gt;
 &lt;br /&gt;
 doStatement ::= &amp;quot;do&amp;quot; statement &amp;quot;while&amp;quot; &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot;  &amp;quot;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 forStatement ::= &amp;quot;for&amp;quot; &amp;quot;(&amp;quot; [expression] &amp;quot;;&amp;quot; [expression] &amp;quot;;&amp;quot; [expression] &amp;quot;)&amp;quot; statement&lt;br /&gt;
&lt;br /&gt;
 tryCatchStatement ::= &amp;quot;try&amp;quot; statement (catchClause | finallyClause | catchFinallyClause)&lt;br /&gt;
&lt;br /&gt;
 catchClause ::= &amp;quot;catch&amp;quot;  &amp;quot;(&amp;quot; identifier [identifier] &amp;quot;)&amp;quot; statement&lt;br /&gt;
&lt;br /&gt;
 finallyClause ::= &amp;quot;finally&amp;quot;  statement&lt;br /&gt;
&lt;br /&gt;
 catchFinallyClause ::= catchClause finallyClause&lt;br /&gt;
&lt;br /&gt;
 switchStatement ::= &amp;quot;switch&amp;quot; &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot; &amp;quot;{&amp;quot; (&amp;quot;case constantExpression &amp;quot;:&amp;quot; statement)+ [ &amp;quot;default:&amp;quot; statement+ &amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 returnStatement ::= &amp;quot;return&amp;quot; expression [ &amp;quot;from&amp;quot; identifier ]&lt;br /&gt;
&lt;br /&gt;
 expression ::= term ( (&amp;quot;+&amp;quot; | &amp;quot;-&amp;quot;) term)*&lt;br /&gt;
&lt;br /&gt;
 term ::= factor ( (&amp;quot;*&amp;quot; | &amp;quot;/&amp;quot; | &amp;quot;%&amp;quot; ) factor)*&lt;br /&gt;
&lt;br /&gt;
 factor ::= &amp;quot;typeof&amp;quot; &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot;&lt;br /&gt;
                | &amp;quot;!&amp;quot; factor&lt;br /&gt;
                | &amp;quot;-&amp;quot; factor&lt;br /&gt;
                | &amp;quot;++&amp;quot; factor&lt;br /&gt;
                | &amp;quot;--&amp;quot; factor&lt;br /&gt;
                | primary &amp;quot;--&amp;quot;&lt;br /&gt;
                | primary &amp;quot;++&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 primary ::= identifier&lt;br /&gt;
                   | literalConstant&lt;br /&gt;
                   | &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot;&lt;br /&gt;
                   | block&lt;br /&gt;
                   | &amp;quot;this&amp;quot;&lt;br /&gt;
                   | &amp;quot;super&amp;quot;&lt;br /&gt;
                   | &amp;quot;new&amp;quot; classIdentifier [ &amp;quot;(&amp;quot; constant &amp;quot;)&amp;quot; ]&lt;br /&gt;
                   | functionDefinition&lt;br /&gt;
&lt;br /&gt;
 functionDefinition ::= &amp;quot;function&amp;quot; [functionName] &amp;quot;(&amp;quot;  [argList] &amp;quot;)&amp;quot; functionBody&lt;br /&gt;
&lt;br /&gt;
 identifier ::= ( &amp;quot;_&amp;quot; | &amp;quot;a&amp;quot;-&amp;quot;z&amp;quot; | &amp;quot;A&amp;quot;-&amp;quot;Z&amp;quot;)   ( &amp;quot;_&amp;quot; | &amp;quot;a&amp;quot;-&amp;quot;z&amp;quot; | &amp;quot;A&amp;quot;-&amp;quot;Z&amp;quot; | &amp;quot;0&amp;quot;-&amp;quot;9&amp;quot; )* &lt;br /&gt;
&lt;br /&gt;
 literalConstant ::= integerConstant&lt;br /&gt;
                              | radixIntegerConstant&lt;br /&gt;
                              | floatConstant&lt;br /&gt;
                              | arrayConstant&lt;br /&gt;
                              | byteArrayConstant&lt;br /&gt;
                              | stringConstant&lt;br /&gt;
                              | characterConstant&lt;br /&gt;
                              | &amp;quot;true&amp;quot;&lt;br /&gt;
                              | &amp;quot;false&amp;quot;&lt;br /&gt;
                              | &amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 integerConstant ::= ( &amp;quot;0&amp;quot;-&amp;quot;9&amp;quot; )+&lt;br /&gt;
&lt;br /&gt;
 radixIntegerConstant ::= hexIntegerConstant | octalIntegerConstant | binaryIntegerConstant&lt;br /&gt;
&lt;br /&gt;
 hexIntegerConstant ::= &amp;quot;0x&amp;quot;hexDigit+&lt;br /&gt;
&lt;br /&gt;
 hexDigit := &amp;quot;0&amp;quot;-&amp;quot;9&amp;quot; | &amp;quot;A&amp;quot;-&amp;quot;F&amp;quot; | &amp;quot;a&amp;quot;-&amp;quot;f&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 octalIntegerConstant ::= &amp;quot;0&amp;quot;octalDigit+&lt;br /&gt;
&lt;br /&gt;
 octalDigit := &amp;quot;0&amp;quot;-&amp;quot;7&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 binaryIntegerConstant ::= &amp;quot;0b&amp;quot;binaryDigit+&lt;br /&gt;
&lt;br /&gt;
 binaryDigit := &amp;quot;0&amp;quot; | &amp;quot;1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 floatConstant ::= [ &amp;quot;-&amp;quot; ] [ digits+ ] &amp;quot;.&amp;quot; [ digits+ ] [ (&amp;quot;e&amp;quot; | &amp;quot;E&amp;quot; | &amp;quot;d&amp;quot; | &amp;quot;D&amp;quot;) [ &amp;quot;-&amp;quot;] digits+ ]&lt;br /&gt;
&lt;br /&gt;
 arrayConstant ::= &amp;quot;[&amp;quot; [literalConstant (&amp;quot;,&amp;quot; literalConstant)*] &amp;quot;]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 stringConstant ::= &amp;quot; &#039; &amp;quot; character* &amp;quot; &#039; &amp;quot; | &amp;quot; &amp;quot; &amp;quot; character* &amp;quot; &amp;quot; &amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 characterConstant ::= &amp;quot;$&amp;quot; character&lt;br /&gt;
&lt;br /&gt;
 comment ::= &amp;quot;/*&amp;quot; any-character* &amp;quot; */ &amp;quot; | eolComment&lt;br /&gt;
&lt;br /&gt;
 eolComment ::= &amp;quot; // &amp;quot; any-character-up-to-end-of-line&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
Back to [[ Online_Documentation#Code_API_Overview Online Documentation ]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4420</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4420"/>
		<updated>2014-11-07T14:19:46Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
The plugin provides a way to place [[#Breakpoints|breakpoints]] into a Java or Groovy code. When breakpoint hits (particular location in the code is reached), the program is stopped and [[#Debugger|a visual debugger]] appear. The debugger then can be used to inspect the state of the execution and/or single-step through the code. &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger&#039;&#039; plugin supports two kinds of breakpoints:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Line Breakpoints&#039;&#039; - a traditional breakpoint set on particular line in particular method. &lt;br /&gt;
# &#039;&#039;Exception Breakpoints&#039;&#039; - a breakpoint that suspends execution when an exception of specified type is thrown. &lt;br /&gt;
&lt;br /&gt;
=== Line Breakpoints ===&lt;br /&gt;
&lt;br /&gt;
A line breakpoint could be placed to a [[ElementaryBlock_Element/en#Groovy_Blocks|Groovy block]] or to any other Java code. When a line breakpoint is hit whole JVM is suspended, i.e., all running Java threads are suspended. &lt;br /&gt;
&lt;br /&gt;
To put a breakpoint in a Groovy block, just click in Groovy block editor left to the line number. The line breakpoint is indicated by a little red circle icon. To remove a breakpoint, just click on the breakpoint icon again.&lt;br /&gt;
&lt;br /&gt;
To put a breakpoint in any other Java code, open a Java browser window, navigate&lt;br /&gt;
to desired class and method and click left the line number. &lt;br /&gt;
&lt;br /&gt;
=== Exception Breakpoints ===&lt;br /&gt;
&lt;br /&gt;
An exception breakpoint hits when an exception of given type (or it&#039;s subtype) is thrown, i.e., at the point just before Java &#039;&#039;&#039;throw&#039;&#039;&#039; statement is executed. This is useful when an exception is thrown and possibly caught and re-thrown again to find out the original cause and debug there. &lt;br /&gt;
&lt;br /&gt;
Exception breakpoints could be configured to trigger in two cases:&lt;br /&gt;
&lt;br /&gt;
* For &#039;&#039;caught exceptions&#039;&#039; - the breakpoint will hit (program will be suspended) if an exception is thrown and would be caught by some handler deeper in the execution stack. Note, that any &#039;&#039;&#039;finally&#039;&#039;&#039; or &#039;&#039;&#039;synchronized&#039;&#039;&#039; block creates&lt;br /&gt;
an implicit exception handler for type [http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html java.lang.Throwable].&lt;br /&gt;
&lt;br /&gt;
* For &#039;&#039;uncaught exception&#039;&#039; - the breakpoin will hit only if an exception is thrown but it is not handled by any handler, i.e., it is unhandled. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: The JVM cannot always reliably tell whether a given exception is actually caught or uncaught. For details, refer to [http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/com/sun/jdi/event/ExceptionEvent.html#catchLocation() JDI documentation]&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_JDebugger_002.png|right|thumb|JDebugger plugin: Java object inspector]]&lt;br /&gt;
&lt;br /&gt;
TBW...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The current version of JDebugger has some limitations:&lt;br /&gt;
&lt;br /&gt;
* A line breakpoint cannot be placed to a nested classes, i.e., to inner classes and to anonymous classes. Note, that UI event handlers, such as button click handlers, are usually implemented using anonymous classes. &lt;br /&gt;
* A breakpoint cannot be placed on a class which is loaded more than once in remote JVM. &lt;br /&gt;
&lt;br /&gt;
These limitations will be addressed in a future versions.&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4290</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4290"/>
		<updated>2014-10-09T11:03:20Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Breakpoints */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
The plugin provides a way to place [[#Breakpoints|breakpoints]] into a Java or Groovy code. When breakpoint hits (particular location in the code is reached), the program is stopped and [[#Debugger|a visual debugger]] appear. The debugger then can be used to inspect the state of the execution and/or single-step through the code. &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger&#039;&#039; plugin supports two kinds of breakpoints:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Line Breakpoints&#039;&#039; - a traditional breakpoint set on particular line in particular method. &lt;br /&gt;
# &#039;&#039;Exception Breakpoints&#039;&#039; - a breakpoint that suspends execution when an exception of specified type is thrown. &lt;br /&gt;
&lt;br /&gt;
=== Line Breakpoints ===&lt;br /&gt;
&lt;br /&gt;
A line breakpoint could be placed to a [[ElementaryBlock_Element/en#Groovy_Blocks|Groovy block]] or to any other Java code. When a line breakpoint is hit whole JVM is suspended, i.e., all running Java threads are suspended. &lt;br /&gt;
&lt;br /&gt;
To put a breakpoint in a Groovy block, just click in Groovy block editor left to the line number. The line breakpoint is indicated by a little red circle icon. To remove a breakpoint, just click on the breakpoint icon again.&lt;br /&gt;
&lt;br /&gt;
To put a breakpoint in any other Java code, open a Java browser window, navigate&lt;br /&gt;
to desired class and method and click left the line number. &lt;br /&gt;
&lt;br /&gt;
=== Exception Breakpoints ===&lt;br /&gt;
&lt;br /&gt;
An exception breakpoint hits when an exception of given type (or it&#039;s subtype) is thrown, i.e., at the point just before Java &#039;&#039;&#039;throw&#039;&#039;&#039; statement is executed. This is useful when an exception is thrown and possibly caught and re-thrown again to find out the original cause and debug there. &lt;br /&gt;
&lt;br /&gt;
Exception breakpoints could be configured to trigger in two cases:&lt;br /&gt;
&lt;br /&gt;
* For &#039;&#039;caught exceptions&#039;&#039; - the breakpoint will hit (program will be suspended) if an exception is thrown and would be caught by some handler deeper in the execution stack. Note, that any &#039;&#039;&#039;finally&#039;&#039;&#039; or &#039;&#039;&#039;synchronized&#039;&#039;&#039; block creates&lt;br /&gt;
an implicit exception handler for type [http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html java.lang.Throwable].&lt;br /&gt;
&lt;br /&gt;
* For &#039;&#039;uncaught exception&#039;&#039; - the breakpoin will hit only if an exception is thrown but it is not handled by any handler, i.e., it is unhandled. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: The JVM cannot always reliably tell whether a given exception is actually caught or uncaught. For details, refer to [http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/com/sun/jdi/event/ExceptionEvent.html#catchLocation() JDI documentation]&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_JDebugger_002.png|right|thumb|JDebugger plugin: Java object inspector]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_JDebugger_002.png&amp;diff=4289</id>
		<title>Datei:Expecco JDebugger 002.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_JDebugger_002.png&amp;diff=4289"/>
		<updated>2014-10-08T15:04:03Z</updated>

		<summary type="html">&lt;p&gt;Jv: Java object inspector&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Java object inspector&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4288</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4288"/>
		<updated>2014-10-08T15:03:37Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
The plugin provides a way to place [[#Breakpoints|breakpoints]] into a Java or Groovy code. When breakpoint hits (particular location in the code is reached), the program is stopped and [[#Debugger|a visual debugger]] appear. The debugger then can be used to inspect the state of the execution and/or single-step through the code. &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger&#039;&#039; plugin supports two kinds of breakpoints:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Line Breakpoints&#039;&#039; - a traditional breakpoint set on particular line in particular method. &lt;br /&gt;
# &#039;&#039;Exception Breakpoints&#039;&#039; - a breakpoint that suspends execution when an exception of specified type is thrown. This is useful to find out where a particular exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_JDebugger_002.png|right|thumb|JDebugger plugin: Java object inspector]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4285</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4285"/>
		<updated>2014-10-08T14:51:33Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
The plugin provides a way to place [[#Breakpoints|breakpoints]] into a Java or Groovy code. When breakpoint hits (particular location in the code is reached), the program is stopped and [[#Debugger|a visual debugger]] appear. The debugger then can be used to inspect the state of the execution and/or single-step through the code. &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger&#039;&#039; plugin supports two kinds of breakpoints:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Line Breakpoints&#039;&#039; - a traditional breakpoint set on particular line in particular method. &lt;br /&gt;
# &#039;&#039;Exception Breakpoints&#039;&#039; - a breakpoint that suspends execution when an exception of specified type is thrown. This is useful to find out where a particular exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4284</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4284"/>
		<updated>2014-10-08T14:50:15Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
The plugin provides a way to place [[#Breakpoints|breakpoints]] into a Java or Groovy code. When breakpoint hits (particular location in the code is reached), the program is stopped and [[#Debugger|a visual debugger]] appear. The debugger then can be used to inspect the state of the execution and/or single-step through the code. &lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger&#039;&#039; plugin supports two kinds of breakpoints:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Line Breakpoints&#039;&#039; - a traditional breakpoint set on particular line in particular method. &lt;br /&gt;
# &#039;&#039;Exception Breakpoints&#039;&#039; - a breakpoint that suspends execution when an exception of specified type is thrown. This is useful to find out where a particular exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4283</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4283"/>
		<updated>2014-10-08T14:45:11Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Breakpoints */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger&#039;&#039; plugin supports two kinds of breakpoints:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Line Breakpoints&#039;&#039; - a traditional breakpoint set on particular line in particular method. &lt;br /&gt;
# &#039;&#039;Exception Breakpoints&#039;&#039; - a breakpoint that suspends execution when an exception of specified type is thrown. This is useful to find out where a particular exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Browser/en&amp;diff=4282</id>
		<title>Java Browser/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Browser/en&amp;diff=4282"/>
		<updated>2014-10-08T11:40:25Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Java Browser&#039;&#039;&#039; provides a simple interface to browse Java code. This is useful for test developers that write tests which uses [[ElementaryBlock_Element/en#Groovy_Blocks|Groovy blocks]] to connect to system under test. &lt;br /&gt;
&lt;br /&gt;
== Using Java Browser ==&lt;br /&gt;
&lt;br /&gt;
[[Datei:Select_Workspace_01.png|200px|thumb|right|Workspace selection dialog]]&lt;br /&gt;
[[Datei:JBrowser 01.png|200px|thumb|right|Java browser window]]&lt;br /&gt;
To open Java Browser select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; and then select a [[#Workspace|workspace]]. To create a new workspace, just enter a new, empty directory. &lt;br /&gt;
&lt;br /&gt;
After the workspace is chosen, a single Java Browser window appears. It shows Java packages, classes and methods as well &lt;br /&gt;
as source code if it&#039;s available. If the source code is not available then it still shows class structure without actual method&#039;s source code. &lt;br /&gt;
&lt;br /&gt;
== Workspace ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Java Browser&#039;&#039;&#039; stores all Java code and sources in a folder called a &#039;&#039;workspace&#039;&#039;. You can freely move workspaces around or store them on a shared network drive. &lt;br /&gt;
&lt;br /&gt;
To create a workspace, just select an empty directory. To add Java code to the workspace, open workspace settings (in Java Browser window, select &#039;&#039;Workspace&#039;&#039; ► &#039;&#039;Settings&#039;&#039;). In a settings dialog you may add .jar files or directories containing .class files and attach sources to then. Of course, you may use workspace settings dialog any time later add or remove .jar files or .class file directories.&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4281</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4281"/>
		<updated>2014-10-08T11:39:13Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Managing Sources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
== Breakpoints == &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Java Debugger plugin&#039;&#039; uses [[Java Browser/en]] fro accessing&lt;br /&gt;
source code. The source code for particular class / method is looked&lt;br /&gt;
up in Java Browser&#039;s &#039;&#039;default workspace&#039;&#039;. This means that if the default workspace does not contain a source code for the class, Java debugger will not show source code. However, it is still possible to &lt;br /&gt;
inspect parameters and other local variables and even single-step.&lt;br /&gt;
&lt;br /&gt;
If the sources does not match the sources which the Java code&lt;br /&gt;
has been compiled from, Java debugger may show invalid source code&lt;br /&gt;
or line numbers may not match. There is no way to validate the sources&lt;br /&gt;
matches the code loaded in remote JVM. &lt;br /&gt;
&lt;br /&gt;
For more information about default workspace and how to add classes and&lt;br /&gt;
sources to it, please refer [[Java Browser/en|Java Browser plugin documentation]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4280</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4280"/>
		<updated>2014-10-08T11:07:50Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Debugger */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
== Breakpoints == &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread.&lt;br /&gt;
&lt;br /&gt;
Following debugging operations are available: &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Continue&#039;&#039; - resumes execution until remote JVM terminates or another breakpoint is reached. &lt;br /&gt;
* &#039;&#039;Abort&#039;&#039; - aborts execution of currently executing expecco Groovy block. If the selected thread does not execute a Groovy block abortion&lt;br /&gt;
is not allowed. &lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-over&#039;&#039;. Single-step to next line in currently selected method. Does not enter into called methods.&lt;br /&gt;
* &#039;&#039;Next&#039;&#039; - aka &#039;&#039;Step-into&#039;&#039;. Single-step to next line in currently selected method or into a called method. &lt;br /&gt;
* &#039;&#039;Out&#039;&#039; - aka &#039;&#039;Step-out&#039;&#039;. Run until currently selected method returns and stop&#039;s at the method&#039;s caller.&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4279</id>
		<title>Java Debugger/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Java_Debugger/en&amp;diff=4279"/>
		<updated>2014-10-08T10:59:01Z</updated>

		<summary type="html">&lt;p&gt;Jv: Die Seite wurde neu angelegt: „The &amp;#039;&amp;#039;Java Debugger plugin&amp;#039;&amp;#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directl…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;Java Debugger plugin&#039;&#039; provides basic Java debugging facility. It allows for debugging of Groovy blocks and any other Java code run in remote JVM directly within expecco. &lt;br /&gt;
&lt;br /&gt;
== Breakpoints == &lt;br /&gt;
&lt;br /&gt;
== Debugger ==&lt;br /&gt;
[[Datei:expecco_JDebugger_001.png|right|thumb|JDebugger plugin: debugger window]]&lt;br /&gt;
&lt;br /&gt;
The overall layout of Java debugger window is similar to debuggers for Smalltalk and JavaScript blocks. It consists of 5 panes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; &#039;&#039;Execution Stack&#039;&#039; - organized top-to-bottom, i.e., the currently executing method is the first entry in the list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt; &#039;&#039;Source Code View&#039;&#039; - shows the source code of the currently selected method (in execution stack pane). Source for particular method may or may not be available. For details refer to section [[Managing Sources]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; &#039;&#039;this object inspector&#039;&#039; - an embedded inspector of &#039;&#039;&#039;this&#039;&#039;&#039; objects, i.e., on the receiver of the method. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt; &#039;&#039;Method parameters and locals inspector&#039;&#039; - an embedded inspector showing all method parameters and local variables which are visible at current scope. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red; padding: 3px; border: 2px solid red; border-radius:50%; background-color: #BBBBF6;&amp;quot;&amp;gt;5&amp;lt;/span&amp;gt; &#039;&#039;Thread List&#039;&#039; - list showing all threads in the remote JVM. The &#039;&#039;Execution Stack&#039;&#039; pane shows execution stack of selected thread. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Object Inspector ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Managing Sources ==&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_JDebugger_001.png&amp;diff=4278</id>
		<title>Datei:Expecco JDebugger 001.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_JDebugger_001.png&amp;diff=4278"/>
		<updated>2014-10-08T10:09:02Z</updated>

		<summary type="html">&lt;p&gt;Jv: JDebugger plugin - debugger window&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;JDebugger plugin - debugger window&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Themensammlung&amp;diff=4277</id>
		<title>Themensammlung</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Themensammlung&amp;diff=4277"/>
		<updated>2014-10-08T09:47:34Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Code Execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Expecco =&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
&lt;br /&gt;
* [[ expecco Overview | Overview]] -- Empty!&lt;br /&gt;
* [[ expecco Overview/en | Overview/en ]] -- empty!&lt;br /&gt;
* [[ Release Notes expecco]]&lt;br /&gt;
* [[ Release Notes expecco/en ]]&lt;br /&gt;
* [[ Installation ]] - initial installation, license files, patches&lt;br /&gt;
* [[ Installation/en ]] - initial installation, license files, patches&lt;br /&gt;
* [[ Configuration &amp;amp; Setup ]] - jre/jdk setup, pathes&lt;br /&gt;
* [[ Configuration &amp;amp; Setup/en ]] - jre/jdk setup, pathes&lt;br /&gt;
* [[ Personal Settings ]] - editor settings&lt;br /&gt;
* [[ Personal Settings/en ]] - editor settings&lt;br /&gt;
* [[ Report Generation ]]&lt;br /&gt;
* [[ Report Generation/en ]]&lt;br /&gt;
* [[ Concepts]] - concepts; testplan, testcase, activities, verdicts&lt;br /&gt;
* [[ Concepts/en]] - concepts; testplan, testcase, activities, verdicts&lt;br /&gt;
* [[ Command Line Options ]]&lt;br /&gt;
* [[ Command Line Options/en ]]&lt;br /&gt;
* [[ Glossary ]]&lt;br /&gt;
* [[ Glossary/en ]]&lt;br /&gt;
&lt;br /&gt;
== expecco UI ==&lt;br /&gt;
&lt;br /&gt;
* [[ Menu ]]&lt;br /&gt;
* [[ Menu/en ]]&lt;br /&gt;
* [[ Toolbar ]]&lt;br /&gt;
* [[ Toolbar/en ]]&lt;br /&gt;
* [[ Navigation Tree ]]&lt;br /&gt;
* [[ Navigation Tree/en ]]&lt;br /&gt;
* [[ Settings ]]&lt;br /&gt;
* [[ Settings/en ]]&lt;br /&gt;
* [[ Testsuite Browser ]]&lt;br /&gt;
* [[ Testsuite Browser/en ]]&lt;br /&gt;
&lt;br /&gt;
== Editors ==&lt;br /&gt;
&lt;br /&gt;
Achtung - Namen wurden in expecco geändert:&lt;br /&gt;
Alle Namen wie &#039;XXXDescriptionEditor&#039; und &#039;XXXEditor&#039; werden nun zu &#039;XXX_Editor&#039; (immer Unterstrich, niemals Description)&lt;br /&gt;
 &lt;br /&gt;
* [[ Scheme Editor ]] ab&lt;br /&gt;
* [[ Scheme Editor/en ]]&lt;br /&gt;
* [[ Documentation Editor ]] sv&lt;br /&gt;
* [[ Documentation Editor/en ]]&lt;br /&gt;
* [[ History Editor ]] sv&lt;br /&gt;
* [[ History Editor/en ]]&lt;br /&gt;
* [[ BlockFunctionalityTestEditor  ]] ca&lt;br /&gt;
* [[ BlockFunctionalityTestEditor/en ]]&lt;br /&gt;
* [[ BlockFunctionalityRunner ]] ca&lt;br /&gt;
* [[ BlockFunctionalityRunner/en ]]&lt;br /&gt;
* [[ BlockSkill Editor  ]] ab&lt;br /&gt;
* [[ BlockSkill Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ ElementaryBlock Editor-Code Editor ]] cg&lt;br /&gt;
* [[ ElementaryBlock Editor-Code Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ KeywordBlock Editor-KeywordActionList Editor ]] ab&lt;br /&gt;
* [[ KeywordBlock Editor-KeywordActionList Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ CompoundBlock Editor-CompoundWorksheet Editor ]] ab&lt;br /&gt;
* [[ CompoundBlock Editor-CompoundWorksheet Editor/en ]]&lt;br /&gt;
* [[ CompoundBlock Editor-Environment Editor  ]] ca&lt;br /&gt;
* [[ CompoundBlock Editor-Environment Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ TestDataGeneratorBlock Editor-TestData Editor ]] cg&lt;br /&gt;
* [[ TestDataGeneratorBlock Editor-TestData Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ TableDrivenBlock Editor-TableDrivenActionList Editor ]]&lt;br /&gt;
* [[ TableDrivenBlock Editor-TableDrivenActionList Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Testplan Editor-TestplanEnvironment Editor  ]] ca&lt;br /&gt;
* [[ Testplan Editor-TestplanEnvironment Editor/en ]]&lt;br /&gt;
* [[ Testplan Editor-TestplanListView Editor ]] ca&lt;br /&gt;
* [[ Testplan Editor-TestplanListView Editor/en ]]&lt;br /&gt;
* [[ Testplan Editor-ReportParameter Editor ]] ab&lt;br /&gt;
* [[ Testplan Editor-ReportParameter Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Testsuite Editor-Environment Editor ]] ca&lt;br /&gt;
* [[ Testsuite Editor-Environment Editor/en ]]&lt;br /&gt;
* [[ Testsuite Editor-ExecutionSettings Editor ]] sv&lt;br /&gt;
* [[ Testsuite Editor-ExecutionSettings Editor/en ]]&lt;br /&gt;
* [[ Testsuite Editor-ReportParameter Editor ]] sv&lt;br /&gt;
* [[ Testsuite Editor-ReportParameter Editor/en ]]&lt;br /&gt;
* [[ Testsuite Editor-Metadata Editor ]] sv&lt;br /&gt;
* [[ Testsuite Editor-Metadata Editor/en ]]&lt;br /&gt;
* [[ Testsuite Editor-StatisticData Editor ]] sv&lt;br /&gt;
* [[ Testsuite Editor-StatisticData Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ TestsuiteHistory Editor ]] sv&lt;br /&gt;
* [[ TestsuiteHistory Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Datatype Editor ]] cg&lt;br /&gt;
* [[ Datatype Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Inventory Editor ]] ab&lt;br /&gt;
* [[ Inventory Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ ReportParameter Editor]]&lt;br /&gt;
* [[ ReportParameter Editor/en]]&lt;br /&gt;
&lt;br /&gt;
* [[ Resource Editor ]] ab&lt;br /&gt;
* [[ Resource Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Skill Editor ]] ab -- Achtung: nur in Deutsch&lt;br /&gt;
* [[ Skill Editor/en ]] -- Attention:only in German&lt;br /&gt;
&lt;br /&gt;
* [[ CategoryContainer Editor ]] sv&lt;br /&gt;
* [[ CategoryContainer Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Documentation Editor ]] sv&lt;br /&gt;
* [[ Documentation Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ FileAttachment Editor ]] cg&lt;br /&gt;
* [[ FileAttachment Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ URLAttachment Editor ]] cg&lt;br /&gt;
* [[ URLAttachment Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ ReportTemplateAttachment Editor ]] ab&lt;br /&gt;
* [[ ReportTemplateAttachment Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ GUI Editor-GUICode Editor ]] cg&lt;br /&gt;
* [[ GUI Editor-GUICode Editor/en ]]&lt;br /&gt;
&lt;br /&gt;
==Tree-Elements==&lt;br /&gt;
&lt;br /&gt;
* [[ Tree Elements ]] ab&lt;br /&gt;
* [[ Tree Elements/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ Datatype Element ]] cg&lt;br /&gt;
* [[ Datatype Element/en ]]&lt;br /&gt;
* [[ Testplan Element ]] ca&lt;br /&gt;
* [[ Testplan Element/en ]]&lt;br /&gt;
* [[ ElementaryBlock Element ]] cg&lt;br /&gt;
* [[ ElementaryBlock Element/en ]]&lt;br /&gt;
* [[ CompoundBlock Element ]] ab&lt;br /&gt;
* [[ CompoundBlock Element/en ]]&lt;br /&gt;
* [[ Inventory Element ]] ab -- Achtung: nur in Deutsch&lt;br /&gt;
* [[ Inventory Element/en ]] -- Attention: only in German&lt;br /&gt;
* [[ Skill Element ]] ab -- Achtung: nur in Deutsch&lt;br /&gt;
* [[ Skill Element/en ]] -- Attention: only in German&lt;br /&gt;
* [[ Resource Element ]] ab -- Achtung: nur in Deutsch&lt;br /&gt;
* [[ Resource Element/en ]] -- Attention: only in German&lt;br /&gt;
* [[ Attachment Element ]] cg&lt;br /&gt;
* [[ Attachment Element/en ]]&lt;br /&gt;
* [[ ReportTemplate Element ]] ab&lt;br /&gt;
* [[ ReportTemplate Element/en ]]&lt;br /&gt;
* [[ KeywordBlock Element ]] ab&lt;br /&gt;
* [[ KeywordBlock Element/en ]]&lt;br /&gt;
* [[ TestDataGeneratorBlock Element ]] cg&lt;br /&gt;
* [[ TestDataGeneratorBlock Element/en ]]&lt;br /&gt;
* [[ VirtualBlock Element ]] sv&lt;br /&gt;
* [[ VirtualBlock Element/en ]]&lt;br /&gt;
* [[ UnimplementedBlock Element ]] sv&lt;br /&gt;
* [[ UnimplementedBlock Element/en ]]&lt;br /&gt;
* [[ GUIBlock Element ]] cg&lt;br /&gt;
* [[ GUIBlock Element/en ]]&lt;br /&gt;
* [[ Block Element ]] sv&lt;br /&gt;
* [[ Block Element/en ]]&lt;br /&gt;
* [[ Folder Element ]] sv&lt;br /&gt;
* [[ Folder Element/en ]]&lt;br /&gt;
&lt;br /&gt;
==Diagram-Elements==&lt;br /&gt;
&lt;br /&gt;
Achtung: DiagramElements-XXXPin gehen nun alle nach DiagramElements-Pin#typeofPin. Also z.B. DiagramElements-Pin#Enable_Output_pin.&lt;br /&gt;
entsprechende hash-tags müssen in DiagramElements-Pin erhalten bleiben.&lt;br /&gt;
&lt;br /&gt;
* [[ DiagramElements-Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin/en ]]&lt;br /&gt;
&lt;br /&gt;
* [[ DiagramElements-Pin#Enable Input Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Cancel Input Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Iterate Input Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Timelimit Input Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Performer Input Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Input Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Exception Output Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Enable Output Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#ExecutionTime Output Pin ]]&lt;br /&gt;
* [[ DiagramElements-Pin#Output Pin ]]&lt;br /&gt;
&lt;br /&gt;
* [[ DiagramElements-Step ]]&lt;br /&gt;
* [[ DiagramElements-Step/en ]]&lt;br /&gt;
* [[ DiagramElements-AttachmentStep ]]&lt;br /&gt;
* [[ DiagramElements-AttachmentStep/en ]]&lt;br /&gt;
* [[ DiagramElements-Connection ]]&lt;br /&gt;
* [[ DiagramElements-Connection/en ]]&lt;br /&gt;
* [[ DiagramElements-PinDescription ]]&lt;br /&gt;
* [[ DiagramElements-PinDescription/en ]]&lt;br /&gt;
* [[ DiagramElements-Annotation ]] -- Achtung: nur auf Deutsch&lt;br /&gt;
* [[ DiagramElements-Annotation/en ]] -- Attention: only in German&lt;br /&gt;
* [[ DiagramElements-Probe ]]&lt;br /&gt;
* [[ DiagramElements-Probe/en ]]&lt;br /&gt;
&lt;br /&gt;
== Plugins and Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
* [[ Selenium Web Test Plugin ]] -- Web Page Tests and Interaction&lt;br /&gt;
* [[ Selenium Web Test Plugin/en ]]&lt;br /&gt;
* [[ SeleniumLibrary Reference ]] -- Library reference&lt;br /&gt;
&lt;br /&gt;
* [[ AndroidLibrary Reference ]] -- Anroid UI Test and Interaction&lt;br /&gt;
&lt;br /&gt;
=== Code Execution ===&lt;br /&gt;
&lt;br /&gt;
* [[ Java Browser ]] -- allows for Java classes to be browsed in the SUT&lt;br /&gt;
* [[ Java Browser/en ]]&lt;br /&gt;
* [[ Java Debugger ]] -- allows to debug Groovy blocks and other code executed by Java Bridge in (remote) JVM&lt;br /&gt;
* [[ Java Debugger/en ]]&lt;br /&gt;
* [[ SmallSense ]] -- together with [[ Java Browser/en ]] provides basic completion support for Groovy code. &lt;br /&gt;
* [[ SmallSense/en ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[ Groovy Code Execution Plugin/en ]] -- allows for Groovy code to be executed on the SUT&lt;br /&gt;
* [[ VBScript | VisualBasic Script Plugin/en ]]&lt;br /&gt;
&lt;br /&gt;
=== Manual Test Support Plugins ===&lt;br /&gt;
&lt;br /&gt;
* [[ Manual Test Plugin ]] -- guides users through manual tests&lt;br /&gt;
* [[ Manual Test Import Plugin ]] -- imports test specifications written in Word or Excel&lt;br /&gt;
&lt;br /&gt;
=== Misc Plugins ===&lt;br /&gt;
&lt;br /&gt;
* [[ GembirdPowerControlPlugin Reference ]] -- control a power plug&lt;br /&gt;
&lt;br /&gt;
=== QM Interface Plugins ===&lt;br /&gt;
&lt;br /&gt;
* [[ PolarionPlugin Reference ]] - automate execution from &amp;amp; interact with Polarion&lt;br /&gt;
* [[ ExpeccoNET Plugin Reference ]] - automate execution from &amp;amp; interact with expeccoNET&lt;br /&gt;
* [[ HP Quality Center Plugin Reference ]] - automate execution from and interact with HP Quality Center&lt;br /&gt;
&lt;br /&gt;
* [[ WSDL Service Import Plugin ]] -- import service actions from a WSDL service description&lt;br /&gt;
&lt;br /&gt;
== Concepts, Hints, Tips and Tricks ==&lt;br /&gt;
&lt;br /&gt;
* [[ Expecco API ]]&lt;br /&gt;
* [[ Expecco API/en ]]&lt;br /&gt;
* [[ Executor]]&lt;br /&gt;
* [[ Executor#Activity]]&lt;br /&gt;
&lt;br /&gt;
* [[ Generating Test Data ]]&lt;br /&gt;
* [[ Parametrizing Tests ]]&lt;br /&gt;
* [[ Organizing Libraries ]]&lt;br /&gt;
* [[ Reimporting a Library]]&lt;br /&gt;
* [[ User Defined Menu Items ]]&lt;br /&gt;
* [[ Uses of Tags ]]&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* [[Testing Java Applications using Groovy blocks]]&lt;br /&gt;
* [[Testing Java Applications using Groovy blocks/en]]&lt;br /&gt;
= ExpeccoNet =&lt;br /&gt;
&lt;br /&gt;
== ExpeccoNET General ==&lt;br /&gt;
&lt;br /&gt;
* [[ expeccoNET Overview | Overview]]&lt;br /&gt;
* [[ expeccoNET Overview/en | Overview/en ]]&lt;br /&gt;
* [[ expeccoNET Release Notes | Release Notes]]&lt;br /&gt;
* [[ expeccoNET Release Notes/en | Release Notes/en ]]&lt;br /&gt;
* [[ expeccoNET Installation | Installation ]] - initial installation, license files, patches&lt;br /&gt;
* [[ expeccoNET Installation/en | Installation/en ]] - initial installation, license files, patches&lt;br /&gt;
* [[ expeccoNET Configuration &amp;amp; Setup | Configuration &amp;amp; Setup ]] - setting up users, roles and projects&lt;br /&gt;
* [[ expeccoNET Configuration &amp;amp; Setup/en | Configuration &amp;amp; Setup/en ]] - setting up users, roles and projects&lt;br /&gt;
* [[ expeccoNET Personal Settings | Personal Settings ]] - editor settings&lt;br /&gt;
* [[ expeccoNET Personal Settings/en | Personal Settings/en ]] - editor settings&lt;br /&gt;
* [[ expeccoNET Concepts |Concepts ]] - concepts; testsuite, testdefinition, testschedule, testrun, testequipment&lt;br /&gt;
* [[ expeccoNET Concepts/en | Concepts/en ]] - concepts; testsuite, testdefinition, testschedule, testrun, testequipment&lt;br /&gt;
* [[ expeccoNET Glossary | Glossary ]]&lt;br /&gt;
* [[ expeccoNET Glossary/en | Glossary/en ]]&lt;br /&gt;
&lt;br /&gt;
== expeccoNET UI ==&lt;br /&gt;
&lt;br /&gt;
* [[ expeccoNET Master Menu | Master Menu]]&lt;br /&gt;
* [[ expeccoNET Master Menu/en | Master Menu/en ]]&lt;br /&gt;
* [[ expeccoNET Requirements UI | Requirements UI ]]&lt;br /&gt;
* [[ expeccoNET Requirements UI/en | Requirements UI/en ]]&lt;br /&gt;
* [[ expeccoNET Defects UI | Defects UI]]&lt;br /&gt;
* [[ expeccoNET Defects UI/en | Defects UI/en ]]&lt;br /&gt;
* [[ expeccoNET Actions UI | Actions UI ]]&lt;br /&gt;
* [[ expeccoNET Actions UI/en |Actions UI/en ]]&lt;br /&gt;
* [[ expeccoNET Tests UI | Tests UI ]]&lt;br /&gt;
* [[ expeccoNET Tests UI/en | Tests UI/en ]]&lt;br /&gt;
* [[ expeccoNET Projects UI | Projects UI ]]&lt;br /&gt;
* [[ expeccoNET Projects UI/en | Projects UI/en ]]&lt;br /&gt;
* [[ expeccoNET Organization UI | Organization UI ]]&lt;br /&gt;
* [[ expeccoNET Organization UI/en | Organization UI/en ]]&lt;br /&gt;
* [[ expeccoNET Settings UI | Settings UI ]]&lt;br /&gt;
* [[ expeccoNET Settings UI/en | Settings UI/en ]]&lt;br /&gt;
&lt;br /&gt;
== expeccoNET Plugins and Extensions ==&lt;br /&gt;
&lt;br /&gt;
* [[ expeccoNET HP Quality Center Synchronization Plugin | HP Quality Center Synchronization Plugin]]&lt;br /&gt;
* [[ expeccoNET HP Quality Center Synchronization Plugin/en | HP Quality Center Synchronization Plugin/en ]]&lt;br /&gt;
&lt;br /&gt;
= License Server =&lt;br /&gt;
&lt;br /&gt;
== License Server General ==&lt;br /&gt;
&lt;br /&gt;
* [[ License Server Overview | Overview]] -- Achtung: nur in Deutsch &lt;br /&gt;
* [[ License Server Overview/en | Overview/en ]] -- Attention: only in German&lt;br /&gt;
* [[ License Server Release Notes | Release Notes]]&lt;br /&gt;
* [[ License Server Release Notes/en | Release Notes/en ]] -- Attention: only in German&lt;br /&gt;
* [[ License Server Installation | Installation]] - initial installation, license files, updates -- Achtung: nur in Deutsch&lt;br /&gt;
* [[ License Server Installation/en | Installation/en ]] - initial installation, license files, updates -- Attention: only in German&lt;br /&gt;
* [[ License Server Configuration &amp;amp; Setup | Configuration &amp;amp; Setup ]] - setting up ports and users -- Achtung: nur in Deutsch&lt;br /&gt;
* [[ License Server Configuration &amp;amp; Setup/en | Configuration &amp;amp; Setup/en ]] - setting up ports and users -- Attention: only in German&lt;br /&gt;
* [[ License Server Glossary | Glossary]] -- Achtung: nur in Englisch&lt;br /&gt;
* [[ License Server Glossary/en | Glossary/en]] -- Achtung: nur in English&lt;br /&gt;
&lt;br /&gt;
== License Server UI ==&lt;br /&gt;
&lt;br /&gt;
* [[ License Server License Menu | License Menu ]]&lt;br /&gt;
* [[ License Server License Menu/en | License Menu/en]]&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4276</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4276"/>
		<updated>2014-10-03T11:53:29Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* TODO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java browser plugin&#039;&#039;, &#039;&#039;Java Debugger plugin&#039;&#039; and &#039;&#039;SmallSense plugin&#039;&#039; can make test development using Groovy block easier:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Java browser plugin&#039;&#039; provides a way to browse Java code right from the expecco environment, without need of external, third-party IDE. &lt;br /&gt;
* &#039;&#039;SmallSense plugin&#039;&#039; provides a simple completion support to Groovy block editor, making editing easier. &lt;br /&gt;
* &#039;&#039;Java Debugger plugin&#039;&#039; provides in-expecco debugging facilities to debug Java code running system under test, making test debugging easier. &lt;br /&gt;
&lt;br /&gt;
These plugins are not necessary to use Groovy blocks, however, working with&lt;br /&gt;
complex Java code might tricky when it comes to test debugging. While it is possible to use third-party Java IDEs and debuggers, the added value of these&lt;br /&gt;
plugins is tight integration with expecco.&lt;br /&gt;
&lt;br /&gt;
For more information, refer to:&lt;br /&gt;
&lt;br /&gt;
* [[Java Browser/en]]&lt;br /&gt;
* [[Java Debugger/en]]&lt;br /&gt;
* [[SmallSense/en]]&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
* Eclipse Project with &amp;quot;BankAccount&amp;quot; code - [[Medium:bankaccount-eclipse.zip|bankaccount-eclipse.zip]] &lt;br /&gt;
* Expecco test suite with tests from this tutorial - [[Medium:bankaccount.ets|bankaccount.ets]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* cleanup &#039;&#039;You&#039;&#039; / &#039;&#039;we&#039;&#039;&lt;br /&gt;
* Upload standalone .ets and .zip with Eclipse project Java doc somewhere&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents), once above get sorted.&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4275</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4275"/>
		<updated>2014-10-03T11:52:26Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Rubbish to remove */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java browser plugin&#039;&#039;, &#039;&#039;Java Debugger plugin&#039;&#039; and &#039;&#039;SmallSense plugin&#039;&#039; can make test development using Groovy block easier:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Java browser plugin&#039;&#039; provides a way to browse Java code right from the expecco environment, without need of external, third-party IDE. &lt;br /&gt;
* &#039;&#039;SmallSense plugin&#039;&#039; provides a simple completion support to Groovy block editor, making editing easier. &lt;br /&gt;
* &#039;&#039;Java Debugger plugin&#039;&#039; provides in-expecco debugging facilities to debug Java code running system under test, making test debugging easier. &lt;br /&gt;
&lt;br /&gt;
These plugins are not necessary to use Groovy blocks, however, working with&lt;br /&gt;
complex Java code might tricky when it comes to test debugging. While it is possible to use third-party Java IDEs and debuggers, the added value of these&lt;br /&gt;
plugins is tight integration with expecco.&lt;br /&gt;
&lt;br /&gt;
For more information, refer to:&lt;br /&gt;
&lt;br /&gt;
* [[Java Browser/en]]&lt;br /&gt;
* [[Java Debugger/en]]&lt;br /&gt;
* [[SmallSense/en]]&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
* Eclipse Project with &amp;quot;BankAccount&amp;quot; code - [[Medium:bankaccount-eclipse.zip|bankaccount-eclipse.zip]] &lt;br /&gt;
* Expecco test suite with tests from this tutorial - [[Medium:bankaccount.ets|bankaccount.ets]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* cleanup &#039;&#039;You&#039;&#039; / &#039;&#039;we&#039;&#039;&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Upload standalone .ets and .zip with Eclipse project Java doc somewhere&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents), once above get sorted.&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4274</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4274"/>
		<updated>2014-10-03T11:47:32Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Wrap-up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Java browser plugin&#039;&#039;, &#039;&#039;Java Debugger plugin&#039;&#039; and &#039;&#039;SmallSense plugin&#039;&#039; can make test development using Groovy block easier:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Java browser plugin&#039;&#039; provides a way to browse Java code right from the expecco environment, without need of external, third-party IDE. &lt;br /&gt;
* &#039;&#039;SmallSense plugin&#039;&#039; provides a simple completion support to Groovy block editor, making editing easier. &lt;br /&gt;
* &#039;&#039;Java Debugger plugin&#039;&#039; provides in-expecco debugging facilities to debug Java code running system under test, making test debugging easier. &lt;br /&gt;
&lt;br /&gt;
These plugins are not necessary to use Groovy blocks, however, working with&lt;br /&gt;
complex Java code might tricky when it comes to test debugging. While it is possible to use third-party Java IDEs and debuggers, the added value of these&lt;br /&gt;
plugins is tight integration with expecco.&lt;br /&gt;
&lt;br /&gt;
For more information, refer to:&lt;br /&gt;
&lt;br /&gt;
* [[Java Browser/en]]&lt;br /&gt;
* [[Java Debugger/en]]&lt;br /&gt;
* [[SmallSense/en]]&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
* Eclipse Project with &amp;quot;BankAccount&amp;quot; code - [[Medium:bankaccount-eclipse.zip|bankaccount-eclipse.zip]] &lt;br /&gt;
* Expecco test suite with tests from this tutorial - [[Medium:bankaccount.ets|bankaccount.ets]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* cleanup &#039;&#039;You&#039;&#039; / &#039;&#039;we&#039;&#039;&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Upload standalone .ets and .zip with Eclipse project Java doc somewhere&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents), once above get sorted.&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4273</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4273"/>
		<updated>2014-10-03T11:24:49Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* TODO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
* Eclipse Project with &amp;quot;BankAccount&amp;quot; code - [[Medium:bankaccount-eclipse.zip|bankaccount-eclipse.zip]] &lt;br /&gt;
* Expecco test suite with tests from this tutorial - [[Medium:bankaccount.ets|bankaccount.ets]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* cleanup &#039;&#039;You&#039;&#039; / &#039;&#039;we&#039;&#039;&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Upload standalone .ets and .zip with Eclipse project Java doc somewhere&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents), once above get sorted.&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4272</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4272"/>
		<updated>2014-10-03T11:20:20Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Wrap-up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
* Eclipse Project with &amp;quot;BankAccount&amp;quot; code - [[Medium:bankaccount-eclipse.zip|bankaccount-eclipse.zip]] &lt;br /&gt;
* Expecco test suite with tests from this tutorial - [[Medium:bankaccount.ets|bankaccount.ets]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* cleanup &#039;&#039;You&#039;&#039; / &#039;&#039;we&#039;&#039;&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Make standalone .ets and .zip with Eclipse project, commit it and make it ready for download.&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents)&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4271</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4271"/>
		<updated>2014-10-02T15:23:56Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* TODO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* cleanup &#039;&#039;You&#039;&#039; / &#039;&#039;we&#039;&#039;&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Make standalone .ets and .zip with Eclipse project, commit it and make it ready for download.&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents)&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4270</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4270"/>
		<updated>2014-10-02T15:23:14Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Debugging tests II */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s write yet another test that tries to transfer a negative amount. The API documentation does not specify the behaviour in this case explicitly. &lt;br /&gt;
The would look like the very first test except the amount would be -500 rather than 500 and the final balances would be the other way around. &lt;br /&gt;
&lt;br /&gt;
Actually such a test would fail. As you may see, the code throws a ```TransactionException``` with rather unspecific message &#039;&#039;Internal error occired during transaction&#039;&#039;. The message is bit worrying as, if negative value is now allowed, the error message should say so. It could be that something else went wrong. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_017.png]]&lt;br /&gt;
&lt;br /&gt;
To find out, we may again use Java debugger plugin and place an &#039;&#039;exception breakpoint&#039;&#039;, a special kind of breakpoint that stops program execution &lt;br /&gt;
when an exception of specific type is thrown. To do so, go to &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Debugger&#039;&#039; ► &#039;&#039;Breakpoint List&#039;&#039;. This opens a little window displaying &lt;br /&gt;
all Java breakpoints, including &#039;&#039;line breakpoints&#039;&#039; we have used earlier.&lt;br /&gt;
Use context menu (right-click in the list) to add an exception breakpoint: &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_018.png]]&lt;br /&gt;
&lt;br /&gt;
A dialog will appear where you can specify exception class name - &#039;&#039;&#039;exept.expecco.projects.examples.bankaccount.TransactionException&#039;&#039;&#039; in this case. Be aware, it &#039;&#039;&#039;has&#039;&#039;&#039; to be a fully qualified Java class name. &lt;br /&gt;
Also, you have to tick both &#039;&#039;Caught&#039;&#039; and &#039;&#039;Uncaught&#039;&#039; checkboxes, as the Java bridge code catches all exceptions.&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_020.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A debugger should appear, stopping at line 65 in &lt;br /&gt;
&#039;&#039;&#039;Transaction.java&#039;&#039;&#039;. The code here simply catches all exceptions and re-throw a &#039;&#039;&#039;TransactionException&#039;&#039;&#039;. So still it&#039;s not clear what is the real cause. To find out, let&#039;s check what is the value of the original exception, stored in variable &#039;&#039;&#039;e&#039;&#039;&#039; (just click or double-click to &#039;&#039;e&#039;&#039; in bottom left part of the debugger window which shows local variables). &lt;br /&gt;
&lt;br /&gt;
It&#039;s a &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039;. Let&#039;s just put another exception breakpoint, now for &#039;&#039;&#039;java.security.InvalidParameterException&#039;&#039;&#039; and run the test again. This should reveal the origin of the problem. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_021.png]]&lt;br /&gt;
&lt;br /&gt;
If you run it again, you may see that the exception is thrown in &#039;&#039;&#039;Transaction#check()&#039;&#039;&#039; if the amount specified is less than zero.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* write a section on exceptions&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Make standalone .ets and .zip with Eclipse project, commit it and make it ready for download.&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents)&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_021.png&amp;diff=4269</id>
		<title>Datei:Expecco BankAccounts 021.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_021.png&amp;diff=4269"/>
		<updated>2014-10-02T15:20:35Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_020.png&amp;diff=4268</id>
		<title>Datei:Expecco BankAccounts 020.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_020.png&amp;diff=4268"/>
		<updated>2014-10-02T15:11:15Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_018.png&amp;diff=4267</id>
		<title>Datei:Expecco BankAccounts 018.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_018.png&amp;diff=4267"/>
		<updated>2014-10-02T15:05:24Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_017.png&amp;diff=4266</id>
		<title>Datei:Expecco BankAccounts 017.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_017.png&amp;diff=4266"/>
		<updated>2014-10-02T15:02:17Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4265</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4265"/>
		<updated>2014-10-02T14:41:00Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Implementing the first test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* write a section on exceptions&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Make standalone .ets and .zip with Eclipse project, commit it and make it ready for download.&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents)&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4264</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4264"/>
		<updated>2014-10-02T14:23:54Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Debugging tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests I ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Debugging tests II ==&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* write a section on exceptions&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Make standalone .ets and .zip with Eclipse project, commit it and make it ready for download.&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents)&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4261</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4261"/>
		<updated>2014-10-01T12:14:15Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* To remove */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== Wrap-up ==&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* write a section on exceptions&lt;br /&gt;
* write wrap-up section&lt;br /&gt;
* Make standalone .ets and .zip with Eclipse project, commit it and make it ready for download.&lt;br /&gt;
* Upload Java doc somewhere&lt;br /&gt;
* Fix crossrefs (to javadoc and other documents)&lt;br /&gt;
&lt;br /&gt;
== Rubbish to remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4260</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4260"/>
		<updated>2014-10-01T12:11:23Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Debugging tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It checks if the new balance on destination account would exceed the maximum and of so, just throw an exception as documented.&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4259</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4259"/>
		<updated>2014-10-01T12:09:21Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Debugging tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests ==&lt;br /&gt;
&lt;br /&gt;
One test passed. but let&#039;s create another one. Similar, but with different,&lt;br /&gt;
extrem values. Let&#039;s try to transfer an awful lot of money so the balance of&lt;br /&gt;
credited account would exceed the maximum allowed balance. According to a specification [!ref!] the transation should not proceed and an &#039;&#039;&#039;TransactionException&#039;&#039;&#039; should be thrown. The test may look as following: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_011.png]]&lt;br /&gt;
&lt;br /&gt;
If you try to run it you will see it fails. Now it&#039;s time to figure out why and this is the point where [[Java Debugger/en]] plugin is useful. Basically,&lt;br /&gt;
Java Debugger plugin allows you to debug code running in remote JVM - placing&lt;br /&gt;
breakpoints, single-stepping through the code, inspecting values of variables&lt;br /&gt;
and objects. &lt;br /&gt;
&lt;br /&gt;
Back to our failing test. The code of a Groovy block likely correct. The actual transfer is done in method &#039;&#039;&#039;BankAccount#credit()&#039;&#039;&#039; [!ref!]. Let&#039;s&lt;br /&gt;
put a breakpoint here and then single-step through the code until we reach the point where the actual computation is done. &lt;br /&gt;
&lt;br /&gt;
To place a breakpoint, simply open a Java Browser, select class &#039;&#039;&#039;Account&#039;&#039;&#039; and method &#039;&#039;&#039;credit()&#039;&#039;&#039; and then put a breakpoint at the beginning of the method (by clicking in the editor, left to the line number):&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_012.png]]&lt;br /&gt;
&lt;br /&gt;
Now run the test again. A Java Debugger window should appear:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_014.png]]&lt;br /&gt;
&lt;br /&gt;
The debugger shows a Java execution stack on the top, source code of the&lt;br /&gt;
selected method in the middle and an inspector for &#039;&#039;&#039;this&#039;&#039;&#039; and for local variables in the bottom part. &lt;br /&gt;
Let&#039;s single step a little bit further, into method &#039;&#039;&#039;Transaction#perform()&#039;&#039;&#039; to line 55. Use button &#039;&#039;Next&#039;&#039; to step-over to next line and  &#039;&#039;Send&#039;&#039; to step-into called methods. &lt;br /&gt;
&lt;br /&gt;
You may use the bottom inspector to inspect the value of &#039;&#039;&#039;amount&#039;&#039;&#039; or local variables. If you double-click to an object value as, say, &#039;&#039;&#039;source&#039;&#039;&#039; field of the transation object, a new inspector on that object is opened:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_015.png]]&lt;br /&gt;
&lt;br /&gt;
The code around line 55 in &#039;&#039;&#039;Transaction.java&#039;&#039;&#039; reads as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
54    // Check if destination account would exeeded MAX_BALANCE after crediting.&lt;br /&gt;
55    if ((oldDestinationBalance + amount) &amp;gt; Account.MAX_BALANCE) {&lt;br /&gt;
56            throw new TransactionException(&amp;quot;Maximuma ccount balance exceeded +&amp;quot; + source.getId());&lt;br /&gt;
57    }&lt;br /&gt;
58&lt;br /&gt;
59    long newSourceBalance = oldSourceBalance - amount;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By inspecting values of &#039;&#039;&#039;amount&#039;&#039;&#039; and &#039;&#039;&#039;oldDestinationBalance&#039;&#039;&#039; you may see&lt;br /&gt;
that the values are what one would expect, so if you press &#039;&#039;&#039;Next&#039;&#039;&#039; button,&lt;br /&gt;
the execution should enter the if body and throw an exception. If you actually do it, you&#039;ll see that the condition is satisfied and the execution proceeds to line 59.&lt;br /&gt;
&lt;br /&gt;
This is clearly a bug in the application code ([http://www.around.com/ariane.html classical integer overflow] in this case). So the test developer may just submit a bug to development team a be done with it.&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_015.png&amp;diff=4258</id>
		<title>Datei:Expecco BankAccounts 015.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_015.png&amp;diff=4258"/>
		<updated>2014-10-01T11:54:46Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_014.png&amp;diff=4257</id>
		<title>Datei:Expecco BankAccounts 014.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_014.png&amp;diff=4257"/>
		<updated>2014-10-01T11:34:00Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_012.png&amp;diff=4256</id>
		<title>Datei:Expecco BankAccounts 012.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_012.png&amp;diff=4256"/>
		<updated>2014-10-01T11:28:38Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_011.png&amp;diff=4255</id>
		<title>Datei:Expecco BankAccounts 011.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_011.png&amp;diff=4255"/>
		<updated>2014-10-01T10:39:33Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4254</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4254"/>
		<updated>2014-10-01T10:21:30Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== Debugging tests ==&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4253</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4253"/>
		<updated>2014-10-01T10:20:44Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Implementing the first test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_010.png&amp;diff=4252</id>
		<title>Datei:Expecco BankAccounts 010.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_010.png&amp;diff=4252"/>
		<updated>2014-10-01T10:20:27Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4251</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4251"/>
		<updated>2014-10-01T10:19:48Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Calling the Java API */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Implementing the first test ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and write a little code that calls &amp;quot;Bank Account&amp;quot; Java API. &lt;br /&gt;
&lt;br /&gt;
To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Now we have all bits together to implement and run the simple test. It passes. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_010.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4250</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4250"/>
		<updated>2014-10-01T10:03:21Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Calling the Java API */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Calling the Java API ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and &lt;br /&gt;
write the code. To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
// end of definitions -- do not remove this line unless imports above is &lt;br /&gt;
empty&lt;br /&gt;
&lt;br /&gt;
def execute() {&lt;br /&gt;
    Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
    b.addAccount( account1 );&lt;br /&gt;
    account1.setBalance( initialBalance1.value() );&lt;br /&gt;
&lt;br /&gt;
    Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
    b.addAccount( account2 );&lt;br /&gt;
    account2.setBalance( initialBalance2.value() );&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
        account1.credit(account2, amount.value() );&lt;br /&gt;
        exception.value( null );&lt;br /&gt;
    } catch ( TransactionException e ) {&lt;br /&gt;
        exception.value( e );&lt;br /&gt;
    }     &lt;br /&gt;
&lt;br /&gt;
    balance1.value( account1.getBalance() );&lt;br /&gt;
    balance2.value( account2.getBalance() );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4249</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4249"/>
		<updated>2014-10-01T09:41:53Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Designing a test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
* check that no exception was thrown. &lt;br /&gt;
&lt;br /&gt;
We will encapsulate first three steps in to a special block, let&#039;s call it&lt;br /&gt;
&#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039;, which will take initial balances &lt;br /&gt;
and amount to transfer from input pins and report final balances to output pins. In addition, it will report an eventual exception via exception output&lt;br /&gt;
pin. &lt;br /&gt;
&lt;br /&gt;
By separating this logic to a separate block we can easily create more&lt;br /&gt;
tests with different value to test different scenarios like: to check that an exception is raised when there are not enough funds on a charged account. &lt;br /&gt;
&lt;br /&gt;
So, in expecco, the very simple testcase outlined above would look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
== Calling the Java API ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and &lt;br /&gt;
write the code. To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
    import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
    // end of definitions -- do not remove this line unless imports above is empty&lt;br /&gt;
    def execute() {&lt;br /&gt;
        Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
        Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
        b.addAccount( account1 );&lt;br /&gt;
        account1.setBalance( initialBalance1.value() );&lt;br /&gt;
        Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
        b.addAccount( account2 );&lt;br /&gt;
        account2.setBalance( initialBalance2.value() );&lt;br /&gt;
        account1.credit(account2, amount.value() ); &lt;br /&gt;
        balance1.value( account1.getBalance() );&lt;br /&gt;
        balance2.value( account2.getBalance() );&lt;br /&gt;
   }               &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4248</id>
		<title>Datei:Expecco BankAccounts 002.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4248"/>
		<updated>2014-10-01T09:32:33Z</updated>

		<summary type="html">&lt;p&gt;Jv: Jv lud eine neue Version von „Datei:Expecco BankAccounts 002.png“ hoch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4247</id>
		<title>Datei:Expecco BankAccounts 002.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4247"/>
		<updated>2014-10-01T09:32:07Z</updated>

		<summary type="html">&lt;p&gt;Jv: Jv lud eine neue Version von „Datei:Expecco BankAccounts 002.png“ hoch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4246</id>
		<title>Datei:Expecco BankAccounts 002.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4246"/>
		<updated>2014-10-01T09:31:54Z</updated>

		<summary type="html">&lt;p&gt;Jv: Jv lud eine neue Version von „Datei:Expecco BankAccounts 002.png“ hoch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4245</id>
		<title>Datei:Expecco BankAccounts 002.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4245"/>
		<updated>2014-10-01T09:31:30Z</updated>

		<summary type="html">&lt;p&gt;Jv: Jv lud eine neue Version von „Datei:Expecco BankAccounts 002.png“ hoch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4244</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4244"/>
		<updated>2014-10-01T09:31:00Z</updated>

		<summary type="html">&lt;p&gt;Jv: /* Designing a test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer from one account to the other. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
&lt;br /&gt;
In expecco, the testcase may look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
The block &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; would actually call the Java API of a &amp;quot;Bank Account&amp;quot; application. By separating the actual action code&lt;br /&gt;
from assertions (check) we can easily create more tests just with different values. This will become handy later.&lt;br /&gt;
&lt;br /&gt;
== Calling the Java API ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and &lt;br /&gt;
write the code. To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
    import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
    // end of definitions -- do not remove this line unless imports above is empty&lt;br /&gt;
    def execute() {&lt;br /&gt;
        Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
        Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
        b.addAccount( account1 );&lt;br /&gt;
        account1.setBalance( initialBalance1.value() );&lt;br /&gt;
        Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
        b.addAccount( account2 );&lt;br /&gt;
        account2.setBalance( initialBalance2.value() );&lt;br /&gt;
        account1.credit(account2, amount.value() ); &lt;br /&gt;
        balance1.value( account1.getBalance() );&lt;br /&gt;
        balance2.value( account2.getBalance() );&lt;br /&gt;
   }               &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_006.png&amp;diff=4243</id>
		<title>Datei:Expecco BankAccounts 006.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_006.png&amp;diff=4243"/>
		<updated>2014-09-30T15:46:17Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4242</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4242"/>
		<updated>2014-09-30T15:46:01Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer &lt;br /&gt;
from one account to another. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
&lt;br /&gt;
In expecco, the testcase may look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
The block &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; would actually call the Java API of a &amp;quot;Bank Account&amp;quot; application. By separating the actual action code&lt;br /&gt;
from assertions (check) we can easily create more tests just with different values. This will become handy later. &lt;br /&gt;
&lt;br /&gt;
== Calling the Java API ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu and define a new Java browser workspace. A Java browser workspace is a folder where Java Browser stores all the Java code &lt;br /&gt;
and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
Let&#039;s implement the &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; block now. Just create a new Groovy block and &lt;br /&gt;
write the code. To make writing code a little bit easier, [[SmallSense/en]] plugin together with [[Java Browser/en]]&lt;br /&gt;
plugin provides a simple completion support for Groovy. The completion engine takes information about available classes&lt;br /&gt;
and methods from the Java workspace. In other words, if you have no Java browser workspace opened, the completion won&#039;t&lt;br /&gt;
suggest any classes nor methods.&lt;br /&gt;
&lt;br /&gt;
To trigger the completion, just press &#039;&#039;Ctrl-Space&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_006.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code of the block may be the following: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    import exept.expecco.projects.examples.bankaccount.Bank;&lt;br /&gt;
    import exept.expecco.projects.examples.bankaccount.Account;&lt;br /&gt;
    // end of definitions -- do not remove this line unless imports above is empty&lt;br /&gt;
    def execute() {&lt;br /&gt;
        Bank b = new Bank( &amp;quot;Some bank&amp;quot; );&lt;br /&gt;
        Account account1 = new Account( &amp;quot;Owner 1&amp;quot; );&lt;br /&gt;
        b.addAccount( account1 );&lt;br /&gt;
        account1.setBalance( initialBalance1.value() );&lt;br /&gt;
        Account account2 = new Account( &amp;quot;Owner 2&amp;quot; );&lt;br /&gt;
        b.addAccount( account2 );&lt;br /&gt;
        account2.setBalance( initialBalance2.value() );&lt;br /&gt;
        account1.credit(account2, amount.value() ); &lt;br /&gt;
        balance1.value( account1.getBalance() );&lt;br /&gt;
        balance2.value( account2.getBalance() );&lt;br /&gt;
   }               &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_005.png&amp;diff=4241</id>
		<title>Datei:Expecco BankAccounts 005.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_005.png&amp;diff=4241"/>
		<updated>2014-09-30T15:18:53Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4240</id>
		<title>Datei:Expecco BankAccounts 002.png</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Datei:Expecco_BankAccounts_002.png&amp;diff=4240"/>
		<updated>2014-09-30T15:18:32Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
	<entry>
		<id>https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4239</id>
		<title>Testing Java Applications using Groovy blocks/en</title>
		<link rel="alternate" type="text/html" href="https://doc.expecco.de/index.php?title=Testing_Java_Applications_using_Groovy_blocks/en&amp;diff=4239"/>
		<updated>2014-09-30T15:18:08Z</updated>

		<summary type="html">&lt;p&gt;Jv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This example demonstrates how to use [[Java Browser/en]], [[Java Debugger/en]] and [[SmallSense/en]] plugins for Java application test development. It shows&lt;br /&gt;
how to use Groovy blocks to &lt;br /&gt;
&lt;br /&gt;
== The Bank Account Example == &lt;br /&gt;
&lt;br /&gt;
Through this tutorial, we&#039;ll use a simple &amp;quot;Bank Account&amp;quot; as system under test.&lt;br /&gt;
&amp;quot;Bank Account&amp;quot; is a very simple Java library that models banks and accounts&lt;br /&gt;
and allow transation among accounts. &lt;br /&gt;
&lt;br /&gt;
The code of the &amp;quot;Bank Account&amp;quot; application is not correct at place bu purpose. &lt;br /&gt;
You may download a full Eclipse project containing the example code at&lt;br /&gt;
[http://www.example.com somewhere].&lt;br /&gt;
&lt;br /&gt;
== Setting up expecco ==&lt;br /&gt;
&lt;br /&gt;
For the sake of brevity, in this tutorial we&#039;ll use simple local JVM managed by&lt;br /&gt;
expecco to run &amp;quot;Bank Account&amp;quot;s code. &lt;br /&gt;
As for any Java application, we have to set up a classpath properly so the JVM&lt;br /&gt;
can find application code.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s define an expecco environment variable named &#039;&#039;&#039;CLASSPATH_BANKACCOUNT&#039;&#039;&#039; defining where the &amp;quot;Bank Account&amp;quot; code is actually located:&lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_001.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then let&#039;s define a &amp;quot;SetUp&amp;quot; block that actually adds the directory to JVM class path. A simple JavaScript block would do it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
execute&lt;br /&gt;
    JAVA::Java singletonInstance&lt;br /&gt;
        addToClassPath: (self environmentAt: &#039;CLASSPATH_BANKACCOUNT&#039;)    &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This block has to be run before any other Java code using &amp;quot;Bank Account&amp;quot; classes is run. Putting  it as test plan&#039;s pre-execution block [[!ref!]] might be&lt;br /&gt;
a good way to ensure it. &lt;br /&gt;
&lt;br /&gt;
== Designing a test ==&lt;br /&gt;
&lt;br /&gt;
Once the class path is set up, we start designing an implementing tests. Let&#039;s start with a simple tests that create a two bank accounts and then make transfer &lt;br /&gt;
from one account to another. Then tests would check if the final balance on accounts is what one would expect. &lt;br /&gt;
&lt;br /&gt;
The very simple test would be then:&lt;br /&gt;
&lt;br /&gt;
* create account &#039;&#039;A1&#039;&#039; with initial balance 1000.&lt;br /&gt;
* create account &#039;&#039;A2&#039;&#039; with initial balance 1000.&lt;br /&gt;
* transfer 500 from account &#039;&#039;A2&#039;&#039; to account &#039;&#039;A1&#039;&#039;.&lt;br /&gt;
* check that final balance of &#039;&#039;A1&#039;&#039; is 1500 &lt;br /&gt;
* check that final balance of &#039;&#039;A2&#039;&#039; is  500.&lt;br /&gt;
&lt;br /&gt;
In expecco, the testcase may look like: &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_002.png]]&lt;br /&gt;
&lt;br /&gt;
The block &#039;&#039;Create 2 accounts &amp;amp; make a transaction&#039;&#039; would actually call the Java API of a &amp;quot;Bank Account&amp;quot; application. By separating the actual action code&lt;br /&gt;
from assertions (check) we can easily create more tests just with different values. This will become handy later. &lt;br /&gt;
&lt;br /&gt;
== Calling the Java API ==&lt;br /&gt;
&lt;br /&gt;
In order to implement the test as outlined above, we have to implement a block that actually call the Java API. &lt;br /&gt;
&lt;br /&gt;
[[Java Browser/en]] plugin for expecco provides a simple browser to load and browse Java code directly from expecco environment. &lt;br /&gt;
To open a Java Browser on &amp;quot;Bank Account&amp;quot; code, select &#039;&#039;Extras&#039;&#039; ► &#039;&#039;Plugins&#039;&#039; ► &#039;&#039;Java Browser&#039;&#039; ► &#039;&#039;Open...&#039;&#039; from expecco menu&lt;br /&gt;
and define a new Java browser workspace. &lt;br /&gt;
&lt;br /&gt;
A Java browser workspace is a folder where Java Browser stores all the Java code and sources. You can define as many workspaces as you like and&lt;br /&gt;
switch between them. If you don&#039;t have a workspace for &amp;quot;Bank Account&amp;quot; yet, just enter an empty directory and new workspace will be created. &lt;br /&gt;
Initially the workspace is empty, so to actually see the code of &amp;quot;Bank Account&amp;quot;, we have add it&#039;s code and sources to the workspace. To do so,&lt;br /&gt;
just click to &#039;&#039;Open Settings&#039;&#039; button in Java Browser window or select &#039;&#039;Workspace&#039;&#039;  ► &#039;&#039;Settings&#039;&#039; from window menu. In Settings dialog, &lt;br /&gt;
click to &#039;&#039;Add Library&#039;&#039; button and add &#039;&#039;Bank Account&#039;&#039; code. One added and confirmed (by pressing &#039;&#039;OK&#039;&#039; button), you may browse through the&lt;br /&gt;
code, check what classes and methods are available and so on. &lt;br /&gt;
&lt;br /&gt;
[[Datei:expecco_BankAccounts_005.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To remove ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
java -agentlib:jdwp=transportt_socket,server=y,suspend=n,address=3003 \&lt;br /&gt;
     -cp bin \&lt;br /&gt;
     -jar &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/agents/JavaBridge.jar&amp;quot;\&lt;br /&gt;
     -port 5005 -asServer -localOnly \&lt;br /&gt;
     -extDir &amp;quot;/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/exept/technologyBridge/javaBridge/javaBridge_Server_Client/ext&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jv</name></author>
	</entry>
</feed>