<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Software Libero e non solo</title>
	<atom:link href="http://kaosktrl.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kaosktrl.wordpress.com</link>
	<description>Development with open source software</description>
	<lastBuildDate>Wed, 25 Jan 2012 20:54:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='kaosktrl.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Software Libero e non solo</title>
		<link>http://kaosktrl.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kaosktrl.wordpress.com/osd.xml" title="Software Libero e non solo" />
	<atom:link rel='hub' href='http://kaosktrl.wordpress.com/?pushpress=hub'/>
		<item>
		<title>JSLint4java, Jenkins and Violation plugin</title>
		<link>http://kaosktrl.wordpress.com/2011/12/27/jslint4java-jenkins-and-violation-plugin/</link>
		<comments>http://kaosktrl.wordpress.com/2011/12/27/jslint4java-jenkins-and-violation-plugin/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 10:29:50 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[violation]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=751</guid>
		<description><![CDATA[In a previous article I told you about the existence of the violation plugin for Jenkins which can take in consideration the output generated by jslint4java. jslint4java has an ant plugin which can be easily integrated in your environment and you need just to configure it for your javascript. Let&#8217;s suppose you have a javascript [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=751&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a previous article I told you about the existence of the violation plugin for Jenkins which can take in consideration the output generated by jslint4java.</p>
<p>jslint4java has an ant plugin which can be easily integrated in your environment and you need just to configure it for your javascript.</p>
<p>Let&#8217;s suppose you have a javascript file, in my case user-extensions.js coming from Selenium, in your repository.</p>
<p>At the same level create a folder named &#8220;jslint&#8221;. Under this folder place the jslint4java-2.0.1.jar file that you can find inside the <a href="http://code.google.com/p/jslint4java/downloads/detail?name=jslint4java-2.0.1-dist.zip&amp;can=2&amp;q=">zip file</a> of jslint4java and create a build.xml file with the following content:</p>
<pre>&lt;project name="proj" default="main" basedir="."&gt;
&lt;target name="main" depends="jslint"/&gt;

&lt;taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="jslint4java-2.0.1.jar" /&gt;

&lt;target name="jslint"&gt;
&lt;jslint haltOnFailure="false" options="sloppy"&gt;
&lt;predef&gt;selenium,Selenium,storedVars,LOG,Assert&lt;/predef&gt;
&lt;formatter type="xml" destfile="jslint.xml"/&gt;
&lt;fileset dir="../" includes="user-extensions.js"/&gt;
&lt;/jslint&gt;
&lt;/target&gt;

&lt;/project&gt;</pre>
<p>In practice in the taskdef tag we say where the jar file is located (same folder), in the jslint tag I specified:</p>
<ol>
<li>haltOnFailure=&#8221;false&#8221;, to not  make stop and fail the plugin if a violation is found (in this way the entire job in Jenkins will not fail)</li>
<li>options=&#8221;sloppy&#8221;, to disable the strict control in the file (used for ECMAScript 5)</li>
<li>using predefined variables like &#8220;selenium&#8221; with the predef tag</li>
<li>specifying the output file (in the same folder) in xml format (useful for the violation plugin)</li>
<li>specifying just the input file that I have (which is in the top folder)</li>
</ol>
<p>Once the folder is created with the 2 files (build.xml and jslint4java jar file) in the repository let&#8217;s go to the Jenkins job to install the violation plugin and configure the job.</p>
<p>First let&#8217;s configure the ant task in the Job (my directory is under trunk/test):</p>
<p><a href="http://s1112.photobucket.com/albums/k491/kaosktrl/?action=view&amp;current=ant.png" target="_blank"><img src="http://i1112.photobucket.com/albums/k491/kaosktrl/ant.png" alt="Ant configuration" width="500" border="0" /></a></p>
<p>Then we configure the Violation plugin in the Job:</p>
<p><a href="http://s1112.photobucket.com/albums/k491/kaosktrl/?action=view&amp;current=violation.png" target="_blank"><img src="http://i1112.photobucket.com/albums/k491/kaosktrl/violation.png" alt="Violation plugin configuration" width="500" border="0" /></a></p>
<p>Let&#8217;s save and run the build and we should see a graph the following in the Job page:</p>
<p><a href="http://s1112.photobucket.com/albums/k491/kaosktrl/?action=view&amp;current=violation2.png" target="_blank"><img src="http://i1112.photobucket.com/albums/k491/kaosktrl/violation2.png" alt="Violation graph in job page" width="500" border="0" /></a></p>
<p>If you click on the left menu on Violations (or in the graph) you will see the same graph with the number of violations per file:</p>
<p><a href="http://s1112.photobucket.com/albums/k491/kaosktrl/?action=view&amp;current=violation3.png" target="_blank"><img src="http://i1112.photobucket.com/albums/k491/kaosktrl/violation3.png" alt="Number of violations per file" width="500" border="0" /></a></p>
<p>If you click on the filename you will see all the violations with the respective row numbers:</p>
<p><a href="http://s1112.photobucket.com/albums/k491/kaosktrl/?action=view&amp;current=violation4.png" target="_blank"><img src="http://i1112.photobucket.com/albums/k491/kaosktrl/violation4.png" alt="Violations in a file" width="500" border="0" /></a></p>
<p>If you click on the row number you can see the line of the code (just below):</p>
<p><a href="http://s1112.photobucket.com/albums/k491/kaosktrl/?action=view&amp;current=violation5.png" target="_blank"><img src="http://i1112.photobucket.com/albums/k491/kaosktrl/violation5.png" border="0" alt="Photobucket" width="500"></a></p>
<p>Enjoy fixing your javascript file :-)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/751/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/751/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/751/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/751/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/751/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/751/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/751/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=751&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2011/12/27/jslint4java-jenkins-and-violation-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>

		<media:content url="http://i1112.photobucket.com/albums/k491/kaosktrl/ant.png" medium="image">
			<media:title type="html">Ant configuration</media:title>
		</media:content>

		<media:content url="http://i1112.photobucket.com/albums/k491/kaosktrl/violation.png" medium="image">
			<media:title type="html">Violation plugin configuration</media:title>
		</media:content>

		<media:content url="http://i1112.photobucket.com/albums/k491/kaosktrl/violation2.png" medium="image">
			<media:title type="html">Violation graph in job page</media:title>
		</media:content>

		<media:content url="http://i1112.photobucket.com/albums/k491/kaosktrl/violation3.png" medium="image">
			<media:title type="html">Number of violations per file</media:title>
		</media:content>

		<media:content url="http://i1112.photobucket.com/albums/k491/kaosktrl/violation4.png" medium="image">
			<media:title type="html">Violations in a file</media:title>
		</media:content>

		<media:content url="http://i1112.photobucket.com/albums/k491/kaosktrl/violation5.png" medium="image">
			<media:title type="html">Photobucket</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium, JSLint and editors</title>
		<link>http://kaosktrl.wordpress.com/2011/12/24/selenium-jslint-and-editors/</link>
		<comments>http://kaosktrl.wordpress.com/2011/12/24/selenium-jslint-and-editors/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 15:38:10 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[aptana]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jedit]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[notepad++]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[sonar]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=740</guid>
		<description><![CDATA[Testing with Selenium can require adding a user-extensions.js to your Selenium IDE and Server. While modifying the user-extensions.js you could need a javascript editor with a JSLint plugin suggesting how to make your code better. Among open source solutions with JSLint plugin I found: Notepad++, jEdit, Netbeans, Eclipse and Aptana (please suggest others if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=740&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Testing with Selenium can require adding a user-extensions.js to your Selenium IDE and Server.</p>
<p>While modifying the user-extensions.js you could need a javascript editor with a JSLint plugin suggesting how to make your code better.</p>
<p>Among open source solutions with JSLint plugin I found: Notepad++, jEdit, Netbeans, Eclipse and Aptana (please suggest others if you know).</p>
<p>Notepad++ (5.9.6.2) has a good plugin updated to 2011 (I can see the Node.js option) and you can put the variable Selenium in the options (Predefined field) of the plugin. The errors are displayed in the JSLint panel which is good but you cannot order them by error description. The only problem is that Notepad++ is for Windows (I have seen people using it with wine for Linux).</p>
<p>Notepad++ doesn&#8217;t provide a function navigator but it is possible to setup a <a href="http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Central">Function List plugin</a> manually (put the dll in the program files directory and the rest in the %appdata%/Notepad++/plugins/config with the xml in readonly) and add a rule as explained in this <a href="http://orizens.com/wp/topics/notepad-function-list-for-object-oriented-javascript/">blog</a>.</p>
<p>jEdit (4.5.1 pre1) is a good multiplatform editor. It has a function navigator (you have to install Sidekick plugin with the XML plugin) and it has a JSLint plugin (0.8)</p>
<p>The JSLint plugin is old (in the<a href="http://plugins.jedit.org/plugins/?JSLint"> page</a> you see that the latest release is in 2009) and indeed you don&#8217;t see the Node.js option, further you need to add /*global Selenium */ inside your script to make disappear the undefined variable Selenium message. The errors are displayed in the Error List panel and underlined in the file andyou cannot order them by error description</p>
<p>Netbeans (7.0.1) has his own <a href="http://plugins.netbeans.org/plugin/40893/jslint">JSLint plugin</a>, with a configuration under Tools-&gt;Options-&gt;Miscellaneous-&gt;JSLint but the Predefined field doesn&#8217;t seem to work so you need to add /*global Selenium */ in your script. The error are displayed next to the file and under the Task list (see the instructions) and you can order them by error description.</p>
<p>With Netbeans you can see the function navigator in the Navigator panel. Compared with others IDE (Eclipse/Aptana) you can do the check on a file or in a project while the others can work only in the project.</p>
<p>For Eclipse (Indigo) I setup the JSLint plugin using the update site:</p>
<p><a href="http://update.rockstarapps.com/site.xml" rel="nofollow">http://update.rockstarapps.com/site.xml</a></p>
<p>When you have setup the plugin, you see a RockStarApps menu and, as you can notice, the plugin is not updated to the last version of JSLint (Node.js is not there) but the Predefined field works.</p>
<p>The errors are displayed next to the file and under the Problems panel and you can group them by error description.</p>
<p>For the function navigator Eclipse has a JavaScript Development Tools plugin that you can setup using the following site under WTP 3.3.1:</p>
<p>http://download.eclipse.org/webtools/repository/indigo</p>
<p>Then open the perspective Javascript and you find the function navigator in the Script Explorer panel.</p>
<p>Concerning Aptana Studio 3, there is a native JSLint plugin to be enabled under Window-&gt;Preferences-&gt;Aptana Studio-&gt;Validation-&gt;Javascript. I don&#8217;t see the configuration panel like in the other plugins so you need to add all the options in your javascript file but you can fiter some warnings.</p>
<p>The errors are displayed next to the file and under the Problems panel and you can group them by error description. It doesn&#8217;t look to me stable for the moment (it seems not all the warnings I get with the others plugin are there).</p>
<p>Aptana has a function navigator in the Outline panel.</p>
<p>At Continuous Integration level I found a <a href="https://wiki.jenkins-ci.org/display/JENKINS/Violations">Jenkins Violation Plugin</a> or just using <a href="http://code.google.com/p/jslint4java/">jslint4java</a> which has an ant plugin on which is based the <a href="http://docs.codehaus.org/display/SONAR/JavaScript+Plugin">Sonar plugin</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/740/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=740&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2011/12/24/selenium-jslint-and-editors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium Dot Formatter</title>
		<link>http://kaosktrl.wordpress.com/2011/12/20/selenium-dot-formatter/</link>
		<comments>http://kaosktrl.wordpress.com/2011/12/20/selenium-dot-formatter/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 14:05:56 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[selenium]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=736</guid>
		<description><![CDATA[After the wiki formatter I decided to create a Dot formatter extension plugin for Firefox. The plugins trasforms a test case in a graph in dot language, the graph can be then opened with Graphviz to be represented. Link: https://addons.mozilla.org/en-us/firefox/addon/selenium-dot-formatter/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=736&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After the wiki formatter I decided to create a Dot formatter extension plugin for Firefox. The plugins trasforms a test case in a graph in dot language, the graph can be then opened with Graphviz to be represented.</p>
<p>Link: <a id="submitted-addon-url" href="https://addons.mozilla.org/en-us/firefox/addon/selenium-dot-formatter/">https://addons.mozilla.org/en-us/firefox/addon/selenium-dot-formatter/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/736/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=736&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2011/12/20/selenium-dot-formatter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing a multilanguage website with Selenium</title>
		<link>http://kaosktrl.wordpress.com/2011/08/04/testing-a-multilanguage-website-with-selenium/</link>
		<comments>http://kaosktrl.wordpress.com/2011/08/04/testing-a-multilanguage-website-with-selenium/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 05:58:19 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[multilanguage]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=718</guid>
		<description><![CDATA[I believe the technique to test a multilanguage website is still a quite open discussion and it depends what are the objectives. Normally you would say &#8220;I want to check all the labels that are on the website are on the right place&#8221; which means you have to extract them from somewhere, store them and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=718&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I believe the technique to test a multilanguage website is still a quite open discussion and it depends what are the objectives. Normally you would say &#8220;I want to check all the labels that are on the website are on the right place&#8221; which means you have to extract them from somewhere, store them and compare them with those on the website.</p>
<p>When you extract them from a database you might probably already have a form that allows to create them and a page to list all of them. Somebody would say that it is convenient to retrieve them directly from the database doing in practice data driven testing/database validation.</p>
<p>If you are writing test cases directly with a programming language like Java (just for example) you have already the methods to contact the database and retrieve the labels but if you are writing your test cases in Javascript either you need a webservice to contact an application to retrieve the database data or you have to create a command to go to the page of your application that list all the labels. For sure you have to synchronize your test cases with the stored labels and not updating the test cases manually.</p>
<p>I am still not convinced how far a tester can go (and learn) when testing. At the beginning I was thinking that a tester could learn just selenium commands and a developer will extend some of them for her/him. In reality it depends on the skills of your tester. In my opinion javascript is a language easy to learn (together with xpath or css selector) it can parse easily DOM objects and Selenium can reach this level of granularity. So a tester needs to know the structure of a DOM object and from here s/he can learn xpath/css selector and javascript.</p>
<p>This long introduction will help to understand what I am going to explain.</p>
<p>Usually with Selenium you can store xpath or css selector in a variable with a simple command (like storeText) which stores this variable in a local javascript array (storedVars) invisible to a simpler tester. A contributed user extension can store a text in a global array that can be reused among all the test case. This global array (globalStoredVars) can be indeed used to store the labels of your website.</p>
<p>Now supposing that you have a website in 3 languages (en, fr, de), the approach that I would do is to store the labels with a language suffix (for example label_login_en, label_login_fr, label_login_de) and store in the original variable (label_login) one of 3 variables every time I change language, using a javascript function to update the original variable.</p>
<pre>String.prototype.endsWith = function(suffix) {
    return this.indexOf(suffix, this.length - suffix.length) !== -1;
};

Selenium.prototype.doSetLanguage = function(language) {
  var languages=new Array("en","de","fr");
  if((languages.indexOf(language) == -1) || (language=="random") )
    language = languages[Math.round(Math.random() * new Date().getMilliseconds())%(languages.length)];
  var suffix="_"+language;
  for (var i in globalStoredVars){
    if(i.endsWith(suffix)){
      LOG.info("found variable "+i);
      var new_var=i.substring(0,(i.length-suffix.length));
      LOG.info("new_var: "+new_var);
      globalStoredVars[new_var]=globalStoredVars[i];
    }
  }
  globalStoredVars['xpath_cell']="//td[.='"+globalStoredVars['label_login']+"']";
};</pre>
<p>The example above shows a Selenium command <strong>setLanguage</strong> which takes as input a language (or gives the possibility to choose a random language if not inserted or if &#8220;random&#8221; is used), it takes all the labels stored in globlalStoredVars with the suffix for the language chosen and it to replace them with the original variable without suffix.</p>
<p>The inconvenient is that if you have for example an xpath that it turns contain one of the original labels (see the last row in the code where <strong>xpath_cell</strong> depends on the <strong>label_login</strong> variable), you have to update it as well every time  (which means moving the storing of the xpath from the selenium command into a javascript command directly, which means the tester needs to know javascript).</p>
<p>Putting a part the usage of an xpath containing a label (that can be arguable), the question would be if it is correct changing a language (and what are the implications) at the beginning of the test suite or at the beginning of each test case.</p>
<p>It is obvious that in terms of performance it is better to choose it once at the beginning of the test suite but in some cases (a user chooses the own language in the profile or the website chooses a language for a particular user) it is not possible so you need to update each testcase.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/718/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=718&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2011/08/04/testing-a-multilanguage-website-with-selenium/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium: testing PDF with Calibre</title>
		<link>http://kaosktrl.wordpress.com/2011/07/17/selenium-testing-pdf-with-calibre/</link>
		<comments>http://kaosktrl.wordpress.com/2011/07/17/selenium-testing-pdf-with-calibre/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 10:02:08 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[calibre]]></category>
		<category><![CDATA[hyperlink]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[pdfbox]]></category>
		<category><![CDATA[pdftotext]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[tika]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=711</guid>
		<description><![CDATA[During my test activities I have arrived at the point that I need to test generated PDFs containing the same text that I have in a html page. So I searched different PDF utilities that can be used through a command line to extract text out of a PDF, among these I found: pdftotext (a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=711&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>During my test activities I have arrived at the point that I need to test generated PDFs containing the same text that I have in a html page.</p>
<p>So I searched different PDF utilities that can be used through a command line to extract text out of a PDF, among these I found: <a title="pdftotext wikipedia page" href="http://en.wikipedia.org/wiki/Pdftotext">pdftotext</a> (a command line tool coming with xpdf), <a title="Calibre as command line utility" href="http://manual.calibre-ebook.com/cli/ebook-convert.html">Calibre</a> (an ebook manager/converter), <a title="Tika as command line application" href="http://tika.apache.org/0.9/gettingstarted.html#Using_Tika_as_a_command_line_utility">Tika</a> (used by Solr to index pdf content), <a title="Pdfbox with extract options" href="http://pdfbox.apache.org/commandlineutilities/ExtractText.html">pdfbox</a> (a java application library that extract pdf).</p>
<p>Giving a better look <a title="Calibre dependencies" href="http://calibre-ebook.com/download_linux#dependencies">Calibre is using popple</a>r as library and <a title="poppler wikipedia page" href="http://en.wikipedia.org/wiki/Poppler_%28software%29">pdftotext is using poppler</a> as well while <a title="list of projects using PDFbox" href="http://pdfbox.apache.org/references.html">Tika is based on pdfbox library</a> to extract text.</p>
<p>At the end I chose Calibre for different reasons:</p>
<ol>
<li><a title="ebookconvert options" href="http://manual.calibre-ebook.com/cli/ebook-convert-9.html#pdf-input-to-txt-output">Calibre allows to extract hyperlinks</a> from the pdf (main reason) when using a wiki syntax like textile (I didn&#8217;t find this possibility in pdftotext, tika or pdfbox) on the other side the generated text is with wiki syntax</li>
<li>The development life cycle of Calibre is quite fast (compared with xpdf)</li>
<li>Calibre points to release the application for Windows, Mac and Linux (with xpdf you can have different versions but the one for Mac is released on 2007)</li>
</ol>
<p>Note that I don&#8217;t care the possibility to extract text from images, I know that with pdfimages command it is possible to extract them or <a title="formats supported by tika" href="http://tika.apache.org/0.9/formats.html">other formats that tika can support</a>.</p>
<p>I have to say that in terms of performance on the pdf I tested pdftotext is the fastest (0.01 sec), followed by pdfbox (1.7 sec), Calibre (2.3 sec) and then Tika (2.8 sec) on page , so if you don&#8217;t care about hyperlinks but just PDF text I would suggest to go to pdftotext.</p>
<p>After choosing Calibre I created a simple php application that:</p>
<ol>
<li>receives as parameter the URL of a PDF</li>
<li>calls Calibre with different options on the PDF downloaded</li>
<li>removes  some text (like empty lines, etc.)</li>
<li>gives back an xml file with all the text generated.</li>
</ol>
<p>I created then a selenium command that calls the php file (through an xmlhttp request) and search for a particular text (specified as input together with the url of the pdf file).</p>
<p>Php application (convert.php):</p>
<pre>&lt;?php
$content = file_get_contents($_GET['url']);
$filefrom = 'extract.pdf';
$fileto = preg_replace("/\.pdf$/","",$filefrom).".txt";
file_put_contents($filefrom,$content);
//$t_start = microtime(true);
//system("java -jar tika.jar -t ".escapeshellcmd($filefrom)." &gt; ".escapeshellcmd($fileto),$ret);
system("ebook-convert ".escapeshellcmd($filefrom)." ".escapeshellcmd($fileto)."  &gt;nul 2&gt;&amp;1",$ret);
//system("pdftotext -nopgbrk -raw ".escapeshellcmd($filefrom)." ".escapeshellcmd($fileto),$ret);
//system("java -jar pdfbox.jar ExtractText  ".escapeshellcmd($filefrom)." ".escapeshellcmd($fileto),$ret);
//$t_end = microtime(true);
if($ret==0){
  $value=file_get_contents($fileto);
  $value_empty_line=preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $value);
  $text=preg_replace("/(\[.*\]\n)/","",$value_empty_line);
  unlink($fileto);
  header('Content-type: text/xml');
  echo "&lt;result&gt;".htmlspecialchars($text)."&lt;/result&gt;";
}
else{
  header('Content-type: text/xml');
  echo "&lt;result&gt;Convertion failed&lt;/result&gt;";
}
?&gt;</pre>
<p>Selenium command (assertSearhInPDF):</p>
<pre>Selenium.prototype.assertSearchInPDF = function(uri,names){
  var baseurl = globalStoredVars['host'];
  var params = [{"param" : "url","value" : storedVars[uri],}];
  var lista = "";
  for(var i=0; i&lt;params.length; i++){
    lista +="&amp;" + params[i].param + "=" + encodeURIComponent(params[i].value);
  }
  var indirizzo = baseurl+"/test/convert.php?"+lista;
  LOG.info( 'indirizzo = ' + indirizzo);
  var responseXML = chiamaWebService(indirizzo);
  LOG.info( 'response = ' + responseXML);
  var text = responseXML.getElementsByTagName('result')[0].firstChild.nodeValue;
  text = text.replace(/(\n)/g, " ");
  var array = names.split('|');
  var result=0;
  var length=array.length;
  LOG.info( 'text = ' + text);
  for (var i = 0; i &lt; length; i++){
    if(text.indexOf(array[i]) !==-1){
      LOG.info( 'Found = ' + array[i]);
      result=result+1;
      text=text.substring(text.indexOf(array[i]));
    }
    else{
      LOG.info( 'Element ' + array[i]+' not found');
      break;
    }
  }
  if(result!=length)
    Assert.fail("Not all the elements have been found");
};</pre>
<p>In particular the selenium command can accept a list of elements (separated by &#8220;|&#8221;) to searched in the respective order, if they are not found the command fails.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/711/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/711/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/711/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/711/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/711/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/711/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/711/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/711/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=711&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2011/07/17/selenium-testing-pdf-with-calibre/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>A Pisa è ora di &#8220;Internet Festival&#8221;, 5 &#8211; 8 maggio 2011</title>
		<link>http://kaosktrl.wordpress.com/2011/05/04/a-pisa-e-ora-di-internet-festival-5-8-maggio-2011/</link>
		<comments>http://kaosktrl.wordpress.com/2011/05/04/a-pisa-e-ora-di-internet-festival-5-8-maggio-2011/#comments</comments>
		<pubDate>Wed, 04 May 2011 21:05:52 +0000</pubDate>
		<dc:creator>Andrea Stani</dc:creator>
				<category><![CDATA[Software Libero]]></category>
		<category><![CDATA["Internet Festival" 2011 Pisa Internet Event maggio CNR "5 maggio 2011" "6 maggio 2011" "7 maggio 2011" "8 maggio 2011"]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=699</guid>
		<description><![CDATA[Mi scuso per la segnalazione un pò tardiva, per fortuna ci sono sempre 4 giorni di seminari eventi e laboratori. In questi giorni, dal 5 all&#8217; 8 maggio si tiene a Pisa l&#8217;Internet Festival 2011. Molti laboratori sono legati a progetti di ricerca. Questo è il link , http://www.internetfestival.it/ , in cui trovate tutte le [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=699&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Mi scuso per la segnalazione un pò tardiva, per fortuna ci sono sempre 4 giorni di seminari eventi e laboratori.</p>
<p>In questi giorni, dal 5 all&#8217; 8 maggio si tiene a Pisa l&#8217;Internet Festival 2011.</p>
<p style="text-align:center;"><a href="http://www.internetfestival.it/"><img class="aligncenter" title="Internet Festival 2011" src="http://server5.iit.cnr.it/%7Eintreg/festival/wp-content/themes/MyTech/images/logo.png" alt="Internet Festival 2011" width="289" height="109" /></a></p>
<p>Molti laboratori sono legati a progetti di ricerca.</p>
<p>Questo è il link , http://www.internetfestival.it/ , in cui trovate tutte le informazioni sul festival e il programma delle diverse giornate.</p>
<p>Io seguirò su indicazione di un Professore che mi è riferimento per uno degli ultimi esami, gli incontri previsti dal seguente evento http://www.internetfestival.it/eventi/?event_id=506 .</p>
<p>Mi auguro di trovare il tempo per seguire anche altri eventi.</p>
<p>Spero possa essere utile la segnalazione.</p>
<p>Buon Internet Festival 2011</p>
<p>Andrea Stani</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/699/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/699/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/699/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/699/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/699/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/699/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/699/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/699/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=699&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2011/05/04/a-pisa-e-ora-di-internet-festival-5-8-maggio-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c7f019001ff48de478f8082f700d5dd2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andrea Stani</media:title>
		</media:content>

		<media:content url="http://server5.iit.cnr.it/%7Eintreg/festival/wp-content/themes/MyTech/images/logo.png" medium="image">
			<media:title type="html">Internet Festival 2011</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium wiki formatter (textile e altri)</title>
		<link>http://kaosktrl.wordpress.com/2010/12/27/selenium-wiki-formatter-textile-e-altri/</link>
		<comments>http://kaosktrl.wordpress.com/2010/12/27/selenium-wiki-formatter-textile-e-altri/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 16:40:47 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[confluence]]></category>
		<category><![CDATA[dokuwiki]]></category>
		<category><![CDATA[formatter]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[moinmoin]]></category>
		<category><![CDATA[redmine]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[textile]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[twiki]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[xwiki]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=678</guid>
		<description><![CDATA[Di recente avevo necessità di copiare dei test case creati con Selenium IDE su Redmine, si potrebbe allegarli ma l&#8217;intenzione è quella di mostrali come una tabella. Ho cosi&#8217; consultato velocemente la pagina su come creare un custom format. Da li&#8217;, a meno di eccezioni (quali l&#8217;escape della pipe &#124; ) ho creato questo semplice [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=678&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Di recente avevo necessità di copiare dei test case creati con <strong>Selenium IDE</strong> su <strong>Redmine</strong>, si potrebbe allegarli ma l&#8217;intenzione è quella di mostrali come una tabella.</p>
<p>Ho cosi&#8217; consultato velocemente la pagina su <a href="http://wiki.openqa.org/display/SIDE/Adding+Custom+Format">come creare un custom format.</a></p>
<p>Da li&#8217;, a meno di eccezioni (quali l&#8217;escape della pipe | ) ho creato questo semplice script da aggiungere nel menu opzioni di Selenium IDE nel tab formats (inserite <strong>Wiki</strong> nel campo <strong>wiki format name</strong> e sovrascrivete con il seguente contenuto):</p>
<pre>var wiki = {
confluence:{
  start_table: "",
  end_table: "",
  header: "||Command||Target||Value||\n",
  header_row:"||#",
  start_row: "| ",
  end_row: " |\n",
  separator: " | ",
},
dokuwiki:{
  start_table: "",
  end_table: "",
  header: "^ Command ^ Target ^ Value ^\n",
  header_row:"^ # ",
  start_row: "| ",
  end_row: " |\n",
  separator: " | ",
},
mediawiki:{
  start_table: "{|border=\"1\" \n",
  end_table: "|}",
  header: "!Command\n!Target\n!Value\n",
  header_row:"!#\n",
  start_row: "|-\n|",
  end_row: "\n",
  separator: "\n|",
},
moinmoin:{
  start_table: "",
  end_table: "",
  header: "||\'\'\'Command\'\'\'||\'\'\'Target\'\'\'||\'\'\'Value\'\'\'||\n",
  header_row:"||\'\'\'#\'\'\'",
  start_row: "||",
  end_row: "||\n",
  separator: "||",
},
textile:{
  start_table: "",
  end_table: "",
  header: "|_. Command|_. Target|_. Value|\n",
  header_row:"|_. #",
  start_row: "|",
  end_row: "|\n",
  separator: "|",
},
trac:{
  start_table: "",
  end_table: "",
  header: "||= Command =||=  Target =||=  Value =||\n",
  header_row:"||= # =",
  start_row: "||",
  end_row: "||\n",
  separator: "||",
},
twiki:{
  start_table: "",
  end_table: "",
  header: "|  *Command*  |  *Target*  |  *Value*  |\n",
  header_row:"| *#*",
  start_row: "|  ",
  end_row: "  |\n",
  separator: "  |  ",
},
xwiki:{
  start_table: "",
  end_table: "",
  header: "|=Command|=Target|=Value\n",
  header_row:"|=#",
  start_row: "|",
  end_row: "\n",
  separator: "|",
}
};

function formatCommands(commands) {
  var result = '';
  var start_table =  wiki[options['wiki']]["start_table"];
  var end_table =  wiki[options['wiki']]["end_table"];
  var header = wiki[options['wiki']]["header"];
  var header_row = wiki[options['wiki']]["header_row"];
  var start_row = wiki[options['wiki']]["start_row"];
  var end_row = wiki[options['wiki']]["end_row"];
  var sep = wiki[options['wiki']]["separator"];
  var row_num = '';
  for (var i = 0; i &lt; commands.length; i++) {
    var command = commands[i];
    if('true' == options.row)
            row_num= i+sep;
    if (command.type == 'command') {
      result += start_row + row_num+ command.command + sep + command.target + sep + command.value + end_row;
    }
  }
    if('true' == options.row)
         header = header_row+header;
    result = start_table + header + result + end_table;
  return result;
}

function parse(testCase, source) {
  var doc = source;
  var commands = [];
  var start_row = wiki[options['wiki']]["start_row"];
  var sep = wiki[options['wiki']]["separator"];
  while (doc.length &gt; 0) {
    var line = /(.*)(\r\n|[\r\n])?/.exec(doc);
    var line2 = line[1].slice(start_row.length);
    var array = line2.split(sep);
    if (array.length &gt;= 3) {
      var command = new Command();
      command.command = array[0];
      command.target = array[1];
      command.value = array[2];
      commands.push(command);
    }
    doc = doc.substr(line[0].length);
  }
  testCase.setCommands(commands);
}

function format(testCase, name) {
  return formatCommands(testCase.commands);
}

options = {wiki: 'confluence', row:"false"};

configForm = '&lt;description&gt;Choose a wiki syntax:&lt;/description&gt;' + '&lt;menulist id="options_wiki"&gt;'
+ 	'&lt;menuitem label="Confluence" value="confluence"/&gt;' +
+ 	'&lt;menuitem label="DokuWiki" value="dokuwiki"/&gt;' +
	'&lt;menuitem label="MediaWiki" value="mediawiki"/&gt;' +
	'&lt;menuitem label="MoinMoin" value="moinmoin"/&gt;' + '&lt;menuitem label="Textile" value="textile"/&gt;' + '&lt;menuitem label="Trac" value="trac"/&gt;' + '&lt;menuitem label="Twiki" value="twiki"/&gt;' + '&lt;menuitem label="Xwiki" value="xwiki"/&gt;' + '&lt;/menupopup&gt;' + '&lt;/menulist&gt;'+ '&lt;separator class="groove"/&gt;' + '&lt;checkbox id="options_row" label="Row number"/&gt;';</pre>
<p>Dal menu delle opzioni, vedete che confluence  è impostato di default (potete abilitare anche i numeri di riga tramite la checkbox) e potete scegliere tra <strong>Confluence</strong>, <strong>DokuWiki</strong>, <strong>MediaWiki</strong>, <strong>MoinMoin</strong>, <strong>Textile</strong> (Redmine), <strong>Trac</strong>,<strong> Twiki</strong> e <strong>Xwiki</strong>.</p>
<p>Una volta salvato, andate in<strong> Options -&gt; Format</strong> e scegliete <strong>Wiki</strong>, cliccate poi sul tab <strong>Source</strong> e vedete il test case nel formato wiki da voi scelto, potete poi copiare e incollare nel vostro wiki preferito.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/678/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=678&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2010/12/27/selenium-wiki-formatter-textile-e-altri/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium e la ricerca sulla tabella</title>
		<link>http://kaosktrl.wordpress.com/2010/12/22/selenium-e-la-ricerca-sulla-tabella/</link>
		<comments>http://kaosktrl.wordpress.com/2010/12/22/selenium-e-la-ricerca-sulla-tabella/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 13:25:23 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[ciclo]]></category>
		<category><![CDATA[ricerca]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[tabella]]></category>
		<category><![CDATA[test case]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=675</guid>
		<description><![CDATA[Una delle operazioni più comuni che puo&#8217; capitarvi in un test è la ricerca un testo in una tabella seguito dal click, nella stessa riga del testo trovato, su un pulsante o link per fare determinate azioni come vedere dettagli, modificare o cancellare un oggetto nella tabella. Normalmente su un sito web vi trovate di [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=675&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Una delle operazioni più comuni che puo&#8217; capitarvi in un test è la ricerca un testo in una tabella seguito dal click, nella stessa riga del testo trovato, su un pulsante o link per fare determinate azioni come vedere dettagli, modificare o cancellare un oggetto nella tabella.</p>
<p>Normalmente su un sito web vi trovate di fronte a tabelle divise in pagine per non avere una pagina troppo lunga e di conseguenza avrete anche un pulsante per proseguire alla prossima pagina, pulsante che non appare nell&#8217;ultima pagina ovviamente.</p>
<p>Con l&#8217;aiuto dell&#8217;estensione <a href="http://wiki.openqa.org/display/SEL/flowControl" target="_blank">FlowControl</a>, che permette di realizzare cicli o condizioni, ho quindi creato un test case che cerca il mio cognome in questa <a href="http://ec.europa.eu/ewsi/en/membership/directory.cfm?alpha=s" target="_blank">pagina (sezione s)</a> e, se trovato, fa alcune operazioni, come memorizzare informazioni (nome, organizzazione, area) o cliccare sul link per vedere i contributi.</p>
<p>Il test case è il seguente:</p>
<table border="1" cellspacing="1" cellpadding="1">
<thead>
<tr>
<td colspan="3">looptest</td>
</tr>
</thead>
<tbody>
<tr>
<td>store</td>
<td>false</td>
<td>ElementFound</td>
</tr>
<tr>
<td>while</td>
<td>storedVars.ElementFound!=true &amp;&amp; selenium.isElementPresent(&#8220;//div[@id='content']/table[2]/tbody/tr/td[1]/div[3]/a&#8221;);</td>
<td></td>
</tr>
<tr>
<td>searchSurname</td>
<td>Stani</td>
<td>seeContributions</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${ElementFound}==true</td>
<td>skipClickNext</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='Next']</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>skipClickNext</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
<tr>
<td>gotoIf</td>
<td>${ElementFound}==true</td>
<td>skipLastSearch</td>
</tr>
<tr>
<td>searchSurname</td>
<td>Stani</td>
<td>seeContributions</td>
</tr>
<tr>
<td>label</td>
<td>skipLastSearch</td>
<td></td>
</tr>
<tr>
<td>verifyExpression</td>
<td>${ElementFound}</td>
<td>true</td>
</tr>
</tbody>
</table>
<p>Inizializziamo la variabile <strong>ElementFound</strong> a false, tale variabile ci permette di verificare alla fine se abbiamo trovato o meno il cognome (o elemento in generale).</p>
<p>Creiamo il ciclo (comando <strong>while</strong>) dove ad ogni iterazione verifichiamo se l&#8217;elemento è stato trovato e se è presente il link alla pagina successiva. Se l&#8217;elemento non è stato trovato allora facciamo una ricerca tramite il comando creato da me <strong>searchSurname.</strong></p>
<p>Il comando searchSurname cerca nella prima colonna della tabella il cognome e, una volta trovato, clicca sul link dei contributi tramite l&#8217;azione <strong>seeContributions</strong> (per i dettagli vedere sotto).</p>
<p>Il comando searchSurname imposta a true la variabile ElementFound nel caso in cui il cognome è stato trovato. Se la variabile è  a true non dobbiamo cliccare sulla prossima pagina (salto alla label <strong>skipClickNext</strong>) e usciremo nel ciclo alla prossima iterazione. Se invece il cognome non è stato trovato (variabile a false) cliccheremo sul pulsante Next.</p>
<p>Dopo la fine del ciclo (<strong>endwhile</strong>) abbiamo bisogno di un ulteriore ricerca nel caso in cui raggiungiamo l&#8217;ultima delle pagine dove l&#8217;elemento non è stato ancora trovato e non esiste il link alla pagina successiva (salto alla label <strong>skipLastSearch</strong>).</p>
<p>Verifichiamo dunque alla fine se la variabile è a true (<strong>verifyExpression</strong>).</p>
<p>Andiamo a vedere ora il comando searchSurname:</p>
<pre>function search(divId, textToFind, searchCol){
	obj_by_id = selenium.browserbot.getCurrentWindow().document.getElementById(divId);
	rowlist = obj_by_id.getElementsByTagName("TR");
	rowfound = -1;
	for (rowNo=1; rowNo&lt;rowlist.length; rowNo++) {
		var cella = rowlist[rowNo].cells[searchCol];
		LOG.info("reading element "+ rowNo+": "+cella.innerHTML);
		if(cella.innerHTML == textToFind){
			LOG.info( "Found element " + textToFind + " at row "+rowNo);
	        rowfound=rowNo;
			break;
		}
	}
	if(rowfound==-1)
		LOG.info("Element "+textToFind+" not found!");
	return rowfound;
}

function action(divId, rowNo, actionType){
	rowPath = "//table[@id=\'"+divId+"\']/tbody/tr["+rowNo+"]";
	if(actionType == "storeName")
		selenium.doStoreText(rowPath+"/td[2]", "NameFound");
	else if(actionType == "storeOrganization")
		selenium.doStoreText(rowPath+"/td[3]", "OrganizationFound");
	else if(actionType == "storeArea")
		selenium.doStoreText(rowPath+"/td[4]", "AreaFound");
	else if(actionType == "seeContributions")
		selenium.doClick(rowPath+"/td[6]/a");
	else
		Assert.fail("Action "+actionType+" is wrong!");
}

Selenium.prototype.doSearchSurname = function(textToFind, actionType){
	var divId = "Countrytable";
	var searchCol=0;
	var found=false;

	var rowNo=search(divId, textToFind, searchCol);
	if(rowNo!=-1){
		action(divId, rowNo, actionType);
		found=true;
	}
	storedVars['ElementFound']=found;
};
</pre>
<p>Il comando <strong>searchSurname</strong> chiama la funzione <strong>search</strong> passando l&#8217;<strong>id</strong> in cui è contenuta la tabella (<strong>Countrytable</strong>) e la  colonna in cui cercare il cognome (colonna<strong> 0</strong> ). La funzione <strong>search</strong> cerca l&#8217;esatto testo dentro ogni cella della colonna indicata e restituisce <strong>-1</strong> se il cognome non è stato trovato oppure il numero di riga in cui il cognome si trova.</p>
<p>Il numero di riga insieme all&#8217;id della tabella e il tipo di azione vengono usati per chiamare la funzione <strong>action</strong> nel caso in cui qualcosa è stato trovato (<strong>rowNo!=-1</strong>).</p>
<p>La funzione action a seconda del tipo di azione invoca uno dei comandi di Selenium. Nel nostro caso abbiamo le azioni:</p>
<ul>
<li><strong>storeName</strong>, che memorizza il nome nella variabile NameFound</li>
<li><strong>storeOrganization</strong>, che memorizza l&#8217;organizzazione nella variabile OrganizationFound</li>
<li><strong>storeArea</strong>, che memorizza l&#8217;area nellla variabile AreaFound</li>
<li><strong>seeContributions</strong>, che clicca sul link dei contributi (azione che usiamo nel nostro testcase).</li>
</ul>
<p>Se l&#8217;utente inserisce una azione non riconosciuta allora il test fallisce e si interrompe tramite il comando <strong>Assert.fail</strong> .</p>
<p>Alla fine del comando searchSurname memorizziamo nella variabile ElementFound il valore true se il cognome, nella ricerca della tabella corrente, è stato trovato o false se non è stato trovato.</p>
<p>Per eseguire il test case  in Selenium dovete quindi includere il file <a href="http://wiki.openqa.org/download/attachments/379/goto_sel_ide.js" target="_blank">goto_sel_ide.js</a> e il comando <strong>searchSurname</strong> come estensioni di Selenium dal menu Options.</p>
<p>Il test case puo&#8217; essere migliorato ma credo che comunque avrete bisogno di adattarlo alle vostre esigenze.</p>
<p>Buona ricerca :-)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/675/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=675&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2010/12/22/selenium-e-la-ricerca-sulla-tabella/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>Selenium e il controllo sulle scroll bar</title>
		<link>http://kaosktrl.wordpress.com/2010/12/21/selenium-e-il-controllo-sulle-scroll-bar/</link>
		<comments>http://kaosktrl.wordpress.com/2010/12/21/selenium-e-il-controllo-sulle-scroll-bar/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 08:25:06 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[comando]]></category>
		<category><![CDATA[ipg]]></category>
		<category><![CDATA[scroll bar]]></category>
		<category><![CDATA[selenium]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=668</guid>
		<description><![CDATA[Una delle comuni raccomandazioni, riprese e poi ben più definite da IPG, è il fatto che non ci devono essere barre orizzontali quando visualizza una pagina web. IPG raccomanda di avere una risoluzione base 1024&#215;768 e che l&#8217;altezza totale (compreso quella di scrolling) non deve essere superiore a 4 volte all&#8217;altezza base 768. Ho creato [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=668&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Una delle comuni raccomandazioni, riprese e poi ben più definite da IPG, è il fatto che non ci devono essere barre orizzontali quando visualizza una pagina web.</p>
<p>IPG <a title="raccomandazioni IPG sullo scrolling" href="http://ec.europa.eu/ipg/design/general_rules/screen_layout_en.htm">raccomanda</a> di avere una risoluzione base 1024&#215;768 e che l&#8217;altezza totale (compreso quella di scrolling) non deve essere superiore a 4 volte all&#8217;altezza base 768.</p>
<p>Ho creato quindi un semplice comando Selenium, checkBar, che ridimensiona la finestra a 1024&#215;768 (potete usare un&#8217;altra risoluzione da passare come parametro), calcola gli spazi interni e di scrolling e fa gli opportuni controlli.</p>
<pre>Selenium.prototype.doCheckBar = function(w,h){
if(w=="")
w=1024;
if(h=="")
h=768;
selenium.doEcho("w="+w+" h="+h);
wind= selenium.browserbot.getCurrentWindow();
width = wind.document.documentElement.clientWidth;
height = wind.document.documentElement.clientHeight;
selenium.doEcho("actual width="+width+" height="+height);
wind.resizeTo(w,h);
width = wind.document.documentElement.clientWidth;
sc_width = wind.document.documentElement.scrollWidth;
height = wind.document.documentElement.clientHeight;
sc_height = wind.document.documentElement.scrollHeight;
selenium.doEcho("new width="+width+" new scroll width="+sc_width);
selenium.doEcho("new height="+height+" new scroll height="+sc_height);
if((sc_width + (w-width))&gt; w)
Assert.fail("There is an horizontal scrollbar");
else if((sc_height + (h-height))&gt; h*4)
Assert.fail("Height is more than 4 times than "+h);
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/668/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=668&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2010/12/21/selenium-e-il-controllo-sulle-scroll-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>
	</item>
		<item>
		<title>Redmine e Coldfusion: syntax highlighting e icone</title>
		<link>http://kaosktrl.wordpress.com/2010/10/05/redmine-e-coldfusion-syntax-highlighting-e-icone/</link>
		<comments>http://kaosktrl.wordpress.com/2010/10/05/redmine-e-coldfusion-syntax-highlighting-e-icone/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 12:43:31 +0000</pubDate>
		<dc:creator>Emidio Stani</dc:creator>
				<category><![CDATA[applicazioni web]]></category>
		<category><![CDATA[Software Libero]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[icone]]></category>
		<category><![CDATA[redmine]]></category>
		<category><![CDATA[stile]]></category>

		<guid isPermaLink="false">http://kaosktrl.wordpress.com/?p=654</guid>
		<description><![CDATA[Ultimamente sto lavorando su un software scritto in Coldfusion e contemporaneamente sto usando Redmine come bug tracking tool. Redmine permette di vedere il repository Subversion e supporta anche il syntax highlighting per diversi linguaggi di programmazione, eccetto Coldfusion che, tra l&#8217;altro, segue la sintassi XML. Inoltre Redmine ha delle icone customizzate che permettono di distinguere [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=654&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ultimamente sto lavorando su un software scritto in Coldfusion e contemporaneamente sto usando Redmine come bug tracking tool.</p>
<p>Redmine permette di vedere il repository Subversion e supporta anche il syntax highlighting per diversi linguaggi di programmazione, eccetto Coldfusion che, tra l&#8217;altro, segue la sintassi XML.</p>
<p>Inoltre Redmine ha delle icone customizzate che permettono di distinguere i tipi di file come per PHP o XML.</p>
<p>Ho prima di tutto avuto un piccolo problema in quanto nella configurazione di Apache avevo messo Redmine come virtual host e, avendo incluso il modulo Jrun per Coldfusion, Redmine lasciava interpretare a Coldfusion il codice invece di mostralo, di conseguenza ho dovuto disabilitarlo per Redmine come evidenziato nella configurazione seguente:</p>
<pre># JRun Settings
LoadModule jrun_module /opt/coldfusion8/runtime/lib/wsconfig/1/mod_jrun22.so
&lt;IfModule mod_jrun22.c&gt;
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ignoresuffixmap false
    JRunConfig Serverstore /opt/coldfusion8/runtime/lib/wsconfig/1/jrunserver.store
    JRunConfig Bootstrap 127.0.0.1:51800
    #JRunConfig Errorurl url
    #JRunConfig ProxyRetryInterval 600
    #JRunConfig ConnectTimeout 15
    #JRunConfig RecvTimeout 300
    #JRunConfig SendTimeout 15
    AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
&lt;/IfModule&gt;
Listen 81
&lt;VirtualHost *:81&gt;
        ServerName redmine
        DocumentRoot /var/www/redmine/public
        ServerAdmin user@server.com
        LogLevel warn
        ErrorLog /var/log/apache2/redmine_error
        CustomLog /var/log/apache2/redmine_access combined

        <strong>RemoveHandler jrun-handler
        SetHandler default-handler</strong>
        &lt;Directory /var/www/redmine/public&gt;
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre>
<p>Ho poi associato le estensioni cfm e cfc alla sintassi per xml modificando il file <strong>file_type.rb</strong> che si trova in /redmine/plugins/coderay-0.7.6.227/lib/coderay/helpers/  modificando la parte della struttura <strong>TypeFromEx</strong>t e aggiungendo i campi:<br />
<code>'cfm' =&gt; :xml,<br />
'cfc' =&gt; :xml,</code><br />
In questa maniera i file coldfusion avranno la sintassi colorata come un file XML.</p>
<p>Per quanto riguarda le icone  dovete sapere che Redmine assegna degli stili ai tipi di file e come stile assegna infatti le icone.</p>
<p>Ho prima di tutto modificato il file <strong>mime_type.rb</strong> nella cartella /redmine/lib/redmine/, aggiungendo le 2 seguenti righe nella struttura MIME_TYPES:</p>
<pre>'application/x-coldfusion' =&gt; 'cfc',
'magnus-internal/cold-fusion' =&gt; 'cfm',</pre>
<p>e poi ho aggiunto i 2 stili con 2 icone (fatte da me su 2 piedi :-) ) nel file application.css in /redmine/public/stylesheets/, aggiungendo le seguenti righe (cercate la sezioen <strong>.icon-file</strong>):</p>
<pre>.icon-file.magnus-internal-cold-fusion { background-image: url(../images/files/cfm.png); }
.icon-file.application-x-coldfusion { background-image: url(../images/files/cfc.png); }</pre>
<p>Come avete notato Redmine trasforma il mime type in uno stile (convertendo / in &#8211; ) ogni volta che incontra un file indicato che poi potete plasmare.Le 2 icone da mettere nella cartella /redmine/public/images/files sono le seguenti: <a href="http://kaosktrl.files.wordpress.com/2010/10/cfc2.png"><img class="alignnone size-full wp-image-662" title="cfc" src="http://kaosktrl.files.wordpress.com/2010/10/cfc2.png?w=510" alt=""   /></a><a href="http://kaosktrl.files.wordpress.com/2010/10/cfm1.png"><img class="alignnone size-full wp-image-661" title="cfm" src="http://kaosktrl.files.wordpress.com/2010/10/cfm1.png?w=510" alt=""   /></a></p>
<p>Riavviate Apache non appena avete fatto le modifiche.</p>
<p>A presto !</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kaosktrl.wordpress.com/654/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kaosktrl.wordpress.com/654/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kaosktrl.wordpress.com/654/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kaosktrl.wordpress.com/654/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kaosktrl.wordpress.com/654/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kaosktrl.wordpress.com/654/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kaosktrl.wordpress.com/654/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kaosktrl.wordpress.com/654/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kaosktrl.wordpress.com&amp;blog=1930934&amp;post=654&amp;subd=kaosktrl&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kaosktrl.wordpress.com/2010/10/05/redmine-e-coldfusion-syntax-highlighting-e-icone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/198117fcd7a30f63eba2e694b88a0b1d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kaosktrl</media:title>
		</media:content>

		<media:content url="http://kaosktrl.files.wordpress.com/2010/10/cfc2.png" medium="image">
			<media:title type="html">cfc</media:title>
		</media:content>

		<media:content url="http://kaosktrl.files.wordpress.com/2010/10/cfm1.png" medium="image">
			<media:title type="html">cfm</media:title>
		</media:content>
	</item>
	</channel>
</rss>
