<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Web applications testing and Selenium blog by Deep Shift Labs</title>
	
	<link>http://www.deepshiftlabs.com/sel_blog</link>
	<description />
	<lastBuildDate>Thu, 25 Apr 2013 05:54:59 +0000</lastBuildDate>
	<language>en-us</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs" /><feedburner:info uri="webapplicationstestingandseleniumblogbydeepshiftlabs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Virtualizer toolbox – grow file system on Fedora on VMWare</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/UZxkVd8UXe4/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2925&amp;lang=en-us#comments</comments>
		<pubDate>Thu, 25 Apr 2013 05:54:59 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2925</guid>
		<description><![CDATA[In this post I would like to show how to increase file system space on installed Fedora VMWare instance. You might need it if you use VMWare (and we know many people do) to spin VMs for Selenium testing. In this particular case I use I installed Fedora and allocated 10GB but later I started [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I would like to show how to increase file system space on installed Fedora VMWare instance. You might need it if you use VMWare (and we know many people do) to spin VMs for Selenium testing.</p>
<p>In this particular case I use I installed Fedora and allocated 10GB but later I started using this VM for quite large databases and free space quickly disappeared.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2925code6'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p29256"><td class="code" id="p2925code6"><pre class="sh" style="font-family:monospace;"># df -k
Filesystem                    1K-blocks    Used Available Use% Mounted on
devtmpfs                         498132       0    498132   0% /dev
tmpfs                            508060       0    508060   0% /dev/shm
tmpfs                            508060     772    507288   1% /run
/dev/mapper/vg_fedora-lv_root   7641992 6590912    656228  91% /
tmpfs                            508060       0    508060   0% /sys/fs/cgroup
tmpfs                            508060       0    508060   0% /media
/dev/sda1                        487652   84379    377673  19% /boot</pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2925code7'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p29257"><td class="code" id="p2925code7"><pre class="sh" style="font-family:monospace;"># fdisk -l
&nbsp;
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e3a8c
&nbsp;
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    20971519     9972736   8e  Linux LVM
&nbsp;
&nbsp;
Disk /dev/mapper/vg_fedora-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders, total 4128768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
&nbsp;
&nbsp;
Disk /dev/mapper/vg_fedora-lv_root: 8086 MB, 8086618112 bytes
255 heads, 63 sectors/track, 983 cylinders, total 15794176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes</pre></td></tr></table></div>

<p>To grow disk space I went to VMWare console and added one more disk as shown below:<br />
&nbsp;<br />
&nbsp;<br />
<img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2013/04/adding_disk_vm_vmware.png" alt="Adding a disk to existing VMWare VM" title="Adding a disk to existing VMWare VM" /><br />
&nbsp;<br />
&nbsp;<br />
Now we can see a new disk in &#8220;fdisk -l&#8221; command output.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2925code8'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p29258"><td class="code" id="p2925code8"><pre class="sh" style="font-family:monospace;">Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes</pre></td></tr></table></div>

<p>Now we create partition sdb1 covering all new disk using &#8220;fdisk /dev/sdb&#8221;.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2925code9'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p29259"><td class="code" id="p2925code9"><pre class="sh" style="font-family:monospace;">Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
&nbsp;
Command (m for help): v
Remaining 2047 unallocated 512-byte sectors
&nbsp;
Command (m for help): w
The partition table has been altered!</pre></td></tr></table></div>

<p>Finally we just expand our volume group and file system:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2925code10'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p292510"><td class="code" id="p2925code10"><pre class="sh" style="font-family:monospace;">pvcreate /dev/sdb1
vgextend vg_fedora /dev/sdb1
lvextend -l +100%FREE /dev/mapper/vg_fedora-lv_root
resize2fs /dev/mapper/vg_fedora-lv_root</pre></td></tr></table></div>


<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/UZxkVd8UXe4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2925&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2925&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Functional monitoring at Yandex (translation)</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/rnCzdfG_atA/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2886&amp;lang=en-us#comments</comments>
		<pubDate>Tue, 19 Mar 2013 01:26:24 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2886</guid>
		<description><![CDATA[We recently launched functional monitoring support in Nerrvana and we think it will be interesting for our readers to learn why Yandex (taking fourth place behind Google, China&#8217;s Baidu and Yahoo, according to ComScore) uses functional monitoring. Post is translated with Mikhail Levin&#8217;s permission and its original (in Russian) is located on Habrahabr. Yandex also [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Functional monitoring at Yandex" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2013/03/functional_monitoring_Yandex.png" alt="Functional monitoring at Yandex" /></div>
<p>We recently launched functional monitoring support in Nerrvana and we think it will be interesting for our readers to learn why <a href="http://en.wikipedia.org/wiki/Yandex" target="_blank">Yandex</a> (taking fourth place behind Google, China&#8217;s Baidu and Yahoo, according to ComScore) uses functional monitoring.</p>
<p>Post is translated with <a href="http://ru.linkedin.com/pub/mikhail-levin/2b/19a/1ab" target="_blank">Mikhail Levin&#8217;s</a> permission and its original (in Russian) is located on <a href="http://habrahabr.ru/post/170797/" target="_blank">Habrahabr</a>. Yandex also shared technical details of their system at Yet Another Conference 2012 – video and slides are available <a href="http://events.yandex.ru/events/yac/2012/talks/360/" target="_blank">here</a> (but also in Russian).</p>
<p>Here is it:</p>
<p>&#8220;Do you monitor your services in production? Whose responsibility it is in your company?</p>
<p>When we think of monitoring; server side developers, system administrators and DBAs often come to mind. They must watch the data processing queues and free disk space for the availability of individual hosts and their load.</p>
<p>Such monitoring really gives a lot of information about the service, but does not always show how the service works for an end user. Therefore, in addition to system monitoring, we, at Yandex, have created a functional monitoring system, tracking the state of the service from final interfaces &#8211; through the way the app looks and works in a browser, or how it works at the API level.</p>
<p>What is functionality monitoring in our understanding? To understand this better, let&#8217;s look at how things progressed for us.<span id="more-2886"></span><br />
It all began, of course, with regression auto testing. These auto-tests were also launched after release to test the service under real conditions. The fact that running regression tests in production sometimes finds bugs puzzled us.</p>
<p><strong>What is it and why do we need it?</strong></p>
<p>Why are functional tests, written for regression testing, and completing with no failures in testing, often fail in production?</p>
<p>We have identified a few reasons:</p>
<p>• Differences between the configuration of the test and production environments.<br />
• Problems with the internal or external data suppliers.<br />
• Hardware problems affecting the functionality.<br />
• Problems that appear over time and/or at a specific workload.</p>
<p>If such tests can find problems, we decided that we need to try to running them regularly in production and monitor services’ status.<br />
Let&#8217;s take a closer look at the problems functional monitoring tests can help us with.</p>
<p><strong>Data providers</strong></p>
<p>A good example of a page which depends on the data providers is Yandex’s home page.<br />
Weather and News, Events and TV shows, even a photo of the day with search suggestions is the data from internal and external data providers.</p>
<p>For example, in <a href="http://en.wikipedia.org/wiki/Arkhangelsk" target="_blank">Arkhangelsk</a> block Posters once looked like this:<br />
&nbsp;<br />
&nbsp;<br />
<img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2013/03/yandex_arkhangelsk.png" alt="Yandex home page - Missing 'Portal' section in one region" title="Missing secion in one region" /><br />
&nbsp;<br />
&nbsp;<br />
While in <a href="http://en.wikipedia.org/wiki/Murmansk" target="_blank">Murmansk</a> everything looked alright.<br />
&nbsp;<br />
&nbsp;<br />
<img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2013/03/yandex_murmansk.png" alt="Yandex home page - no problem in 'Portal' section in another region" title="No problem in another region" /><br />
&nbsp;<br />
&nbsp;<br />
This is because the data supplier has not sent data for Arkhangelsk (or import has not updated on our side). Sometimes the problem is a one-off and, in some cases, KPIs can be formulated based on the percentage of available data and their freshness.</p>
<p><strong>Hardware problems</strong></p>
<p>In our services, fault tolerance and performance plays an important role. Therefore, the team created a service with a distributed architecture and load balancing mechanisms. Failure of the individual pieces of hardware, as a rule, does not affect the user, but major problems with the data centers or routing between them are sometimes visible in the end user interfaces.</p>
<p>To trace the connection between hardware problems and functionality is exactly the thing functional monitoring help us with to complement the system monitoring.</p>
<p>For example, in Yandex.Direct we had a situation when a slowly &#8220;dying&#8221; server caused a gradual degradation of service, making it unavailable for some regions. Functional monitoring in this case served as a trigger for an emergency investigation and detection of the root of the problem.</p>
<p>Another interesting example are drills held in our company. During the exercises, one of the data centers is intentionally disconnected to make sure that this does not affect the health of the services we provide. It is also to train the staff to minimize time to identify possible problems and fix them. Data center failure does not harm services due to their tolerance, but functional monitoring in this situation helps to monitor systems’ behavior.</p>
<p><strong>Service degradation over time</strong></p>
<p>The use of an applications in production sometimes creates unforeseen situations. Causes of the problem may be a combination of volume, duration and type of load, or, for example, the accumulation of system errors, not identified in the testing phase. Setup and configuration errors of the infrastructure can cause problems, leading to service degradation of the system, or its failure.</p>
<p>If such problems cannot be identified in the testing phase, it is necessary to quickly identify them when they occur in production. Here the system and functional monitoring can complement each other to find problems and report them.</p>
<p>So functional monitoring is functional auto-tests, &#8220;sharpened&#8221; to search for specific problems, and continuously run in production.</p>
<p><strong>What&#8217;s inside?</strong></p>
<p>There is a second component of the monitoring functionality – the way you process results.</p>
<p>The large flow of results that come from constantly running production tests must be aggregated and filtered. A system must promptly report any problems and at the same time minimise false positives. Also, there is the problem of integration of information from the functional monitoring into a single system performing health evaluation service which combines all monitoring results.</p>
<p>To avoid false positives, our system, built on the Apache Camel framework, allows the aggregation of several sequential results from one test into a single event. For example, you can configure filtering 3 out of 5, that will notify about a problem only if the test produced an error three times in five consecutive runs (you can specify, for example, filtering, 2 out of 2, or remove the filter &#8211; 1 out of 1). The frequency of test runs is also important in order for the filters you set to make sense.</p>
<p>Since we have many different services, our results are consumed by different departments: some failures are sent to testers, some reports contain data which managers are interested in, some results are sent and integrated into the overall monitoring system.</p>
<p><strong>Recipe</strong></p>
<p>The idea of functionality monitoring is very simple, and such monitoring can be very effective for your business.</p>
<p>To &#8216;cook&#8217; functional monitoring:</p>
<p>1. Assess which of your services fail in production and why.<br />
2. Write (or select from existing) auto-tests for this bit of functionality.<br />
3. Run these tests in production as often as you need and your monitoring system can cope with.<br />
4. Process and notify the results, compare with other sources of information looking after the same system.</p>
<p>PS: For quite a long time we wanted to find out to what extent the idea of functional monitoring is spread and how it is used in other companies. Some people confirm that they use it, some want to implement once they hear the idea and some think that such monitoring is unnecessary, given the system is monitored in a ‘classical’ way.</p>
<p>How do you monitor the status of your production services, what tools do you use and how they are assembled?&#8221;</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/rnCzdfG_atA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2886&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2886&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>New languages, browsers and Selenium version</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/4qhTSY2iYB8/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2867&amp;lang=en-us#comments</comments>
		<pubDate>Mon, 18 Feb 2013 10:39:32 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2867</guid>
		<description><![CDATA[Nerrvana now supports &#8211; PHP 5.4.1 (with PHPUnit 3.6.10), Java 1.7.0, Python 2.7.3 (with nose 1.1.2, Selenium 1.0.3), Perl 5.14.2 and Ruby 1.9.3p194. Selenium was updated to 2.29.0. We added support for Firefox 18, Chrome 24, Opera 12.14 on Windows XP and Windows 7 and Internet Explorer 10 on Windows 7 only. Here you can [...]]]></description>
			<content:encoded><![CDATA[<p><br />
Nerrvana now supports &#8211; PHP 5.4.1 (with PHPUnit 3.6.10), Java 1.7.0, Python 2.7.3 (with nose 1.1.2, Selenium 1.0.3), Perl 5.14.2 and Ruby 1.9.3p194.</p>
<p>Selenium was updated to 2.29.0. We added support for Firefox 18, Chrome 24, Opera 12.14 on Windows XP and Windows 7 and Internet Explorer 10 on Windows 7 only.</p>
<p><a href="http://blog.nerrvana.com/wp-content/uploads/2013/02/nerrvana_update_Feb_2013.png">Here</a> you can see a full list of platforms supported today by Nerrvana.<br />
</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/4qhTSY2iYB8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2867&amp;lang=en-us</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2867&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Nerrvana now supports Windows 7</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/xmF8uwC5ekc/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2844&amp;lang=en-us#comments</comments>
		<pubDate>Mon, 26 Nov 2012 23:28:58 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2844</guid>
		<description><![CDATA[We are glad to inform our clients about Windows 7 Selenium testing support in Nerrvana. A full list of available platforms is shown below (Nerrvana UI screenshot): Our plans &#8211; we moved from CentOS to Fedora which will allow us to expand a list of browsers on Linux. Adding support for launching Selenium tests written [...]]]></description>
			<content:encoded><![CDATA[<p><br />
We are glad to inform our clients about Windows 7 Selenium testing support in Nerrvana. A full list of available platforms is shown below (Nerrvana UI screenshot):</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;"  src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/windows_7_selenium_nerrvana.jpg" alt="Nerrvana now supports Windows 7" title="Nerrvana now supports Windows 7" /></p>
<p>Our plans &#8211; we moved from CentOS to Fedora which will allow us to expand a list of browsers on Linux. Adding support for launching Selenium tests written in Python and Ruby. Windows 8 is next.<br />
</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/xmF8uwC5ekc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2844&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2844&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Using Nerrvana – final notes</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/0dfRLfaCcOI/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2628&amp;lang=en-us#comments</comments>
		<pubDate>Thu, 22 Nov 2012 10:18:53 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2628</guid>
		<description><![CDATA[Testing the application with two database types &#8211; configuration files &#8216;as is&#8217; &#8211; future plans Part 1 &#8211; Using Nerrvana – our setup Part 2 &#8211; Using Nerrvana – SVN hooks to Jenkins Part 3 &#8211; Using Nerrvana – deployment &#038; Jenkins (part 1) Part 4 &#8211; Using Nerrvana – deployment &#038; Jenkins (part 2) [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Using Nerrvana - final notes" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/final_300.png" alt="Using Nerrvana - final notes" /></div>
<p>
<p style="text-align: center;"><em>Testing the application with two database types &#8211; configuration files &#8216;as is&#8217; &#8211; future plans</em></p>
<p>Part 1 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2251&#038;lang=en-us" target="_blank">Using Nerrvana – our setup</a><br />
Part 2 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2253&#038;lang=en-us" target="_blank">Using Nerrvana – SVN hooks to Jenkins</a><br />
Part 3 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us" target="_blank">Using Nerrvana – deployment &#038; Jenkins (part 1)</a><br />
Part 4 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2343&#038;lang=en-us" target="_blank">Using Nerrvana – deployment &#038; Jenkins (part 2)</a><br />
Part 5 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2257&#038;lang=en-us" target="_blank">Using Nerrvana &#8211; Jenkins setup for Selenium testing</a><br />
Part 6 &#8211; Using Nerrvana &#8211; final notes &#8211; this post</p>
<p>At this point, we’ve talked about how we test our application with Jenkins and Nerrvana. In our recount, some details have been omitted in order not to complicate the essence of the process.</p>
<p>It&#8217;s now time to show the real configuration files.<br />
<span id="more-2628"></span><br />
Here&#8217;s the script publish.sh. As you can see there is not one section, as shown earlier, but two. One deals with unpacking and setting up the Answers application on deployment host to work with MySQL, the other with PostgreSQL.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code25'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262825"><td class="code" id="p2628code25"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">WWW_MYSQL_DIR</span>=<span style="color: #ff0000;">'/var/www/answers/answers_mysql'</span>
<span style="color: #007800;">WWW_PGSQL_DIR</span>=<span style="color: #ff0000;">'/var/www/answers/answers_postgres'</span>
<span style="color: #007800;">DB_NAME</span>=<span style="color: #ff0000;">'answers'</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-Rf</span> <span style="color: #007800;">$WWW_PGSQL_DIR</span><span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #660033;">-o</span> prj.zip <span style="color: #660033;">-d</span> <span style="color: #007800;">$WWW_PGSQL_DIR</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$WWW_PGSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php.pgsql <span style="color: #007800;">$WWW_PGSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">777</span> <span style="color: #007800;">$WWW_PGSQL_DIR</span>
psql <span style="color: #660033;">-U</span> postgres <span style="color: #660033;">-f</span> <span style="color: #007800;">$WWW_PGSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>crt-pgsql.sql
psql <span style="color: #660033;">-U</span> postgres <span style="color: #660033;">-f</span> <span style="color: #007800;">$WWW_PGSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>postgres.sql <span style="color: #007800;">$DB_NAME</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-Rf</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #660033;">-o</span> prj.zip <span style="color: #660033;">-d</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php.mysql <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">777</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span>
mysql <span style="color: #660033;">-v</span> <span style="color: #660033;">-u</span> root  <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>crt-mysql.sql
mysql <span style="color: #660033;">-v</span> <span style="color: #660033;">-u</span> root  <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>mysql.sql <span style="color: #007800;">$DB_NAME</span></pre></td></tr></table></div>

<p>Here is our build.xml. In fact, the same as shown previously, but with similar actions to MySQL, for PostgreSQL (lines 13-14, 22-23 and 35-36).</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code26'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262826"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
</pre></td><td class="code" id="p2628code26"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;${env.JOB_NAME}&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">environment</span>=<span style="color: #ff0000;">&quot;env&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;tests&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/tests&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ci&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/ci&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;code&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/code&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;make_settings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/config/Settings.class.php.mysql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/mysql/settings-mysql.sed ${code}/config/Settings.class.template.php&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/config/Settings.class.php.pgsql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/pgsql/settings-pgsql.sed ${code}/config/Settings.class.template.php&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;make_sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/install/mysql.sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> </span>
<span style="color: #009900;">           <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/mysql/install-mysql.sed ${code}/install/mysql.sql&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/install/postgres.sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span></span>
<span style="color: #009900;">          <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/pgsql/install-pgsql.sed ${code}/install/postgres.sql&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;move_files&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;make_settings,make_sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Move authentication files to WAUT root --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/misc/login.php&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/login.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/misc/logout.php&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/logout.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Move MySQL db creation files to install folder --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span></span>
<span style="color: #009900;">         <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/config/mysql/crt-mysql.sql&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/install/crt-mysql.sql&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Move PGSQL db creation files to install folder --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/config/pgsql/crt-pgsql.sql&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/install/crt-pgsql.sql&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Move publish script to the workspace root, so it will be beside prj.zip --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/publish-over-ssh/publish.sh&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/publish.sh&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;save_commi</span>
&nbsp;
<span style="color: #009900;">build-mysql.xml в свою очередь внутри себя делает:</span>
&nbsp;
<span style="color: #009900;">t_info&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;move_files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- Temp fix for SVN client and SVN plugin incompatibility --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> </span>
<span style="color: #009900;">              <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 upgrade&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span>  <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/version.txt&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 log -r ${env.SVN_REVISION}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 log -r ${env.SVN_REVISION}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>          
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;save_commit_info&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;java</span></span>
<span style="color: #009900;">           <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;.&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">jar</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/scm-decorator.jar&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">fork</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/version.txt&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/java<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    	
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;zip&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Compress project files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jar</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/prj.zip&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/code&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">excludes</span>=<span style="color: #ff0000;">&quot;.svn&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;zip&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The Jenkins job configuration page contains one extra Nerrvana plugin step. The idea is to test the application with MySQL, and then with PostgreSQL. What are the differences between them?</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;"  src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/two_nerrvana_steps.png" /></p>
<p><strong>First</strong>, they use different Test Run names as well as executable files.</p>
<p><a href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/comp_1.png" target="_blank"><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/comp_1_690.png" /></a></p>
<p>The names should be different. Here are the test results after the build completion, when an application is tested in such a way. Names of Test Run’s clearly tell what databases we tested on.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/in_ui.jpg" /></p>
<p>I did not mention how tests know what URL to knock. The URL is set directly in the tests Ant file. We just haven’t touched this topic. There are two Ant files. Each of them sets a URL to the appropriate virtual host for Answers working with MySQL and PostgreSQL respectively.</p>
<p>That is, for example, xbuild-mysql.sh used to run tests for an application working with MySQL. Its contents is:</p>
<p><code>ant -f build-mysql.xml all  > build.log 2 >&#038; 1</code></p>
<p>build-mysql.xml does this:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code27'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262827"><td class="code" id="p2628code27"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${resources}/config-mysql.xml&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${output}/config.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>And finally in the config-mysql.xml file we see what tests will run and what URL will be used.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code28'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262828"><td class="code" id="p2628code28"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;suite-title&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Answers Test Suite<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;tests-disabled&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        com.deepshiftlabs.testui.AnswersStartyCo. TestLogin,
        com.deepshiftlabs.testui.AnswersStartyCo.TestAddRemoveQuestionByAnonymous,
        com.deepshiftlabs.testui.AnswersStartyCo.TestAddRemoveQuestionByUser,
        com.deepshiftlabs.testui.AnswersStartyCo.TestSearch,
        com.deepshiftlabs.testui.AnswersStartyCo.TestReply,
        com.deepshiftlabs.testui.AnswersStartyCo.TestFilterSort,
        com.deepshiftlabs.testui.AnswersStartyCo.TestTags,
        com.deepshiftlabs.testui.AnswersStartyCo.TestSmoke,
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;website&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>http://answers.dslabs.lan/mysql<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>You can see that all the tests are currently disabled except TestLogin.</p>
<p><strong>The second</strong> difference between the two Nerrvana plugin calls in our job is that in the first call to the plugin we synchronize tests with Nerrvana, and we skip it in the second one, since it&#8217;s the same code. This saves us some time. Also you can see that we switched off message analyzer in the first step of testing the application with MySQL, and enabled it in the second. Thus, we let tests complete on both hosts and then analyze messages and set build status.</p>
<p><a href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/comp_2.jpg" target="_blank"><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/comp_2_690.jpg" /></a></p>
<p>The report prepared by the plugin is based on messages received from both steps and contains two sections.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/report.jpg" /></p>
<p>Finally, under the spoiler you will find an example of a console log of this double plugin invocation execution (I shortened some verbose outputs).</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code29'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262829"><td class="code" id="p2628code29"><pre class="txt" style="font-family:monospace;">Started by an SCM change
Building in workspace /var/lib/jenkins/jobs/Answers/workspace
Cleaning local Directory .
Checking out http://192.168.3.97/repos/answers/trunk at revision 146
A         tests
----------- SOME LINES REMOVED ---------------------------------
A         ci/toolchain/build-toolchain.xml
At revision 146
[deployment] $ ant -file build.xml build
Buildfile: build.xml
&nbsp;
make_settings:
&nbsp;
make_sql:
&nbsp;
move_files:
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers/workspace/code
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers/workspace/code
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers/workspace/code/install
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers/workspace/code/install
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers/workspace
&nbsp;
save_commit_info:
     [exec] Upgraded '.'
----------- SOME LINES REMOVED ---------------------------------
     [exec] Upgraded 'ci/deployment/misc'
     [exec] Upgraded 'ci/toolchain'
     [exec] ------------------------------------------------------------------------
     [exec] r146 | igork | 2012-11-14 08:22:44 +0000 (Wed, 14 Nov 2012) | 1 line
     [exec] 
     [exec] &quot;Fixed&quot; robots.txt to initiate Jenkins build
     [exec] ------------------------------------------------------------------------
&nbsp;
svn:
&nbsp;
zip:
      [jar] Building jar: /var/lib/jenkins/jobs/Answers/workspace/prj.zip
&nbsp;
build:
&nbsp;
BUILD SUCCESSFUL
Total time: 0 seconds
SSH: Connecting from host [phpbb.deepshiftlabs.com]
SSH: Connecting with configuration [Answers test server] ...
SSH: EXEC: STDOUT/STDERR from command [chmod +x publish.sh
./publish.sh] ...
Archive:  prj.zip
   creating: /var/www/answers/answers_postgres/META-INF/
  inflating: /var/www/answers/answers_postgres/META-INF/MANIFEST.MF  
   creating: /var/www/answers/answers_postgres/config/
   creating: /var/www/answers/answers_postgres/include/
----------- SOME LINES REMOVED ---------------------------------
   creating: /var/www/answers/answers_postgres/utils/
  inflating: /var/www/answers/answers_postgres/ask.php  
----------- SOME LINES REMOVED ---------------------------------
  inflating: /var/www/answers/answers_postgres/utils/DBUtils.class.php  
  inflating: /var/www/answers/answers_postgres/utils/Utils.class.php  
  inflating: /var/www/answers/answers_postgres/utils/init.php  
DROP DATABASE
CREATE DATABASE
REVOKE
DROP ROLE
You are now connected to database &quot;answers&quot;.
psql:/var/www/answers/answers_postgres/install/crt-pgsql.sql:7: NOTICE:  table &quot;USERS_SOURCE_TABLE&quot; does not exist, skipping
DROP TABLE
psql:/var/www/answers/answers_postgres/install/crt-pgsql.sql:17: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index &quot;users_source_table_pkey&quot; for table &quot;users_source_table&quot;
CREATE TABLE
INSERT 0 1
INSERT 0 1
----------- SOME LINES REMOVED ---------------------------------
GRANT
Archive:  prj.zip
   creating: /var/www/answers/answers_mysql/META-INF/
  inflating: /var/www/answers/answers_mysql/META-INF/MANIFEST.MF  
   creating: /var/www/answers/answers_mysql/config/
   creating: /var/www/answers/answers_mysql/include/
----------- SOME LINES REMOVED ---------------------------------
   creating: /var/www/answers/answers_mysql/utils/
  inflating: /var/www/answers/answers_mysql/ask.php  
----------- SOME LINES REMOVED ---------------------------------
  inflating: /var/www/answers/answers_mysql/utils/DBUtils.class.php  
  inflating: /var/www/answers/answers_mysql/utils/Utils.class.php  
  inflating: /var/www/answers/answers_mysql/utils/init.php  
--------------
drop database answers
--------------
&nbsp;
--------------
create database answers
--------------
&nbsp;
--------------
DROP TABLE if exists USERS_SOURCE_TABLE
--------------
&nbsp;
--------------
CREATE TABLE `USERS_SOURCE_TABLE` (
  USERS_ID_COLUMN int(11),
  username varchar(50),
  USERS_DISPLAY_NAME_COLUMN varchar(50),
  USERS_EMAIL_COLUMN varchar(50),
  CONSTRAINT USERS_SOURCE_TABLE_pkey PRIMARY KEY (USERS_ID_COLUMN)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
--------------
&nbsp;
----------- SOME LINES REMOVED ---------------------------------
&nbsp;
--------------
CREATE VIEW `USERS_VIEW_NAME` AS
  SELECT
    `USERS_ID_COLUMN` AS `USERS_ID_COLUMN`,
    `USERS_DISPLAY_NAME_COLUMN` AS `USERS_DISPLAY_NAME_COLUMN`,
    `USERS_EMAIL_COLUMN` AS `USERS_EMAIL_COLUMN`
  FROM
    `USERS_SOURCE_TABLE`
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_users TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_answers TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_questions TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_tags TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_tags_to_quest TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_subscribers TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES_PREFIX_votes_a TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
--------------
GRANT SELECT ON USERS_VIEW_NAME TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
SSH: EXEC: completed after 1,003 ms
SSH: Disconnecting configuration [Answers test server] ...
SSH: Transferred 2 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
2012-11-14 08:22:49 
&nbsp;
---BEGIN PLUGIN EXECUTION---
2012-11-14 08:22:49 ---INITIALIZATION STARTED---
2012-11-14 08:22:49 
---BEGIN PLUGIN SETTINGS---
	Nerrvana HTTP address: https://api.nerrvana.com
	Nerrvana API key: 2bf7c81-a031f-1ad2-fd3a6-f59b9e0668e
	Secret key:  wctfFwelygx3tXS4TasrsOS4oXV7YadcPppvEnx55WG7qPk6jrAHjJi1TRoLlhrarIlabte4H9zWROXVkLnXto2LlVC47EXx91Uu
	Space ID: 4144
	Space: Answers
	Space path[FTPS folder]: Answers/_files
	Selenium nodes per platform: 1
	Test run name: Answers TRUNK MySQL
	Nerrvana platforms:
		Opera 12.02 (WinXP)
		Firefox 15.0 (WinXP)
	Executable file: xbuild-mysql.sh
	Nerrvana FTPS address: ftp.nerrvana.com
	Nerrvana FTPS user: demo154
	Nerrvana FTPS pass: dem0l54
	Workspace folder: ./tests
	Max execution time: 3600
	Poll period: 20
	Parse user messages mode[results analyzer]: OFF
-----END PLUGIN SETTINGS---
2012-11-14 08:22:49 -----INITIALIZATION COMPLETED---
&nbsp;
2012-11-14 08:22:49 Generated test run name: Answers TRUNK MySQL build #55
2012-11-14 08:22:49 Generated test run description:
Created by Nerrvana-Jenkins plugin
Revision: 146
Committer: igork
Date: 2012-11-14 08:22:44 +0000 (Wed, 14 Nov 2012)
&quot;Fixed&quot; robots.txt to initiate Jenkins build
&nbsp;
2012-11-14 08:22:49 ---BEGIN UPLOADING TESTS TO NERRVANA FTPS---
[workspace] $ lftp -f upload-build-55-1352863447229969289.ftp
2012-11-14 08:23:22 -----END UPLOADING TESTS TO NERRVANA FTPS
&nbsp;
2012-11-14 08:23:25 Creating and starting test run via Nerrvana HTTP API call...done.
2012-11-14 08:23:25 New test run ID#952.
2012-11-14 08:23:25 New execution ID#5769.
2012-11-14 08:23:25 ---BEGIN NERRVANA POLLING CYCLE (waiting for tests to complete)
2012-11-14 08:23:47 	Current execution status: run
&nbsp;
2012-11-14 08:24:09 	Current execution status: run
&nbsp;
----------- SOME LINES REMOVED ---------------------------------
&nbsp;
2012-11-14 08:26:42 	Current execution status: run
&nbsp;
2012-11-14 08:27:04 	Current execution status: ok
&nbsp;
2012-11-14 08:27:04 -----END NERRVANA POLLING CYCLE---
2012-11-14 08:27:04 Saving execution results into /var/lib/jenkins/jobs/Answers/builds/2012-11-14_08-22-45/results.xml...
2012-11-14 08:27:04 Done.
2012-11-14 08:27:04 
-----END PLUGIN EXECUTION---
&nbsp;
&nbsp;
2012-11-14 08:27:04 
&nbsp;
---BEGIN PLUGIN EXECUTION---
2012-11-14 08:27:04 ---INITIALIZATION STARTED---
2012-11-14 08:27:04 
---BEGIN PLUGIN SETTINGS---
	Nerrvana HTTP address: https://api.nerrvana.com
	Nerrvana API key: 2bf7c81-a031f-1ad2-fd3a6-f59b9e0668e
	Secret key:  wctfFwelygx3tXS4TasrsOS4oXV7YadcPppvEnx55WG7qPk6jrAHjJi1TRoLlhrarIlabte4H9zWROXVkLnXto2LlVC47EXx91Uu
	Space ID: 4144
	Space: Answers
	Space path[FTPS folder]: Answers/_files
	Selenium nodes per platform: 1
	Test run name: Answers TRUNK PostgreSQL
	Nerrvana platforms:
		Opera 12.02 (WinXP)
		Firefox 15.0 (WinXP)
	Executable file: xbuild-pgsql.sh
	Nerrvana FTPS address: ftp.nerrvana.com
	Nerrvana FTPS user: demo154
	Nerrvana FTPS pass: dem0l54
	Workspace folder: ./tests
	Max execution time: 3600
	Poll period: 20
	Parse user messages mode[results analyzer]: ON
	User message threshold: ERROR
-----END PLUGIN SETTINGS---
2012-11-14 08:27:04 -----INITIALIZATION COMPLETED---
&nbsp;
2012-11-14 08:27:04 Generated test run name: Answers TRUNK PostgreSQL build #55
2012-11-14 08:27:04 Generated test run description:
Created by Nerrvana-Jenkins plugin
Revision: 146
Committer: igork
Date: 2012-11-14 08:22:44 +0000 (Wed, 14 Nov 2012)
&quot;Fixed&quot; robots.txt to initiate Jenkins build
&nbsp;
2012-11-14 08:27:04 ---TESTS UPLOAD SKIPPED---
2012-11-14 08:27:06 Creating and starting test run via Nerrvana HTTP API call...done.
2012-11-14 08:27:06 New test run ID#953.
2012-11-14 08:27:06 New execution ID#5770.
2012-11-14 08:27:06 ---BEGIN NERRVANA POLLING CYCLE (waiting for tests to complete)
2012-11-14 08:27:28 	Current execution status: run
&nbsp;
2012-11-14 08:27:49 	Current execution status: run
&nbsp;
----------- SOME LINES REMOVED ---------------------------------
&nbsp;
2012-11-14 08:30:03 	Current execution status: run
&nbsp;
2012-11-14 08:30:26 	Current execution status: ok
&nbsp;
2012-11-14 08:30:26 -----END NERRVANA POLLING CYCLE---
2012-11-14 08:30:26 Saving execution results into /var/lib/jenkins/jobs/Answers/builds/2012-11-14_08-22-45/results.xml...
2012-11-14 08:30:26 Done.
2012-11-14 08:30:26 ---BEGIN TEST EXECUTION RESULTS---
2012-11-14 08:30:26 At least 11 message(s) from Nerrvana side reach(es) or exceed(s) threshold level (ERROR).
Message analyzer marks execution as failure.
2012-11-14 08:30:26 -----END TEST EXECUTION RESULTS---
2012-11-14 08:30:26 
-----END PLUGIN EXECUTION---
&nbsp;
&nbsp;
Build step 'Nerrvana plug-in' marked build as failure
Finished: FAILURE</pre></td></tr></table></div>

<p>As you can see, the Selenium testing process took 8 minutes (8:22:49 &#8211; 8:30:26). Everything that happens before it is the deployment and takes only a few seconds. In this case, we use two platforms, and Answers was tested with MySQL and PostgreSQL sequentially.</p>
<p>We have 8 tests in total and each does a lot of checks, testing a particular piece of Answers&#8217; functionality &#8211; search, tags, adding questions and answers, deleting and editing of questions and answers by the authors, moderators and administrators and so on. We can run tests in 4 threads with 2 tests in each thread. By using 4 threads and adding 4 more platforms we remain roughly within the same 8 minutes. By using 8 threads (one test per thread), we can add more platforms or reduce testing time.</p>
<p>Let&#8217;s look in more detail how these 8 minutes were spent in the logs that I have brought.</p>
<p>Initialization and the first Test Run name and description generation &#8211; 1 second.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code30'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262830"><td class="code" id="p2628code30"><pre class="txt" style="font-family:monospace;">2012-11-14 08:22:49 ---INITIALIZATION STARTED---
----------- SOME LINES REMOVED ---------------------------------
2012-11-14 08:22:49 -----INITIALIZATION COMPLETED---
2012-11-14 08:22:49 Generated test run name: Answers TRUNK MySQL build #55
2012-11-14 08:22:49 Generated test run description:
Created by Nerrvana-Jenkins plugin
Revision: 146
Committer: igork
Date: 2012-11-14 08:22:44 +0000 (Wed, 14 Nov 2012)
&quot;Fixed&quot; robots.txt to initiate Jenkins build</pre></td></tr></table></div>

<p>Syncing Selenium tests between Jenkins and Nerrvana &#8211; 33 seconds.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code31'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262831"><td class="code" id="p2628code31"><pre class="txt" style="font-family:monospace;">2012-11-14 08:22:49 ---BEGIN UPLOADING TESTS TO NERRVANA FTPS---
[workspace] $ lftp -f upload-build-55-1352863447229969289.ftp
2012-11-14 08:23:22 -----END UPLOADING TESTS TO NERRVANA FTPS</pre></td></tr></table></div>

<p>Creating the Test Runa in Nerrvana and launching it via API &#8211; 3 seconds.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code32'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262832"><td class="code" id="p2628code32"><pre class="txt" style="font-family:monospace;">2012-11-14 08:23:25 Creating and starting test run via Nerrvana HTTP API call...done.
2012-11-14 08:23:25 New test run ID#952.
2012-11-14 08:23:25 New execution ID#5769.</pre></td></tr></table></div>

<p>Running tests &#8211; 3 minutes 39 seconds.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code33'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262833"><td class="code" id="p2628code33"><pre class="txt" style="font-family:monospace;">2012-11-14 08:23:25 ---BEGIN NERRVANA POLLING CYCLE (waiting for tests to complete)
2012-11-14 08:23:47 	Current execution status: run
----------- SOME LINES REMOVED ---------------------------------
2012-11-14 08:27:04 	Current execution status: ok
2012-11-14 08:27:04 -----END NERRVANA POLLING CYCLE---
2012-11-14 08:27:04 Saving execution results into /var/lib/jenkins/jobs/Answers/builds/2012-11-14_08-22-45/results.xml...
2012-11-14 08:27:04 Done.
2012-11-14 08:27:04 
-----END PLUGIN EXECUTION---</pre></td></tr></table></div>

<p>The second Nerrvana plugin step is launched.</p>
<p>Initialization and the second Test Run name and description generation &#8211; 1 second.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code34'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262834"><td class="code" id="p2628code34"><pre class="txt" style="font-family:monospace;">---BEGIN PLUGIN EXECUTION---
2012-11-14 08:27:04 ---INITIALIZATION STARTED---
2012-11-14 08:27:04 
2012-11-14 08:27:04 -----INITIALIZATION COMPLETED---
2012-11-14 08:27:04 Generated test run name: Answers TRUNK PostgreSQL build #55
2012-11-14 08:27:04 Generated test run description:
Created by Nerrvana-Jenkins plugin
Revision: 146
Committer: igork
Date: 2012-11-14 08:22:44 +0000 (Wed, 14 Nov 2012)
&quot;Fixed&quot; robots.txt to initiate Jenkins build</pre></td></tr></table></div>

<p>We do not sync Selenium tests with Nerrvana as they were synced during the previous step.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code35'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262835"><td class="code" id="p2628code35"><pre class="txt" style="font-family:monospace;">2012-11-14 08:27:04 ---TESTS UPLOAD SKIPPED---</pre></td></tr></table></div>

<p>Creating the Test Run in Nerrvana and launching it via API &#8211; 2 seconds.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code36'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262836"><td class="code" id="p2628code36"><pre class="txt" style="font-family:monospace;">2012-11-14 08:27:06 Creating and starting test run via Nerrvana HTTP API call...done.
2012-11-14 08:27:06 New test run ID#953.
2012-11-14 08:27:06 New execution ID#5770.</pre></td></tr></table></div>

<p>Running tests &#8211; 3 minutes 20 seconds.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code37'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262837"><td class="code" id="p2628code37"><pre class="txt" style="font-family:monospace;">2012-11-14 08:27:06 ---BEGIN NERRVANA POLLING CYCLE (waiting for tests to complete)
2012-11-14 08:27:28 	Current execution status: run
----------- SOME LINES REMOVED ---------------------------------
2012-11-14 08:30:26 	Current execution status: ok
2012-11-14 08:30:26 -----END NERRVANA POLLING CYCLE---</pre></td></tr></table></div>

<p>Results parsing and report preparation &#8211; 1 second.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2628code38'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p262838"><td class="code" id="p2628code38"><pre class="txt" style="font-family:monospace;">2012-11-14 08:30:26 Saving execution results into /var/lib/jenkins/jobs/Answers/builds/2012-11-14_08-22-45/results.xml...
2012-11-14 08:30:26 Done.
2012-11-14 08:30:26 ---BEGIN TEST EXECUTION RESULTS---
2012-11-14 08:30:26 At least 11 message(s) from Nerrvana side reach(es) or exceed(s) threshold level (ERROR).
Message analyzer marks execution as failure.
2012-11-14 08:30:26 -----END TEST EXECUTION RESULTS---
2012-11-14 08:30:26</pre></td></tr></table></div>

<p>Thus, we see that most of the time was spent on testing. Everything else, including the synchronization of tests between Jenkins and Nerrvana (remember that LFTP uses the &#8216;mirror&#8217; command and only updates changed files) is about 45 seconds. These figures are for the configuration shown in the very first <a href="http://www.deepshiftlabs.com/sel_blog/?p=2251&#038;lang=en-us" target="_blank">post</a> &#8211; deployment and jenkins hosts are on my home network as VMWare virtual machines, I&#8217;m connected to the Internet with ADSL2 +, I am in Sydney and Nerrvana is in the USA. No super speed here or close physical proximity.</p>
<p>How to reduce the test execution time twofold in our case?</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/c1.png" /></p>
<p>We can just test our application on MySQL and PostgreSQL not sequentially, but simultaneously. But in this case, as shown in the image below in our Jenkins Dashboard we will see not one job, but three (one upstream and two downstream)</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/c2.png" /></p>
<p>or four (two upstream and two downstream).</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/c3.png" /></p>
<p>Moreover, a report produced by the Nerrvana plugin and shown in the <a href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/report.jpg" target="_blank">picture above</a>, will be located inside two different jobs, that will complicate and slow down its analysis for us. Another hitch will be the timing of tests. As the two Nerrvana plugins will be running in parallel, they will both have to do synchronization. It will add erxtra33 seconds, but will reduce the test time in half. That is, we get the total time around 4.5 minutes.</p>
<p>We run tests in parallel using our framework which utilizes TestNG in a single job, as you may have guessed. However when we will implement reports aggregation in our framework (more about it below) we possibly move on to parallel testing with different databases. We most likely will add support for MS SQL in Answers soon and will have to test on three different database types. In this case, we can forget about the short report Nerrvana plugin creates in Jenkins, and use a single aggregate report from our framework.</p>
<p>The main disadvantage now is the need to view as many reports as platforms we tested our application on. Nerrvana plugin reports are already aggregated but they give very basic information. Sometimes it is enough, and sometimes it’s not. Therefore, we will improve our framework to generate the results in XML format. This information will be uploaded back to Jenkins and then our new generator/aggregator will use XMLs to create a single report. We have described <a href="http://www.deepshiftlabs.com/sel_blog/?p=1840&#038;lang=en-us" target="_blank">previously</a> how such reports will look. We are happy to share the details of the implementation when we get to it.</p>
<p>Schematically, it will work like this:</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/c4.png" /></p>
<p>Even if you do not need to test different settings as we do with different databases and multiple Nerrvana plugin steps, you will still be able to aggregate all platforms into one report inside a single build by adding extra an aggregation step after Selenium testing.</p>
<p>Well, the last thing I would like to do, is to get the web server’s logs and PHP error logs (we use PHP) and integrate them to our Selenium reports. Then it would be easy to move from errors in the logs to a place in Selenium report and vice versa. Also we found this <a href="http://stackoverflow.com/questions/8383016/php-code-coverage-and-selenium" target="_blank">article</a> and want to try to get code coverage data after Selenium testing to see which areas were not touched by tests. If it works it will make sense to integrate this info into our reports.</p>
<p>This ends the story of web applications Selenium testing in Deep Shift Labs with Jenkins and Nerrvana. We hope that you find it useful.</p>
<p>Our next blog story will be about exporting Selenium test results to <a href="http://en.wikipedia.org/wiki/HP_Quality_Center" target="_blank">HP Quality Center</a> (HP QC) using the Bumblebee web service from <a href="http://www.agiletestware.com/" target="_blank">Agiletestware</a>.</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/0dfRLfaCcOI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2628&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2628&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Using Nerrvana – Jenkins setup for Selenium testing</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/ALm0TOZpnBQ/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2257&amp;lang=en-us#comments</comments>
		<pubDate>Fri, 16 Nov 2012 01:26:54 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2257</guid>
		<description><![CDATA[Creating the Nerrvana plugin configurationfile &#8211; walking through it &#8211; runningour tests &#8211; checking test results Part 1 &#8211; Using Nerrvana – our setup Part 2 &#8211; Using Nerrvana – SVN hooks to Jenkins Part 3 &#8211; Using Nerrvana – deployment &#038; Jenkins (part 1) Part 4 &#8211; Using Nerrvana – deployment &#038; Jenkins (part [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Using Nerrvana - Jenkins setup for Selenium testing" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/08/testing_300.png" alt="Using Nerrvana - Jenkins setup for Selenium testing" /></div>
<p>
<p style="text-align: center;"><em>Creating the Nerrvana plugin configuration</br>file &#8211; walking through it &#8211; running</br>our tests &#8211; checking test results</em></p>
<p>Part 1 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2251&#038;lang=en-us" target="_blank">Using Nerrvana – our setup</a><br />
Part 2 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2253&#038;lang=en-us" target="_blank">Using Nerrvana – SVN hooks to Jenkins</a><br />
Part 3 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us" target="_blank">Using Nerrvana – deployment &#038; Jenkins (part 1)</a><br />
Part 4 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2343&#038;lang=en-us" target="_blank">Using Nerrvana – deployment &#038; Jenkins (part 2)</a><br />
Part 5 &#8211; Using Nerrvana &#8211; Jenkins setup for Selenium testing &#8211; this post</p>
<p>In the <a href="http://www.deepshiftlabs.com/sel_blog/?p=2343&#038;lang=en-us">previous</a> post, we have automated our web application deployment process and are now ready to continue improving our build and include Selenium testing into it. At this point Jenkins is able to react to the commit, prepare and install our application on the deployment host. We also learned how to extract commit information from SVN, parse and save it to version.txt file.</p>
<p>Today we will launch Selenium tests in Nerrvana with our Jenkins plugin. The Nerrvana plugin is available at http://your_jenkins_instance/pluginManager/available. The plugin uses LFTP to synchronize tests between Jenkins and Nerrvana. So, please install it (yum install lftp) on the same server running Jenkins.<span id="more-2257"></span><br />
We recommend that you run your tests from Nerrvana’s UI and verify that Nerrvana can run them before proceeding. The process for running tests manually is described on the &#8216;<a href="http://www.nerrvana.com/docs/test-runs" target="_blank">Get Started</a>&#8216; page.</p>
<p>To create a configuration file for the Nerrvana plugin, go to the page &#8216;Add new test run&#8217; or &#8216;Edit test run&#8217;. As shown below, select the desired Space (A), enter the Test Run name (B), and select an executable file (C). Note: Try not to use a long name for the test run since the plugin will add a Jenkins build number to it. We recommend that you leave the Description field (D) blank and allow the plugin to add commit information to it dynamically. Select desired platforms (E) and, if your tests can run in parallel, the number of nodes per platform (F). Nerrvana is now able to create a configuration file (G), where you will need to set a few parameters before using it in Jenkins. Please save the file.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/jenkins_doc_generate.png" alt="Generate Nerrvana Jenkins config in UI" title="Generate Nerrvana Jenkins config in UI" /></p>
<p>Section &#8216;api-params&#8217; contains your Nerrvana API access keys. They are added automatically when you generate the configuration file. They are also available on the Settings page, where you can change them, if necessary.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code57'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225757"><td class="code" id="p2257code57"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;api-params<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Address of the Nerrvana gateway. --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gateway<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>https://api.nerrvana.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gateway<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- User-specific key which identifies user on Nerrvana side. --&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Available as an 'API public key' on Settings page </span>
<span style="color: #808080; font-style: italic;">            (https://cloud.nerrvana.com/user/editAccount) </span>
<span style="color: #808080; font-style: italic;">            in Nerrvana. --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;apikey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>a6c171d-20eb5-61e3-60991-8a1e523ce<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/apikey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- This key is used by the Nerrvana plug-in to create a checksum of API </span>
<span style="color: #808080; font-style: italic;">            call parameters to ensure their consistency. --&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Available as an 'API private key' on Settings page in Nerrvana. --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;secretkey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>z3rCWlLdAP35eCCYAmQZ2kPw9X0LByrcc3XGh<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/secretkey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/api-params<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Name of the Test Run is in the elemnt &#8216;test-run-name&#8217;. The plugin will add the Jenkins build number, thus generating a new name for each new Test Run.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code58'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225758"><td class="code" id="p2257code58"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Parameters related to Nerrvana-driven Selenium tests. --&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Test Run name template, Jenkins build number will be added to the </span>
<span style="color: #808080; font-style: italic;">        end automatically. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test-run-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Answers TRUNK MySQL build #51<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/test-run-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The Test Run description is defined by elemnt &#8216;test-run-descr&#8217;. You can leave it blank or add, for example, ‘Generated by Jenkins plugin’.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code59'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225759"><td class="code" id="p2257code59"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Test Run description. All Test Runs created by this Jenkins build </span>
<span style="color: #808080; font-style: italic;">        step will have this description. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test-run-descr<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/test-run-descr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Comments for the element &#8216;test-run-descr-file&#8217; explain how to use a file to add a description dynamically with each job build. We will change the file name to version.txt, because such a file is generated in the deployment part of our build. You can create your own file and include any information you want.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code60'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225760"><td class="code" id="p2257code60"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Content of this file, if not empty, will be added to a description,</span>
<span style="color: #808080; font-style: italic;">        defined by ‘test-run-descr’ parameter above.</span>
<span style="color: #808080; font-style: italic;">        File path is relative to the Jenkins job workspace.</span>
<span style="color: #808080; font-style: italic;">        During deployment phase you can extract revision number, commiter name and a</span>
<span style="color: #808080; font-style: italic;">        commit message from your version control system, put them into this file and</span>
<span style="color: #808080; font-style: italic;">        use them as a description.</span>
<span style="color: #808080; font-style: italic;">        You can extract and parse SVN information into info.txt file with our little</span>
<span style="color: #808080; font-style: italic;">        tool - https://github.com/deepshiftlabs/nerrvana-plugin-for-jenkins-ci</span>
<span style="color: #808080; font-style: italic;">        You can read how we do it with SVN in our blog. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test-run-descr-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>version.txt<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/test-run-descr-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Here&#8217;s how a Test Run created by the plugin will look if:</p>
<p>- Test-run-name – &#8216;Answers TRUNK MySQL&#8217;</p>
<p>- Test-run-descr – &#8216;Created by Nerrvana-Jenkins job&#8217;</p>
<p>- The contents of &#8216;test-run-descr-file&#8217;:</p>
<p><em>Revision: 142<br />
Commiter: igork<br />
Date: 2012-10-17 07:39:20 +0000 (Wed, 17 Oct 2012)</em></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/name_description.png" alt="Dynamic description" title="Dynamic description" /></p>
<p>The Jenkins build number (&#8216;build # 51&#8242;) was added to the Test Run name. The description is a combination of &#8216;test-run-descr&#8217; and the content of a file specified by the content &#8216;test-run-descr-file&#8217; parameter.</p>
<p>&#8216;executable-file&#8217; parameter defines an executable file we selected – &#8216;xbuild-mysql.sh&#8217;.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code61'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225761"><td class="code" id="p2257code61"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Which executable file Nerrvana should use to start tests. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executable-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>xbuild-mysql.sh<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executable-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>This file should be able to launch your tests. For example:</p>
<p><code>ant -f build-mysql.xml all  > build.log 2 >&#038; 1</code></p>
<p>Here, under the spoiler, you can see our build-mysql.xml, but I will not talk about it today. If you have any questions &#8211; we are happy to answer.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code62'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225762"><td class="code" id="p2257code62"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dslabs-test&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #808080; font-style: italic;">&lt;!-- BEGIN versions --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;title&quot;</span>          <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Tests of http://answers.starty.co&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;version&quot;</span>          <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;0.02.000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #808080; font-style: italic;">&lt;!-- END versions --&gt;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- BEGIN build properties --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build.compiler&quot;</span>       <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;javac1.6&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;libdir&quot;</span>               <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/lib&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;output&quot;</span>               <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/output&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sources&quot;</span>              <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/src&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;resources&quot;</span>            <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/res&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dist&quot;</span>                 <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/dist&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;logdir&quot;</span>               <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/log&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;bindir&quot;</span>               <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/bin&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;logs&quot;</span>            	<span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/logs&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test.failonerror&quot;</span>     <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;compile.debug&quot;</span>        <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;compile.debuglevel&quot;</span>   <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;lines,vars,source&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;compile.deprecation&quot;</span>  <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #808080; font-style: italic;">&lt;!-- END build properties --&gt;</span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">resource</span>=<span style="color: #ff0000;">&quot;testngtasks&quot;</span> <span style="color: #000066;">classpath</span>=<span style="color: #ff0000;">&quot;${libdir}/testng-5.8-jdk15.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${libdir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${logs}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;prepare&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${logs}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- !!!--&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${logs}/html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${logs}/html/js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${resources}/js&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${logs}/html/img&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${resources}/img&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${logs}/html/css&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${resources}/css&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${resources}/log4j.xml&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${resources}/testng.xml&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${resources}/config-mysql.xml&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${output}/config.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;bld&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;prepare&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;javac</span></span>
<span style="color: #009900;">            <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${sources}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">excludes</span>=<span style="color: #ff0000;">&quot;&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF8&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">debug</span>=<span style="color: #ff0000;">&quot;${compile.debug}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">deprecation</span>=<span style="color: #ff0000;">&quot;${compile.deprecation}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">optimize</span>=<span style="color: #ff0000;">&quot;${compile.optimize}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">debuglevel</span>=<span style="color: #ff0000;">&quot;${compile.debuglevel}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;classpath&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/javac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tests_classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${libdir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;run&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;${title}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;java</span> <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;tests_classpath&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">fork</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${output}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;org.testng.TestNG&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;-d&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${logs}/testng_reports&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;testng.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/java<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #808080; font-style: italic;">&lt;!--delete dir=&quot;${output}&quot;/--&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- build all --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;bld,run&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Clean, build, and deploy project&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Section &#8216;platforms&#8217; lists the platforms on which the tests will run. All supported platforms are included, with the selected ones uncommented.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code63'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225763"><td class="code" id="p2257code63"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- List of platforms to run tests against for this config. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;platforms<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- List of available platforms. Uncomment to use. --&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;centos_58_firefox_36&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Firefox 3.6 (CentOS)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_firefox_110&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Firefox 11.0 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_firefox_150&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Firefox 15.0 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_firefox_36&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Firefox 3.6 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_ie_8&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;IE 8 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_opera_1162&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Opera 11.62 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_opera_1202&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Opera 12.02 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_safari_515&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Safari 5.1.5 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
        <span style="color: #808080; font-style: italic;">&lt;!--platform&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;code&gt;winxp_sp3_safari_517&lt;/code&gt;</span>
<span style="color: #808080; font-style: italic;">            &lt;name&gt;Safari 5.1.7 (WinXP)&lt;/name&gt;</span>
<span style="color: #808080; font-style: italic;">        &lt;/platform--&gt;</span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;platform<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;code<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>winxp_sp3_chrome_2001132<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/code<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Chrome 20.0.1132 (WinXP)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/platform<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;platform<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;code<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>winxp_sp3_chrome_2101180<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/code<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Chrome 21.0.1180 (WinXP)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/platform<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/platforms<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Next element &#8216;nodes-count&#8217; allows you to configure the plugin to run tests in parallel. More information about parallel execution is available <a href="http://www.nerrvana.com/docs/running-parallel-tests" target="_blank">here</a>. If your tests will not work in parallel, change the number of nodes here to 1.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code64'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225764"><td class="code" id="p2257code64"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- How many Selenium nodes should be used for each platform. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nodes-count<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nodes-count<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The next parameter &#8216;folder-with-tests&#8217; points to the location of the tests in the Jenkins workspace.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code65'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225765"><td class="code" id="p2257code65"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Parameters related to the transfer of the tests from Jenkins </span>
<span style="color: #808080; font-style: italic;">        to Nerrvana. --&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Folder in the workspace of Jenkins job where Selenium tests will be </span>
<span style="color: #808080; font-style: italic;">        located. It is assumed that the SCM build step, which always occurs </span>
<span style="color: #808080; font-style: italic;">        BEFORE other steps, will put tests there. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder-with-tests<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder-with-tests<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Our Selenium tests are in the folder <a href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/08/project_structure_for_continuous_integration.gif" target="_blank">&#8216;tests&#8217;</a> in the same repository. The structure of the project was shown in the post <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us" target="_blank">&#8220;Using Nerrvana &#8211; deployment &#038; Jenkins (part 1)&#8221;</a>. As our tests are in the &#8216;tests&#8217; folder, we set it this way:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code66'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225766"><td class="code" id="p2257code66"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder-with-tests<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>./tests<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder-with-tests<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Space ID, Space name and FTPS folder were specified previously during configuration file generation and should be left as they are in the element &#8216;space&#8217;.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code67'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225767"><td class="code" id="p2257code67"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Nerrvana space previously created by you through the Nerrvana UI. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;space<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4144<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Answers<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ftp-path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Answers/_files<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ftp-path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/space<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Section &#8216;ftp&#8217; defines FTPS access credentials. It is necessary to add the password to your Nerrvana account.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code68'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225768"><td class="code" id="p2257code68"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Address and credentials of the Nerrvana FTPS connection. Note that </span>
<span style="color: #808080; font-style: italic;">        a system running Jenkins should have LFTP application installed. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ftp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ftp.nerrvana.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/server<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Your username --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>demo123<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Replace this value with your password!! --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>[p a s s w o r d]<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ftp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The parameter &#8216;skip-tests-sync&#8217; allows you to speed up testing by skipping test synchronization when the Nerrvana plugin is called multiple times in a single build. Now we&#8217;ll leave the default value &#8211; false, as we call the plugin once. In the next post I will show how it is used by us when we call it twice to test our Answers application with MySQL, and then with PostgreSQL.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code69'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225769"><td class="code" id="p2257code69"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- You can skip test sync when you call the Nerrvana plugin many times </span>
<span style="color: #808080; font-style: italic;">        in a single job and tests were synced in a previous step. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;skip-tests-sync<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/skip-tests-sync<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The parameters shown below are relevant only if you are using <a href="http://www.nerrvana.com/docs/using-messages" target="_blank">messages</a>, which Nerrvana can analyze. There is a detailed description of these parameters in the plugin configuration file.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code70'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225770"><td class="code" id="p2257code70"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Job status will be set to FAILED if test execution in Nerrvana is </span>
<span style="color: #808080; font-style: italic;">        unsuccessful (tests did not sync, executable file did not start your </span>
<span style="color: #808080; font-style: italic;">        tests, etc).</span>
<span style="color: #808080; font-style: italic;">            If tests were executed successfully, you have a few options:</span>
<span style="color: #808080; font-style: italic;">        1. Mark build as successful in Jenkins and analyse generated reports </span>
<span style="color: #808080; font-style: italic;">        for problems your tests discovered.</span>
<span style="color: #808080; font-style: italic;">        2. If you want to mark a build as FAILED based on errors your tests </span>
<span style="color: #808080; font-style: italic;">        found, you can:</span>
<span style="color: #808080; font-style: italic;">            (a) Add additional step, load results, parse them to analyse errors </span>
<span style="color: #808080; font-style: italic;">            your tests discovered, and mark build as FAILED based on it. Keep </span>
<span style="color: #808080; font-style: italic;">            this parameter as 'false' in this case.</span>
<span style="color: #808080; font-style: italic;">            (b) Use Nerrvana &quot;Messages&quot; and let the Nerrvana plugin analyse </span>
<span style="color: #808080; font-style: italic;">            results, and change build status to FAILED based on it. Keep this </span>
<span style="color: #808080; font-style: italic;">            parameter as 'true' in this case and use additional parameter </span>
<span style="color: #808080; font-style: italic;">            'message-threshold' to add additional logic.</span>
<span style="color: #808080; font-style: italic;">            If you use messages and invoke the Nerrvana plug-in several times </span>
<span style="color: #808080; font-style: italic;">            in the same build, keep this option as 'false' for all invocations </span>
<span style="color: #808080; font-style: italic;">            except the last one to let the build complete all tests and analyse </span>
<span style="color: #808080; font-style: italic;">            errors at the very end. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;use-messages-to-set-build-status<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/use-messages-to-set-build-status<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Defines the level at which a FAILED status is generated. If this </span>
<span style="color: #808080; font-style: italic;">        value is set to 'WARN', for example, and your tests generate one or more </span>
<span style="color: #808080; font-style: italic;">        'WARN' or higher severity messages (ERROR or FATAL), Nerrvana execution </span>
<span style="color: #808080; font-style: italic;">        status, and Jenkins build, will be FAILED. For the full list of levels, </span>
<span style="color: #808080; font-style: italic;">        visit http://www.nerrvana.com/docs/using-messages page. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message-threshold<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ERROR<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message-threshold<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>As our tests generate messages, which Nerrvana can analyze, we set the parameters as follows:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code71'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225771"><td class="code" id="p2257code71"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;use-messages-to-set-build-status<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/use-messages-to-set-build-status<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message-threshold<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ERROR<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message-threshold<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>In this case, the plugin will not only receive and store messages polling Nerrvana while tests are running, but also analyze whether there are messages with the level ERROR or higher (FATAL). If any are found, the build status will be set as FAILED in Jenkins.</p>
<p>If you do not use Nerrvana messages and still want to set the status of the Jenkins build based on test results (rather than whether the run was completed successfully), you can add an extra step in your build after the Nerrvana plugin. Get test results from Nerrvana via FTPS, analyze them, and change the status of the Jenkins build.</p>
<p>The parameter &#8216;max-execution-time&#8217; will stop tests if, for example, they go into an infinite loop. If you run tests using the Nerrvana UI, you can set the real value with some extra time added.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code72'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225772"><td class="code" id="p2257code72"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Maximum execution time (in seconds). Defines how long the Nerrvana </span>
<span style="color: #808080; font-style: italic;">        plug-in will wait for tests to complete. Start by setting to a large </span>
<span style="color: #808080; font-style: italic;">        value and adjust accordingly after a few runs.--&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;max-execution-time<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3600<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/max-execution-time<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The last parameter &#8216;poll-period&#8217; specifies how often the Nerrvana plugin will poll API about the status of test execution.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code73'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225773"><td class="code" id="p2257code73"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- How often the Nerrvana plug-in will update test execution status </span>
<span style="color: #808080; font-style: italic;">        from Nerrvana (in seconds). --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;poll-period<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>20<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/poll-period<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The flowchart of the plugin, especially in the part relating to polling and setting the build&#8217;s status, depending on these parameters, shown in greater detail in the <a href="http://www.nerrvana.com/docs/jenkins-plugin" target="_blank">documentation</a>.</p>
<p>Now we only need to add a step to our build &#8230;</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/nerrvana_step.png" alt="Add Nerrvana plugin step" title="Add Nerrvana plugin step" /></p>
<p>&#8230; and copy the contents of the configuration file into the plugin configuration window.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/nerrvana_step_2.png" alt="Add Nerrvana plugin step - just copy/paste" title="Add Nerrvana plugin step - just copy/paste" /></p>
<p>You can save changes in a Jenkins job, run the build, and watch your tests running in the Nerrvana cloud. First, I launched a single test on a single platform. In the UI you can see how the plugin creates a Test Run and it is immediately started.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/2012-10-17_182343.png" alt="Nerrvana Test Run started by Jenkins" title="Nerrvana Test Run started by Jenkins" /></p>
<p>The Jenkins build number was added to the Test Run name and the description contains information we specified in the plugin configuration with version.txt file content, which was previously parsed by our decorator. We can see that the test has been completed successfully with no errors found – we cannot see any messages.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/tr_one_test_one_platform.png" alt="Nerrvana Test Run completed" title="Nerrvana Test Run completed" /></p>
<p>From Nerrvana we can open (arrow in the picture above) the report our test generated.</p>
<p><a class="zoom" href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/report.png" target="_blank"><img class="aligncenter"  src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/report_700.png" style="-ms-interpolation-mode: bicubic;"  title="Our Selenium report for one test" alt="Our Selenium report for one test" /></a></p>
<p>In the first launch, I turned off all the tests, except one &#8211; a login test in order to quickly make sure that everything works. Now I&#8217;ll enable all the tests, commit and Jenkins will create and start a new Test Run. Oh, and I will also add one more platform to it.</p>
<p>Below, under the spoiler, is an example of a Jenkins build console log, which continues the console log we publicised in a <a href=http://www.deepshiftlabs.com/sel_blog/?p=2343&#038;lang=en-us" target="_blank">previous post</a> about deployment. My comments follow it.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2257code74'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p225774"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
</pre></td><td class="code" id="p2257code74"><pre class="txt" style="font-family:monospace;">---BEGIN PLUGIN EXECUTION---
2012-10-17 07:39:24 ---INITIALIZATION STARTED---
2012-10-17 07:39:24
---BEGIN PLUGIN SETTINGS---
   Nerrvana HTTP address: https://api.nerrvana.com
   Nerrvana API key: a6c171d-20eb5-61e3-60991-8a1e523ce
   Secret key: z3rCWlLdAP35eCCYAmQZ2kPw9X0LByrcc
   Space ID: 4144
   Space: Answers
   Space path[FTPS folder]: Answers/_files
   Selenium nodes per platform: 1
   Test run name: Answers TRUNK
   Nerrvana platforms:
      Opera 12.02 (WinXP)
      Firefox 15.0 (WinXP)
   Executable file: xbuild-mysql.sh
   Nerrvana FTPS address: ftp.nerrvana.com
   Nerrvana FTPS user: demo123
   Nerrvana FTPS pass: dem0I23
   Workspace folder: ./tests
   Max execution time: 3600
   Poll period: 20
   Parse user messages mode[results analyzer]: ON
   User message threshold: ERROR
-----END PLUGIN SETTINGS---
2012-10-17 07:39:24 -----INITIALIZATION COMPLETED---
&nbsp;
2012-10-17 07:39:24 Generated test run name: Answers TRUNK MySQL build #51
2012-10-17 07:39:24 Generated test run description:
Created by Nerrvana-Jenkins plugin
Revision: 142
Committer: igork
Date: 2012-10-17 07:39:20 +0000 (Wed, 17 Oct 2012)
Launching all tests on two platforms
&nbsp;
2012-10-17 07:39:24 ---BEGIN UPLOADING TESTS TO NERRVANA FTPS---
[workspace] $ lftp -f upload-build-51-8414449724631519802.ftp
&nbsp;
2012-10-17 07:40:16 -----END UPLOADING TESTS TO NERRVANA FTPS
&nbsp;
2012-10-17 07:40:18 Creating and starting test run 
                    via Nerrvana HTTP API call...done.
2012-10-17 07:40:18 New test run ID#884.
2012-10-17 07:40:18 New execution ID#5486.
2012-10-17 07:40:18 ---BEGIN NERRVANA POLLING CYCLE 
                       (waiting for tests to complete)
&nbsp;
2012-10-17 07:40:40    Current execution status: run
&nbsp;
2012-10-17 07:41:02    Current execution status: run
&nbsp;
------ Some оutput removed ---------------------------------
&nbsp;
2012-10-17 07:44:17    Current execution status: run
&nbsp;
2012-10-17 07:44:38    Current execution status: ok
&nbsp;
2012-10-17 07:44:38 -----END NERRVANA POLLING CYCLE---
2012-10-17 07:44:38 Saving execution results into results.xml...
2012-10-17 07:44:38 Done.
2012-10-17 07:44:38 ---BEGIN TEST EXECUTION RESULTS---
2012-10-17 07:44:38 At least 43 message(s) from Nerrvana side reach(es) 
                    or exceed(s) threshold level (ERROR).
Message analyzer marks execution as failure.
2012-10-17 07:44:38 -----END TEST EXECUTION RESULTS---
2012-10-17 07:44:38
-----END PLUGIN EXECUTION---
&nbsp;
Build step 'Nerrvana plug-in' marked build as failure
Finished: FAILURE</pre></td></tr></table></div>

<p>In the first 26 lines, the plugin outputs the parameters parsed from its configuration file.</p>
<p>In lines 28-34, the plugin creates a new test run name and description.</p>
<p>In lines 36-39, you see the synchronization process between tests in the Jenkins workspace and tests stored in the Nerrvana space used for this job.</p>
<p>In lines 41-44, the plugin creates a new Test Run in Nerrvana, launches it and gets a Test Run ID and unique Test Run execution ID back from API. This will be used to monitor test status by the plugin later. The same Test Run can be launched several times, but each run will have its own unique internal execution ID. At this stage, the Test Run is visible in the Nerrvana UI. &#8220;Answers TRUNK MySQL build # 51&#8243; Test Run is created and starts running.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/new_tr.png" alt="Nerrvana Test Run started by Jenkins - all tests and two platforms" title="Nerrvana Test Run started by Jenkins - all tests and two platforms" /></p>
<p>In lines 45-58, the plugin polls test status every 20 seconds (polling parameter), while reading Nerrvana messages, which become available in real time during tests&#8217; execution.</p>
<p>Once the tests are completed (lines 59-60), the plugin analyzes the errors (lines 61-63) and on the basis of the analysis sets the build status (lines 64-70). If you’re not using Nerrvana messages, the build would be marked as successful.</p>
<p>Using Nerrvana&#8217;s UI we can see how long it took for all tests to complete.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/tests_2_platforms.png" alt="Nerrvana Test Run completed - all tests and two platforms" title="Nerrvana Test Run completed - all tests and two platforms" /></p>
<p>This is what messages look like in the UI, that the plugin reads and analyzes.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/messages.png" alt="Nerrvana messages can be analyzed by plugin" title="Nerrvana messages can be analyzed by plugin" /></p>
<p>We see that the reports generated by our framework contain more tests than the previous run (left panel).</p>
<p><a href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/report_all_tests.png" target="_blank"><img class="aligncenter"  src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/report_all_tests_700.png" style="-ms-interpolation-mode: bicubic;"  title="Our Selenium report for all tests" alt="Our Selenium report for all test" /></a></p>
<p>Another advantage of using Nerrvana messages is that the plugin can create simple reports (1). Reports show the status of the build and message threshold level used by the plugin (2) and the description of the Test Run (3). In our example, the description contains information about the commit that triggered the tests. Platform names (4) are linked to the Nerrvana FTPS server, which will contain detailed reports generated by the tests. Finally, clicking on the last column (5) expands the table and shows the messages that your tests sent to Nerrvana, which were received and collected by the Jenkins plugin.</p>
<p>Very often, this provides enough information for a developer to understand where the errors are, especially when he or she also maintains tests <img src='http://www.deepshiftlabs.com/sel_blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/Jenkins_report.png" target="_blank"><img class="aligncenter"  src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/Jenkins_report_700.png" style="-ms-interpolation-mode: bicubic;" title="Nerrvana plugin report in Jenkins" alt="Nerrvana plugin report in Jenkins" /></a></p>
<p>We have described the whole process of setting up and running tests. However, as you know, we test our application with two databases, and therefore we use a more complicated configuration. We deploy twice, and call the Nerrvana plugin two times in the same Jenkins job.</p>
<p>We will talk about this in a future post. We also ponder how the process can be improved.</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/ALm0TOZpnBQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2257&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2257&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Running Selenium IDE tests without IDE</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/W-5W02VYxms/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2626&amp;lang=en-us#comments</comments>
		<pubDate>Wed, 14 Nov 2012 02:27:49 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2626</guid>
		<description><![CDATA[We are glad to introduce the Selenium IDE formatter for Nerrvana. What is Nerrvana? Nerrvana is a cloud service which allows you to run functional and cross browser Selenium tests on demand. We hope it will help those who use the Selenium IDE to create and run tests or monitoring scripts in our cloud, and [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Running Selenium IDE without IDE" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/cloud_300.jpg" alt="Running Selenium IDE without IDE" /></div>
<p>We are glad to introduce the Selenium IDE formatter for Nerrvana. </p>
<p>What is Nerrvana? Nerrvana is a cloud service which allows you to run functional and cross browser Selenium tests on demand.</p>
<p>We hope it will help those who use the Selenium IDE to create and run tests or monitoring scripts in our cloud, and help you to transition from recording tests in the IDE to writing much more powerful and easy to maintain tests in Java.</p>
<p><iframe width="700" height="394" src="http://www.youtube.com/embed/ntmbLNkwYhc" frameborder="0" allowfullscreen></iframe></p>
<p style="text-align: center;"><em>Use 720p for the best quality</em></p>
<p>If there will be a demand from our clients we will extend the <a href="http://www.deepshiftlabs.com/sel_blog/?p=1930&#038;lang=en_us" target="_blank">framework</a> to create reports in the same format for tests generated by the Nerrvana Selenium IDE formatter.</p>
<p>Even though Selenium IDE tests have some limits it won’t compromise the quality of the reports you see and will minimise the time you spend to analyse them.</p>
<p>So please <a href="http://www.nerrvana.com" target="_blank">register</a> your free account and give it a try.</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/W-5W02VYxms" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2626&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2626&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Nerrvana Jenkins plugin released</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/O6hNDvhTkdU/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2730&amp;lang=en-us#comments</comments>
		<pubDate>Mon, 12 Nov 2012 01:52:14 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2730</guid>
		<description><![CDATA[We are glad to release Jenkins plugin for Nerrvana. We are using final version for a couple of months now and completely happy with it. Please visit documentation page for details. In the next article here we will share how do we use Nerrvana Jenkins plugin. Stay tuned! What is next? Selenium IDE formatter for [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Nerrvana Jenkins plugin released" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/11/plugin_tn_300.png" alt="Nerrvana Jenkins plugin released" /></div>
<p>We are glad to release Jenkins plugin for Nerrvana. We are using final version for a couple of months now and completely happy with it. Please visit <a href="http://www.nerrvana.com/docs/jenkins-plugin" target="_blank">documentation</a> page for details.</p>
<p>In the next article here we will share how do we use Nerrvana Jenkins plugin. Stay tuned!</p>
<p>What is next?</p>
<p>Selenium IDE formatter for Nerrvana. Yes, it will allow you to export Selenium IDE tests in a format and structure which is fully launchable in Nerrvana as is.</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/O6hNDvhTkdU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2730&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2730&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Using Nerrvana – deployment &amp; Jenkins (part 2)</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/Ja2mjCSNxPs/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2343&amp;lang=en-us#comments</comments>
		<pubDate>Wed, 24 Oct 2012 07:32:32 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2343</guid>
		<description><![CDATA[Jenkins job creation – our webapplication deployment in details &#8211; deploymentfor Selenium testing completed Part 1 &#8211; Using Nerrvana – our setup Part 2 &#8211; Using Nerrvana – SVN hooks to Jenkins Part 3 &#8211; Using Nerrvana – deployment &#038; Jenkins (part 1) Part 4 &#8211; Using Nerrvana – deployment &#038; Jenkins (part 2) &#8211; [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Using Nerrvana - deployment &amp; Jenkins (part 2)" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/08/deployment_2_300.png" alt="Using Nerrvana - deployment &amp; Jenkins (part 2)" /></div>
<p>
<p style="text-align: center;"><em>Jenkins job creation – our web</br>application deployment in details &#8211; deployment</br>for Selenium testing completed</em></p>
<p>Part 1 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2251&#038;lang=en-us" target="_blank">Using Nerrvana – our setup</a><br />
Part 2 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2253&#038;lang=en-us" target="_blank">Using Nerrvana – SVN hooks to Jenkins </a><br />
Part 3 &#8211; <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us" target="_blank">Using Nerrvana – deployment &#038; Jenkins (part 1)</a><br />
Part 4 &#8211; Using Nerrvana – deployment &#038; Jenkins (part 2) &#8211; this post</p>
<p>In the <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us" target="_blank">previous post</a> we have finished configuring Jenkins and now we can create a Jenkins job to test our application.</p>
<p>Open the page http://your_jenkins_host/view/All/newJob and type in the job name. Since our application is <a href="http://answers.starty.co" target="_blank">Answers</a>, we use it as our job name. </p>
<p>In practice, it is convenient to add branch information to your job name. For example, job &#8216;Answers TRUNK&#8217; tests TRUNK, job &#8216;Answers Release 1.4&#8242; tests Release 1.4.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_1.png" alt="New Jenkins job" title="New Jenkins job" /></p>
<p>Down in the section &#8220;Advanced Project Options&#8221; press the button &#8220;Advanced &#8230;&#8221; and set &#8220;Quiet period&#8221; to 0 seconds. We know that many people do builds a few times a day. In this case, you will configure this option differently. We build for each commit, and therefore we do not need to wait for 5 seconds. Jenkins help for this step describes the practical cases, when this option is required.<span id="more-2343"></span></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_advanced_1_5.png" alt="New Jenkins job - Advanced project options" title="New Jenkins job - Advanced project options" /></p>
<p>Now we go to the section &#8216;Source Code Management&#8217; and select SVN, which we use.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_svn_1.png" alt="New Jenkins job - Source Code Management" title="New Jenkins job - Source Code Management" /></p>
<p>Jenkins will ask you to enter SVN user details. Choose &#8216;Check out strategy&#8217;. We use &#8211; &#8216;Always check out a fresh copy&#8217;.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_svn_2.png" alt="New Jenkins job - Check out strategy" title="New Jenkins job - Check out strategy" /></p>
<p>The next section is &#8216;Build Triggers&#8217;. Use &#8216;Poll SCM&#8217; option. In our case, the &#8216;push&#8217; trigger, which Jenkins help advises to use, is the SVN hook that we <a href="http://www.deepshiftlabs.com/sel_blog/?p=2253&#038;lang=en-us" target="_blank">added earlier</a>. If you open context help for the option &#8216;Build periodically&#8217;, you will see the following remark: &#8220;When people first start continuous integration, they are often so used to the idea of regularly scheduled builds like nightly/weekly that they use this feature. However, the point of continuous integration is to start a build as soon as a change is made, to provide a quick feedback to the change.&#8221; This is why our builds start immediately after each commit.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_triggers_3.png" alt="New Jenkins job - Build Triggers" title="New Jenkins job - Build Triggers" /></p>
<p>Skip the next section &#8216;Build Environment&#8217; and go to the &#8216;Build&#8217; section. Push the button &#8216;Add build step&#8217; and then choose the &#8216;Invoke Ant&#8217;.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_step_4.png" alt="New Jenkins job - Add Build Step" title="New Jenkins job - Add Build Step" /></p>
<p>As you can see, the Ant configuration file we use here is also in SVN. Upon completion of the checkout on the previous step, it falls into the right place at the right time. The purpose of this step is to prepare the code extracted from the version control system to be transferred to the deployment host where deployment will be completed. We want to do the maximum possible operations on jenkins host.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_ant.png" alt="New Jenkins job - Invoke Ant" title="New Jenkins job - Invoke Ant" /></p>
<p>Next I&#8217;ll tell you what Ant does. Here&#8217;s what our build.xml is:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code99'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p234399"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
</pre></td><td class="code" id="p2343code99"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;${env.JOB_NAME}&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">environment</span>=<span style="color: #ff0000;">&quot;env&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;tests&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/tests&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ci&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/ci&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;code&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/code&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;make_settings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/config/Settings.class.php.mysql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/mysql/settings-mysql.sed ${code}/config/Settings.class.template.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;make_sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/install/mysql.sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/mysql/install-mysql.sed ${code}/install/mysql.sql&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;move_files&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;make_settings,make_sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Move authentication files to WAUT root --&gt;</span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/misc/login.php&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/login.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/misc/logout.php&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/logout.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #808080; font-style: italic;">&lt;!-- Move MySQL db creation files to install folder --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/config/mysql/crt-mysql.sql&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/install/crt-mysql.sql&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #808080; font-style: italic;">&lt;!-- Move publish script to the workspace root, so it will be beside prj.zip --&gt;</span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/publish-over-ssh/publish.sh&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/publish.sh&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;save_commit_info&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;move_files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 upgrade&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span>  <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/version.txt&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 log -r ${env.SVN_REVISION}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 log -r ${env.SVN_REVISION}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>   
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;save_commit_info&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;java</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000066;">jar</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/scm-decorator.jar&quot;</span> <span style="color: #000066;">fork</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/version.txt&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/java<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>       
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;zip&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Compress project files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jar</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/prj.zip&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/code&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">excludes</span>=<span style="color: #ff0000;">&quot;.svn&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;zip&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>All other operations are performed on the deployment host after the results of this step are sent to it using the &#8216;Send files or execute commands over SSH&#8217; build step.</p>
<p>I hope my explanation will help you create Ant build better, smarter and faster.</p>
<p>First of all, I want to say that if you get stuck with paths &#8211; paste code below into your Ant file and use it as a target &#8211; you will see in the Jenkins console output what paths Jenkins operates while executing your Ant file.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code100'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343100"><td class="code" id="p2343code100"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Jenkins workspace: ${env.WORKSPACE}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Job directory: ${env.WORKSPACE}/../../${env.JOB_NAME}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Build data: ${env.WORKSPACE}/../../${env.JOB_NAME}/builds/${env.BUILD_ID}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>In lines 4-6, we give short names (aliases) to often used directories to make fewer mistakes down below in our commands and make the file easier to read.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code101'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343101"><td class="code" id="p2343code101"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;tests&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/tests&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ci&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/ci&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;code&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/code&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>Next (lines 8-12), our task is to create a configuration file for the application. As we <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us#anchor2">wrote earlier</a>, our application is downloadable and is installed with the included installation script. Here we just use ‘sed’ to convert the template Settings.class.template used in the installation script into the application configuration file Settings.class.php.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code102'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343102"><td class="code" id="p2343code102"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;make_settings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/config/Settings.class.php.mysql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/mysql/settings-mysql.sed ${code}/config/Settings.class.template.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>I will not show the files in their entirety, but just a few lines from a template file &#8211; Settings.class.template, a few lines of settings-mysql.sed file and the same rows in the newly created configuration file Settings.class.php.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code103'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343103"><td class="code" id="p2343code103"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Database IP or hostname (use colon, if runs on non-standard port: 127.0.0.1:563)</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_HOST <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Username to connect to DB</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_USER <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code104'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343104"><td class="code" id="p2343code104"><pre class="bash" style="font-family:monospace;">s<span style="color: #000000; font-weight: bold;">/</span>const DB_USER = <span style="color: #ff0000;">&quot;&quot;</span>;<span style="color: #000000; font-weight: bold;">/</span>const DB_USER = <span style="color: #ff0000;">&quot;ANSWERS_DB_USER&quot;</span>;<span style="color: #000000; font-weight: bold;">/</span>g
s<span style="color: #000000; font-weight: bold;">/</span>const DB_HOST = <span style="color: #ff0000;">&quot;&quot;</span>;<span style="color: #000000; font-weight: bold;">/</span>const DB_HOST = <span style="color: #ff0000;">&quot;localhost&quot;</span>;<span style="color: #000000; font-weight: bold;">/</span>g</pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code105'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343105"><td class="code" id="p2343code105"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Database IP or hostname (use colon, if runs on non-standard port: 127.0.0.1:563)</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_HOST <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Username to connect to DB</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_USER <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ANSWERS_DB_USER&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>You can see that in the file names and paths we have &#8216;mysql&#8217; That&#8217;s because we are also testing our application with PostgreSQL. I removed everything about PostgreSQL from this post and, as promised, will show the real configuration files in the final post. I do not like to be overloaded with too much information when someone is explaining something new to me, and I decided to show you the same courtesy.</p>
<p>As a result of this step, we created a configuration file for the application to work with MySQL &#8211; Settings.class.php.mysql, which is stored in the same folder with Settings.class.template.php &#8211; ${code}/config .</p>
<p>In lines 14-18, we create the necessary SQL file, which when executed on the deployment host, will recreate the MySQL database for our application.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code106'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343106"><td class="code" id="p2343code106"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;make_sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;sed&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${code}/install/mysql.sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-f ${ci}/deployment/config/mysql/install-mysql.sed ${code}/install/mysql.sql&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Again, the Answers installer uses a prepared for the installation script mysql.sql file. Based on user input, installer replaces, for example, the names of the tables, but we can use it unchanged. A few changes which are necessary are made using ‘sed’. In this case, we modify the original file ${code}/install/mysql.sql.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code107'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343107"><td class="code" id="p2343code107"><pre class="bash" style="font-family:monospace;">s<span style="color: #000000; font-weight: bold;">/</span>USERS_TABLE<span style="color: #000000; font-weight: bold;">/</span>USERS_VIEW_NAME<span style="color: #000000; font-weight: bold;">/</span>g
s<span style="color: #000000; font-weight: bold;">/</span>USE ANSWERS_DATABASE<span style="color: #000000; font-weight: bold;">/</span>USE answers<span style="color: #000000; font-weight: bold;">/</span>g</pre></td></tr></table></div>

<p>Next &#8211; target &#8220;move_files&#8221; (lines 20-30). As you will recall, our application is embedded and does not have its own login page. However, for testing we need login and logout pages, which we have created. They are in the ${ci}/deployment/misc/ folder and now it&#8217;s time to move them to the root of the application &#8211; $ {code}/, as these pages will be used by Selenium tests (lines 21-23).</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code108'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343108"><td class="code" id="p2343code108"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;move_files&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;make_settings,make_sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Move authentication files to WAUT root --&gt;</span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/misc/login.php&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/login.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/misc/logout.php&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/logout.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #808080; font-style: italic;">&lt;!-- Move MySQL db creation files to install folder --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/config/mysql/crt-mysql.sql&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${code}/install/crt-mysql.sql&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #808080; font-style: italic;">&lt;!-- Move publish script to the workspace root, so it will be beside prj.zip --&gt;</span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/publish-over-ssh/publish.sh&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/publish.sh&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>In lines 25-26, we move another SQL file &#8211; crt-mysql.sql, from ${ci}/deployment/config/mysql/ to $ {code}/install/, since we send to the deployment host only the content of ${code}/ folder.</p>
<p>What is in the file crt-mysql.sql file? Here again, because of the embeddable nature of our application that creates its tables in the database of your main application, we need at least to (re)create a basic application tables (users’ accounts). After that we would be able to execute the file mysql.sql, we have prepared earlier which will embed Answers data structures. That is the role of the script &#8211; rebuild the database, create the &#8220;main&#8221; application and its users, and delete the database user, the previous deployment run created. That&#8217;s how it looks without cuts:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code109'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343109"><td class="code" id="p2343code109"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> answers;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> answers;
<span style="color: #993333; font-weight: bold;">use</span> answers;
&nbsp;
<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">if</span> <span style="color: #993333; font-weight: bold;">exists</span> USERS_SOURCE_TABLE;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`USERS_SOURCE_TABLE`</span> <span style="color: #66cc66;">&#40;</span>
  USERS_ID_COLUMN int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  username varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  USERS_DISPLAY_NAME_COLUMN varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  USERS_EMAIL_COLUMN varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  CONSTRAINT USERS_SOURCE_TABLE_pkey <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span>USERS_ID_COLUMN<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>InnoDB <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> USERS_SOURCE_TABLE <span style="color: #993333; font-weight: bold;">VALUES</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'answ_test_admin@dslabs.lan'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Arnie - Admin'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'answ_test_admin@dslabs.lan'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> USERS_SOURCE_TABLE <span style="color: #993333; font-weight: bold;">VALUES</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'answ_test_user@dslabs.lan'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Ivan Danko - Captain'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'answ_test_user@dslabs.lan'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> USERS_SOURCE_TABLE <span style="color: #993333; font-weight: bold;">VALUES</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'answ_test_staff@dslabs.lan'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Lee - Guru(Staff)'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'answ_test_staff@dslabs.lan'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">DROP</span> USER <span style="color: #ff0000;">'ANSWERS_DB_USER'</span>@localhost;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></td></tr></table></div>

<p>In conclusion of this part in lines 28-29, we move publsih.sh script to the root of our Jenkins job workspace. The script knows what to do with packed into zip file content of /code, which we have prepared. Publish.sh content will be discussed when we describe the step &#8216;Send files or execute commands over SSH&#8217;.</p>
<p>In lines 32-43, we put information about the commit which triggered our Jenkins build into a text file.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code110'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343110"><td class="code" id="p2343code110"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;save_commit_info&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;move_files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 upgrade&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span>  <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/version.txt&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 log -r ${env.SVN_REVISION}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;--username jenkins --password 123456 log -r ${env.SVN_REVISION}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>                  
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>In lines 33-35, I have a workaround for the problem when your SVN server is a higher version than the one supported by the Jenkins SVN plugin. It can happen. In this case the command &#8216;svn info&#8217; errors with version mismatch and asks to upgrade the working copy, which I do before running &#8216;svn info&#8217;. Lines 39-41 are only to output information we saved into the text file and also to the Jenkins console log. We will use the information saved into this file in a future step to convert it to a more pleasant format and add it later in the Nerrvana test run’s description.</p>
<p>Now we are using a utility which is written by us, and is available on <a href="https://github.com/deepshiftlabs/scm-decorator" target="_blank">GitHub</a>, which takes the file shown below as an input and &#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code111'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343111"><td class="code" id="p2343code111"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#cat version.txt</span>
<span style="color: #660033;">------------------------------------------------------------------------</span>
r69 <span style="color: #000000; font-weight: bold;">|</span> igork <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2012</span>-<span style="color: #000000;">10</span>-03 07:<span style="color: #000000;">38</span>:<span style="color: #000000;">38</span> +0000 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Wed, 03 Oct <span style="color: #000000;">2012</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
Fixed bug <span style="color: #666666; font-style: italic;">#342</span>
<span style="color: #660033;">------------------------------------------------------------------------</span></pre></td></tr></table></div>

<p>&#8230; converts it into this file:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code112'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343112"><td class="code" id="p2343code112"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#cat version.txt</span>
Revision: <span style="color: #000000;">69</span>
Committer: igork
Date: <span style="color: #000000;">2012</span>-<span style="color: #000000;">10</span>-03 07:<span style="color: #000000;">38</span>:<span style="color: #000000;">38</span> +0000 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Wed, 03 Oct <span style="color: #000000;">2012</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Fixed bug <span style="color: #666666; font-style: italic;">#342</span></pre></td></tr></table></div>

<p>You can extend the code by adding support for a version control system that you use, if it will be useful to you.</p>
<p>That&#8217;s how conversion is done with Ant:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code113'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343113"><td class="code" id="p2343code113"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;save_commit_info&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;java</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000066;">jar</span>=<span style="color: #ff0000;">&quot;${ci}/deployment/scm-decorator.jar&quot;</span> <span style="color: #000066;">fork</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/version.txt&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/java<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>       
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>As you can see we added the parameter <arg value="svn"/> expecting someone else, or ourselves, to expand for Git later.</p>
<p>Finally, we zip the folder /code/ in lines 51-55 to file prj.zip.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code114'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343114"><td class="code" id="p2343code114"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;zip&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Compress project files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jar</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/prj.zip&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${env.WORKSPACE}/code&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">excludes</span>=<span style="color: #ff0000;">&quot;.svn&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Go to the next build step (and last one for today) &#8211; transfer prepared files and do final steps of deployment on deployment host.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/build_ssh.png" alt="New Jenkins job - Send files or execute commands over SSH" title="New Jenkins job - Send files or execute commands over SSH" /></p>
<p>You can see that we are transferring to the deployment host (determined by the first parameter &#8211; &#8216;SSH Server&#8217; and we created it, when configured Jenkins – in <a href="http://www.deepshiftlabs.com/sel_blog/?p=2255&#038;lang=en-us" target="blank">this</a> post) two files prj.zip and publish.sh. We also instruct Jenkins to run publish.sh after the transfer:</p>
<p><code>chmod +x publish.sh<br />
./publish.sh</code></p>
<p>Now is the time to see what publish.sh script does.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code115'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343115"><td class="code" id="p2343code115"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">WWW_MYSQL_DIR</span>=<span style="color: #ff0000;">'/var/www/answers/answers_mysql'</span>
<span style="color: #007800;">DB_NAME</span>=<span style="color: #ff0000;">'answers'</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-Rf</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #660033;">-o</span> prj.zip <span style="color: #660033;">-d</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php.mysql <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">777</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span>
mysql <span style="color: #660033;">-v</span> <span style="color: #660033;">-u</span> root  <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>crt-mysql.sql
mysql <span style="color: #660033;">-v</span> <span style="color: #660033;">-u</span> root  <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>mysql.sql <span style="color: #007800;">$DB_NAME</span></pre></td></tr></table></div>

<p>Cleans Apache virtual host folder:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code116'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343116"><td class="code" id="p2343code116"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-Rf</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/*</span></pre></td></tr></table></div>

<p>Decompresses Answers into it:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code117'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343117"><td class="code" id="p2343code117"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #660033;">-o</span> prj.zip <span style="color: #660033;">-d</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span></pre></td></tr></table></div>

<p>Renames prepared Answers configuration file to be used with MySQL database:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code118'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343118"><td class="code" id="p2343code118"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php.mysql <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>Settings.class.php</pre></td></tr></table></div>

<p>Changes permissions (I admit, we could be a little bit more conservative here):</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code119'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343119"><td class="code" id="p2343code119"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">777</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span></pre></td></tr></table></div>

<p>Creates a &#8216;main&#8217; application: (-v is used to be able to see verbose output from SQL script inside Jenkins console log):</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code120'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343120"><td class="code" id="p2343code120"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-v</span> <span style="color: #660033;">-u</span> root <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>crt-mysql.sql</pre></td></tr></table></div>

<p>Integrates Answers into the &#8216;main&#8217; application:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code121'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343121"><td class="code" id="p2343code121"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-v</span> <span style="color: #660033;">-u</span> root <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$WWW_MYSQL_DIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>mysql.sql <span style="color: #007800;">$DB_NAME</span></pre></td></tr></table></div>

<p>We are done! We do a commit and see the build’s console logs in Jenkins until we have no errors and have a running Answers application on http://deployment_host/answers_mysql.</p>
<p>As you can see all the files used by Jenkins are also in the version control system. This allows us to not use custom workspaces in Jenkins (we started with them), which would require Jenkins pre-configuration as well as remembering to update files in our version control system and in Jenkins. All files fall into the right places after Jenkins updates the source code in the workspace after a commit. Also, with this approach, we can use the environment variables Jenkins sets in our configuration files.</p>
<p>Under the spoiler below you can find a sample console log with my comments. I removed some long outputs and marked it.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2343code122'); return false;">View Code</a> TXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2343122"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
</pre></td><td class="code" id="p2343code122"><pre class="txt" style="font-family:monospace;">Started by an SCM change
Building in workspace /var/lib/jenkins/jobs/Answers_deployment_only/workspace
Cleaning local Directory .
Checking out http://192.168.3.97/repos/answers/trunk at revision 140
A         tests
------ Output removed - comment by Igor --------------------------------- 
AU        ci/deployment/scm-decorator.jar
A         ci/deployment/build.xml
A         ci/toolchain
A         ci/toolchain/build-toolchain.xml
At revision 140
[deployment] $ ant -file build.xml build
Buildfile: build.xml
&nbsp;
make_settings:
&nbsp;
make_sql:
&nbsp;
move_files:
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers_deployment_only/workspace/code
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers_deployment_only/workspace/code/install
     [move] Moving 1 file to /var/lib/jenkins/jobs/Answers_deployment_only/workspace
&nbsp;
save_commit_info:
     [exec] Upgraded '.'
------ Output removed - comment by Igor --------------------------------- 
     [exec] Upgraded 'ci/deployment/misc'
     [exec] Upgraded 'ci/toolchain'
     [exec] ------------------------------------------------------------------------
     [exec] r140 | igork | 2012-10-08 11:46:01 +0000 (Mon, 08 Oct 2012) | 1 line
     [exec] 
     [exec] Test 2345
     [exec] ------------------------------------------------------------------------
&nbsp;
svn:
&nbsp;
zip:
      [jar] Building jar: /var/lib/jenkins/jobs/Answers_deployment_only/workspace/prj.zip
&nbsp;
build:
&nbsp;
BUILD SUCCESSFUL
Total time: 0 seconds
SSH: Connecting from host [mantis.deepshiftlabs.com]
SSH: Connecting with configuration [Answers test server] ...
SSH: EXEC: STDOUT/STDERR from command [chmod +x publish.sh
./publish.sh] ...
Archive:  prj.zip
   creating: /var/www/answers/answers_mysql/META-INF/
------ Output removed - comment by Igor ---------------------------------   
  inflating: /var/www/answers/answers_mysql/utils/Utils.class.php  
  inflating: /var/www/answers/answers_mysql/utils/init.php  
--------------
drop database answers
--------------
&nbsp;
--------------
create database answers
--------------
------ Output removed - comment by Igor --------------------------------- 
--------------
GRANT SELECT ON USERS_VIEW_NAME TO 'ANSWERS_DB_USER'@localhost
--------------
&nbsp;
SSH: EXEC: completed after 1,003 ms
SSH: Disconnecting configuration [Answers test server] ...
SSH: Transferred 2 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
Finished: SUCCESS
&nbsp;
1-11 - Jenkins responded to a commit and checked out a fresh copy
12-40 - build.xml is running with target the ‘build’
24-28 - 'svn upgrade' is updating a working copy (workaround I described)
29-33 – our SCM decorator parses ‘svn log’ output
44-46 - the results were sent to the deployment host and publish.sh is executed
49-52 - prj.zip unpacked to the root of the Apache’s virtual host
53-63 - publish.sh executes SQL script</pre></td></tr></table></div>

<p>In our next post we will extend Jenkins job we created today and launch Selenium tests in <a href="http://www.nerrvana.com" target="_blank">Nerrvana</a>.<br />
</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/Ja2mjCSNxPs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2343&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2343&amp;lang=en-us</feedburner:origLink></item>
		<item>
		<title>Virtualizer toolbox – install Win 7 on Xen</title>
		<link>http://feedproxy.google.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~3/84l80P4Tzfs/</link>
		<comments>http://www.deepshiftlabs.com/sel_blog/?p=2340&amp;lang=en-us#comments</comments>
		<pubDate>Fri, 12 Oct 2012 04:13:00 +0000</pubDate>
		<dc:creator>Igor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.deepshiftlabs.com/sel_blog/?p=2340</guid>
		<description><![CDATA[This post continues our two recent posts where we explained how to install Xen and minimise Windows 7 to make it ready for Selenium testing. We cut out as many components and services as possible, because we are going to only use browsers. As we have Xen installed and the Windows 7 install image – [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><img style="padding: 5px 20px 10px 0;" title="Virtualizer toolbox - install Win 7 on Xen" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/08/win_7_xen_300.gif" alt="Virtualizer toolbox - install Win 7 on Xen" /></div>
<p>This post continues our two recent posts where we explained how to <a href="http://www.deepshiftlabs.com/sel_blog/?p=2338&#038;lang=en-us" target="_blank">install Xen</a> and <a href="http://www.deepshiftlabs.com/sel_blog/?p=2499&#038;lang=en-us" target="_blank">minimise Windows 7</a> to make it ready for Selenium testing. We cut out as many components and services as possible, because we are going to only use browsers.</p>
<p>As we have Xen installed and the Windows 7 install image – today, we will complete our story and show you how to install Windows 7 on Xen. This same process can be used to install standard Windows 7 but you will need to allocate more space (file or logical volume) and more RAM. </p>
<p>In our <a href="http://www.deepshiftlabs.com/sel_blog/?p=2338&#038;lang=en-us" target="_blank">Xen installation</a> post we already created a logical volume &#8230;</p>
<p><strong>#lvcreate &#8211;size 7G &#8211;name win7 vg0</strong></p>
<p>&#8230; launched a VNC server, connected to CentOS with VNC Viewer, launched Virtual Machine Manager and, finally, pressed the &#8216;New&#8217; button.</p>
<p>From this point forward everything is very simple.<br />
<span id="more-2340"></span><br />
<img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/11.png" title="Step 1 - Virtual Machine Creation" alt="Step 1 - Virtual Machine Creation" /></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/22.png" title="Step 2 - Virtual Machine Name" alt="Step 2 - Virtual Machine Name" /></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/33.png" title="Step 3 - Virtualization Method" alt="Step 3 - Virtualization Method" /></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/44.png" title="Step 4 - Installation Method" alt="Step 4 - Installation Method" /></p>
<p>This file is the Windows 7 install image that we created. If you use the original install disk, you will need to make the ISO file and put it on your Linux file system.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/55.png" title="Step 5 - Installation Media" alt="Step 5 - Installation Media" /></p>
<p>We install it on the logical volume we created earlier.</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/66.png" title="Step 6 - Storage" alt="Step 6 - Storage" /></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/77.png" title="Step 7 - Network" alt="Step 7 - Network" /></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/88.png" title="Step 8 - Memory and CPU allocation" alt="Step 8 - Memory and CPU allocation" /></p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/99.png" title="Step 9 - Finish Virtual Machine Creation" alt="Step 9 - Finish Virtual Machine Creation" /></p>
<p>Installation begins &#8230;</p>
<p><img class="aligncenter" style="-ms-interpolation-mode: bicubic;" src="http://www.deepshiftlabs.com/sel_blog/wp-content/uploads/2012/10/99a.png" title="Win 7 install is running now" alt="Win 7 install is running now" /><br />
</p>
<img src="http://feeds.feedburner.com/~r/WebApplicationsTestingAndSeleniumBlogByDeepShiftLabs/~4/84l80P4Tzfs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.deepshiftlabs.com/sel_blog/?feed=rss2&amp;p=2340&amp;lang=en-us</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.deepshiftlabs.com/sel_blog/?p=2340&amp;lang=en-us</feedburner:origLink></item>
	</channel>
</rss>
