<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WeDoQA Blog</title>
	<atom:link href="http://blog.wedoqa.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wedoqa.com</link>
	<description>Because quality matters!</description>
	<lastBuildDate>Sat, 05 May 2012 07:39:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Capturing screenshots of failed tests in Selenium Webdriver + JUnit4</title>
		<link>http://blog.wedoqa.com/2012/05/capturing-screenshots-of-failed-tests-in-selenium-webdriver-junit4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=capturing-screenshots-of-failed-tests-in-selenium-webdriver-junit4</link>
		<comments>http://blog.wedoqa.com/2012/05/capturing-screenshots-of-failed-tests-in-selenium-webdriver-junit4/#comments</comments>
		<pubDate>Sat, 05 May 2012 07:39:19 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Screenshot]]></category>
		<category><![CDATA[selenium]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=253</guid>
		<description><![CDATA[Beside the exception / failure information, it is almost always helpful for the developers to provide them with additional screenshot of the failed tests. From JUnit 4.7 the @Rule annotation is introduced which can be used to extend the capabilities of JUnit. With it we can invoke a custom piece of code when a test]]></description>
			<content:encoded><![CDATA[<p>Beside the exception / failure information, it is almost always helpful for the developers to provide them with additional screenshot of the failed tests.<br />
From JUnit 4.7 the @Rule annotation is introduced which can be used to extend the capabilities of JUnit. With it we can invoke a custom piece of code when a test fails or succeeds.<br />
In this example we will capture a screenshot of a failed test.<br />
Before showing how it is done, we should have a test class at hand. For the following example just download the selenium driver from the page <a  href="http://seleniumhq.org/download/" title="http://seleniumhq.org/download/" target="_blank">http://seleniumhq.org/download/</a> and add the jar files to classpath.</p>
<pre class="brush: java; title: ; notranslate">
package test;

import static org.junit.Assert.assertTrue;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.firefox.FirefoxDriver;

import com.thoughtworks.selenium.Selenium;

//This is an example for the usage of ScreenshotTestRule
public class TestWithScreenshotExample {
    //
    static WebDriver driver;
    static Selenium selenium;
    // an annotation is used for defining a new rule for Junit
    @Rule
    public ScreenshotTestRule screenshotTestRule = new ScreenshotTestRule();

    @BeforeClass
    public static void beforeClass() {
        driver = new FirefoxDriver();
        selenium = new WebDriverBackedSelenium(driver, &quot;http://www.google.com&quot;);
    }

    @AfterClass
    public static void afterClass() {
       driver.quit();
    }

    @Test
    public void testThatSucceeds() {
        selenium.open(&quot;/&quot;);
        // some text code here
        assertTrue(selenium.isTextPresent(&quot;This test will pass&quot;));
    }

    @Test
    public void testThatFails() {
        selenium.open(&quot;/&quot;);
        //some text code here
        assertTrue(selenium.isTextPresent(&quot;This test will fail&quot;));
    }

    // the static driver object will be needed for capturing screenshots
	public static WebDriver getDriver() {
		return driver;
	}
</pre>
<p>The trick above is to define a new JUnit rule with @Rule annotation.<br />
The class which is used to define the new rule needs to implement the MethodRule interface and to override the apply() function.</p>
<pre class="brush: java; title: ; notranslate">
package test;

import java.io.File;

import org.apache.commons.io.FileUtils;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;

class ScreenshotTestRule implements MethodRule {
    public Statement apply(final Statement statement, final FrameworkMethod frameworkMethod, final Object o) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                try {
                    statement.evaluate();
                } catch (Throwable t) {
                    // exception will be thrown only when a test fails.
                    captureScreenshot(frameworkMethod.getName());
                    // rethrow to allow the failure to be reported by JUnit
                    throw t;
                  }
            }

            public void captureScreenshot(String fileName) {
                try {
//
               File screenshot =  ((TakesScreenshot)TestWithScreenshotExample.getDriver()).getScreenshotAs(OutputType.FILE);
// the screenshots can be moved to a folder for sorting               FileUtils.copyFile(screenshot, new File(&quot;./screenshot-&quot;+fileName+&quot;.png&quot;));
                } catch (Exception e) {
                    // No need to crash the tests if the screenshot fails
                }
            }
        };
    }
}
</pre>
<p>By overwriting the apply() function we can intervene before Junit sends out  the test results, and we can insert the screenshot capturing code.<br />
For further information on using the @Rule annotation check out: <a  href="http://www.junit.org/node/580" title="http://www.junit.org/node/580" target="_blank">http://www.junit.org/node/580</a><br />
Happy screenshot capturing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2012/05/capturing-screenshots-of-failed-tests-in-selenium-webdriver-junit4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium &#8211; How to check if an element has focus</title>
		<link>http://blog.wedoqa.com/2011/07/selenium-how-to-check-if-an-element-has-focus/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=selenium-how-to-check-if-an-element-has-focus</link>
		<comments>http://blog.wedoqa.com/2011/07/selenium-how-to-check-if-an-element-has-focus/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 11:48:25 +0000</pubDate>
		<dc:creator>Vilmos Somogyi</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[selenium]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=205</guid>
		<description><![CDATA[Problem: We have a contact form with Name, Email and Comment fields, and if invalid data is entered to the fields, the validation system will highlight that field and it will be focused, so the user can change it quickly. In our tests we want to check if the proper field gets the focus. (this]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>We have a contact form with Name, Email and Comment fields, and if invalid data is entered to the fields, the validation system will highlight that field and it will be focused, so the user can change it quickly. In our tests we want to check if the proper field gets the focus.</p>
<pre class="brush: xml; title: ; notranslate">&lt;div class=&quot;contact-form&quot;&gt;
    &lt;label&gt; Name &lt;/label&gt;
    &lt;input id=&quot;contact-name&quot; type=&quot;text&quot; /&gt;
    &lt;label&gt; Email &lt;/label&gt;
    &lt;input id=&quot;contact-email&quot; type=&quot;text&quot; /&gt;
    &lt;label&gt; Comment &lt;/label&gt;
    &lt;input id=&quot;contact-comment&quot; type=&quot;text&quot; /&gt;
&lt;/div&gt;</pre>
<p>(this is just an example code, and not a functional one)</p>
<p><strong>Solution:</strong></p>
<p>Selenium suggest to use css selectors, so we will start with that. To see if the element has the focus we will use css pseudo-class &#8220;:focus&#8221; and check if an element is present like this:</p>
<pre class="brush: csharp; title: ; notranslate">Assert.IsTrue(selenium.IsElementPresent(&quot;css=#contact-name:focus&quot;));</pre>
<p>This looks quite nice and easy, but you may encounter some problems with it. The element #contact-name can be found, but #contact-name:focus can not. In this case we have to think outside of the box, and come up with another solution. We can use the Javascript DOM locator to get the element that is selected (has focus), and compare it to the element we expect to have focus:</p>
<pre class="brush: csharp; title: ; notranslate">Assert.AreEqual(selenium.GetElementIndex(&quot;dom=document.activeElement&quot;),
selenium.GetElementIndex(&quot;css=#contact-name&quot;));</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2011/07/selenium-how-to-check-if-an-element-has-focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solution for &#8211; Could not start Selenium Session : Connection timed out</title>
		<link>http://blog.wedoqa.com/2011/06/solution-for-could-not-start-selenium-session-connection-timed-out/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=solution-for-could-not-start-selenium-session-connection-timed-out</link>
		<comments>http://blog.wedoqa.com/2011/06/solution-for-could-not-start-selenium-session-connection-timed-out/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 18:36:36 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[Selenium]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Selenium IDE]]></category>
		<category><![CDATA[Selenium Problem]]></category>
		<category><![CDATA[Selenium Server]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=189</guid>
		<description><![CDATA[If you get the &#8220;Could not start Selenium Session : Connection timed out&#8221; while running a test scenario it is usually due to the ports not matching for the Server and the client and results in &#8220;Selenium server not able to make a connection with the local client machine&#8221;. a sample error message: The solution]]></description>
			<content:encoded><![CDATA[<p>If you get the &#8220;Could not start Selenium Session : Connection timed out&#8221; while running a test scenario it is usually  due to the ports not matching for the Server and the client and results in &#8220;Selenium server not able to make a connection with the local client machine&#8221;.</p>
<p>a sample error message:</p>
<pre class="brush: plain; title: ; notranslate"> java.lang.RuntimeException: Could not start Selenium session: Connection timed out: connect
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
at com.ibm.lconn.files.test.ui.BaseFilesSeleniumTestCase.setUp(BaseFilesSeleni umTestCase.java:54)
at junit.framework.TestCase.runBare(TestCase.java:128)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:21 2)
at junit.framework.TestResult$1.protect(TestResult.java:106) </pre>
<p>The solution for it is to make sure to run the on the same ports. The default port where the selenium server starts up is 4444.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2011/06/solution-for-could-not-start-selenium-session-connection-timed-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Make Android Screenshots for testing</title>
		<link>http://blog.wedoqa.com/2010/10/how-to-make-android-screenshots-for-testing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-make-android-screenshots-for-testing</link>
		<comments>http://blog.wedoqa.com/2010/10/how-to-make-android-screenshots-for-testing/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 18:31:39 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Screenshot]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=151</guid>
		<description><![CDATA[When testing Android mobile applications the one of the first things that come up is how to record and document the error that happened. As in desktop testing there are apps that allow you to record the screen. The only thing that you need to do is to make sure the phone is rooted before]]></description>
			<content:encoded><![CDATA[<p>When testing Android mobile applications the one of the first things that come up is how to record and document the error that happened.<br />
As in desktop testing there are apps that allow you to record the screen. The only thing that you need to do is to make sure the phone<br />
is rooted before using the screenshot applications. (there are several descriptions out there just Google for them for the specific android<br />
version and phone model).</p>
<p>here is a list of screenshot applications:</p>
<p><strong>Screenshot V1.4 from </strong><strong><a  href="http://www.geeksofts.com">http://www.geeksofts.com/</a> (I Suggest this one)</strong></p>
<ul>
<li>You can use the camera button to take screenshots</li>
<li>You can also choose to shake the phone to take pictures when you want</li>
</ul>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview03.jpg" class="thickbox no_icon" rel="gallery-151" title="geeksofts screenshot"><img title="geeksofts screenshot" src="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview03-180x300.jpg" alt="" width="180" height="300" /></a><img class="alignleft" title="geeksofts screenshot" src="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview01-181x300.jpg" alt="" width="181" height="300" /><img class="alignleft" title="geeksofts screenshot" src="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview02-180x300.jpg" alt="" width="180" height="300" /></p>
<p></p>
<p><strong>Screenshot It Trial from </strong><a  href="http://www.koushikdutta.com/2008/11/android-screenshot-application.html"><strong>http://www.koushikdutta.com/</strong></a><strong> (only 5 screenshots in the trial mode)</strong></p>
<ul>
<li>Hold down the camera button</li>
<li>Assign a hot key to the application</li>
<li>Use a delayed timer</li>
</ul>
<div>
<dl id="attachment_158" class="alignleft">
<dt> </dt>
<dd><img title="Android Screenshot" src="http://blog.wedoqa.com/wp-content/uploads/2010/10/screen2-200x300.png" alt="" width="200" height="300" /></dd>
</dl>
</div>
<div>
<dl id="attachment_159">
<dt><span style="font-weight: normal; -webkit-text-decorations-in-effect: none;"><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview01.jpg" class="thickbox no_icon" rel="gallery-151" title="Android Screenshot It"><img title="Android Screenshot It" src="http://blog.wedoqa.com/wp-content/uploads/2010/10/screen-200x300.png" alt="" width="200" height="300" /></a></span></dt>
</dl>
</div>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview02.jpg"></a></p>
<p><a href="http://blog.wedoqa.com/wp-content/uploads/2010/10/screenshot_preview02.jpg"><br />
</a></p>
<p><strong><br />
</strong><strong> </strong><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/10/how-to-make-android-screenshots-for-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binding data with Spring Forms</title>
		<link>http://blog.wedoqa.com/2010/08/binding-data-with-spring-forms/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=binding-data-with-spring-forms</link>
		<comments>http://blog.wedoqa.com/2010/08/binding-data-with-spring-forms/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 18:22:43 +0000</pubDate>
		<dc:creator>Vilmos Somogyi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=134</guid>
		<description><![CDATA[Spring has its own tag library, which makes JSPs easier to develop, maintain and read. One of these libraries is the form tag library, and in this post we&#8217;ll demonstrate how to use it. For this we will use a sample project that will let us modify the user&#8217;s account details. In order to display]]></description>
			<content:encoded><![CDATA[<p>Spring has its own tag library, which makes JSPs easier to develop, maintain and read. One of these libraries is the form tag library, and in this post we&#8217;ll demonstrate how to use it.</p>
<p>For this we will use a sample project that will let us modify the user&#8217;s account details. In order to display the stored values for the account in the form, we have previously tied an object named foo to the session that holds all the information about our user&#8217;s account.</p>
<p>The form used for displaying and sending the account data is displayed here:</p>
<pre class="brush: xml; title: ; notranslate">&lt;form action=&quot;/account&quot; method=&quot;post&quot;&gt;
	&lt;fieldset&gt;
	&lt;legend&gt;Edit account information:&lt;/legend&gt;
	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;label for=&quot;name&quot; &gt;Name:&lt;/label&gt;&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;name&quot; value=${foo.name} /&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;label for=&quot;email&quot;&gt;E-mail:&lt;/label&gt;&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;email&quot; name=&quot;email&quot; value=${foo.email} /&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;label for=&quot;website&quot;&gt;Website:&lt;/label&gt;&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;website&quot; name=&quot;website&quot; value=${foo.website} /&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
	&lt;/table&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;</pre>
<p>Now lets do the implementation of the form tag library on this code:<span id="more-134"></span></p>
<pre class="brush: xml; title: ; notranslate">&lt;%@ taglib prefix=&quot;form&quot; uri=&quot;http://www.springframework.org/tags/form&quot; %&gt;

...

&lt;form:form action=&quot;/account&quot; commandName=&quot;foo&quot;&gt;
	&lt;fieldset&gt;
	&lt;legend&gt;Account information:&lt;/legend&gt;
	&lt;table&gt;
 		&lt;tr&gt;
			&lt;td&gt;&lt;label for=&quot;name&quot; &gt;Name:&lt;/label&gt;&lt;/td&gt;
			&lt;td&gt;&lt;form:input path=&quot;name&quot; /&gt;&lt;/td&gt;
		&lt;/tr&gt;
 		&lt;tr&gt;
			&lt;td&gt;&lt;label for=&quot;email&quot;&gt;E-mail:&lt;/label&gt;&lt;/td&gt;
			&lt;td&gt;&lt;form:input path=&quot;email&quot; /&gt;&lt;/td&gt;
		&lt;/tr&gt;
 		&lt;tr&gt;
			&lt;td&gt;&lt;label for=&quot;website&quot;&gt;Website:&lt;/label&gt;&lt;/td&gt;
			&lt;td&gt;&lt;form:input path=&quot;website&quot; /&gt;&lt;/td&gt;
		&lt;/tr&gt;
 		&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
 	&lt;/table&gt;
	&lt;/fieldset&gt;
&lt;/form:form&gt;</pre>
<p>The Spring&#8217;s form tag is included with Spring MVC, so you&#8217;ll need to be sure to have the spring-webmvc.jar in the classpath. To use it in a JSP page, just place a directive at the top of the page as we did above:</p>
<pre class="brush: xml; title: ; notranslate">&lt;%@ taglib prefix=&quot;form&quot; uri=&quot;http://www.springframework.org/tags/form&quot; %&gt;</pre>
<p>As you can see from the code, we have used two tags, the <strong>form:form</strong> and the <strong>form:input.</strong></p>
<p>For the <strong>form:form</strong> tag we have used two attributes:</p>
<ul>
<li><strong>action</strong> &#8211; the target URL like in a simple html form</li>
<li><strong>commandName</strong> &#8211; name of the session object that is used for getting and setting the values</li>
</ul>
<p>For the <strong>form:input</strong> tag:</p>
<ul>
<li><strong>path</strong> &#8211; binds the input field to a concrete property of a class</li>
</ul>
<p>Now that we are done with the changes to the JSP page, we can move on to modify our Spring controller:</p>
<pre class="brush: java; title: ; notranslate">@RequestMapping(&quot;/account&quot;)
public String updateAccount (
		@ModelAttribute(&quot;foo&quot;) Foo foo,
		Model model) {

	// use fooService to save the changes contained in the foo object
	fooService.saveFoo(foo);

}</pre>
<p>This code will run the updateAccount function when the &#8220;/account&#8221; URL is requested (once the form is submitted). This is also where Spring preforms its magic with data binding. By adding the ModelAttribute annotation to the parameter, we tell Spring to collect all the information that is available for the foo object, and to create a new object with the gathered data:</p>
<pre class="brush: java; title: ; notranslate">@ModelAttribute(&quot;foo&quot;) Foo foo</pre>
<p>Once we have the foo object, we can use it save the data to the database, or do whatever the business logic requires us to do.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/08/binding-data-with-spring-forms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Servlet Mapping for Google App Engine and Spring</title>
		<link>http://blog.wedoqa.com/2010/08/servlet-mapping-for-google-app-engine-and-spring/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=servlet-mapping-for-google-app-engine-and-spring</link>
		<comments>http://blog.wedoqa.com/2010/08/servlet-mapping-for-google-app-engine-and-spring/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 18:16:02 +0000</pubDate>
		<dc:creator>Vilmos Somogyi</dc:creator>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[servlet]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=131</guid>
		<description><![CDATA[This post is all about Spring MVC 3 and Google App Engine and their interaction. The starting point for this project was the Google App Engine&#8217;s documentation, the Google Eclipse plugin, and some tutorials found on various sites. After reading all about the App Engine and Spring, the first thing to do was to create]]></description>
			<content:encoded><![CDATA[<p>This post is all about Spring MVC 3 and Google App Engine and their interaction.</p>
<p>The starting point for this project was the <a  href="http://code.google.com/appengine/docs/java/overview.html">Google App Engine&#8217;s documentation</a>, the <a  href="http://code.google.com/appengine/docs/java/tools/eclipse.html">Google Eclipse plugin</a>, and some tutorials found on various sites.</p>
<p>After reading all about the App Engine and Spring, the first thing to do was to create a project in our favorite editor, Eclipse. This generated some necessary files, and gave us a good starting point. As we want to use Spring to perform all its magic, we&#8217;ve created a web.xml like this:</p>
<pre class="brush: xml; title: ; notranslate">&lt;servlet&gt;
    &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;

&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;</pre>
<p><span id="more-131"></span><br />
This configuration would redirect all incoming requests to our Spring Dispatcher Servlet that will handle everything from there on. At leaset that&#8217;s what we&#8217;ve thought. After firing up the local App Engine development server, an error appeared for every request issued from the browser (lets say http://localhost:8888/index). We have set up mapping for that particular url in our Spring controller, but we still got the same error:</p>
<pre class="brush: plain; title: ; notranslate">Jul 21, 2010 8:02:33 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/WEB-INF/views/index.jsp] in DispatcherServlet with name 'dispatcher'</pre>
<p>After some googling around, we have realized that there is no need for the wildcard in the url-pattern, but if we simply put &#8220;/&#8221; there, everything will work nicely.</p>
<p>My curiosity didn&#8217;t let me rest on this, so I have investigated a bit more. I wanted for every not specified url to fall back on the index page. Lets try adding the wildcard back to the web.xml, and also to include it in the Spring controller:</p>
<pre class="brush: java; title: ; notranslate">@RequestMapping(&quot;/*&quot;)
public String home (Model model) {
	return index(model);
}</pre>
<p>And again an error:</p>
<pre class="brush: plain; title: ; notranslate">Jul 21, 2010 8:04:32 AM org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver handleNoSuchRequestHandlingMethod
WARNING: No matching handler method found for servlet request: path '/WEB-INF/views/index.jsp', method 'GET', parameters map[[empty]]</pre>
<p>Okay, expectedly this didn&#8217;t go well, so the third combination was the winning one: no wildcard in web.xml, and with wildcard in the Spring controller. And here are the two final codes:</p>
<p>Web.xml</p>
<pre class="brush: xml; title: ; notranslate">&lt;servlet&gt;
    &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;

&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;</pre>
<p>Spring controller</p>
<pre class="brush: java; title: ; notranslate">@RequestMapping(&quot;/*&quot;)
public String home (Model model) {
	return index(model);
}</pre>
<p>This have solved the issue that we were having with the App Engine not wanting to forward to the Spring controller.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/08/servlet-mapping-for-google-app-engine-and-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solution for Selenium IDE &#8211; Your browser doesnt support Xml Http Request</title>
		<link>http://blog.wedoqa.com/2010/08/solution-for-selenium-ide-your-browser-doesnt-support-xml-http-request/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=solution-for-selenium-ide-your-browser-doesnt-support-xml-http-request</link>
		<comments>http://blog.wedoqa.com/2010/08/solution-for-selenium-ide-your-browser-doesnt-support-xml-http-request/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 16:43:38 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Selenium IDE]]></category>
		<category><![CDATA[Selenium Problem]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=126</guid>
		<description><![CDATA[If you get the &#8220;Your browser doesnt support Xml Http Request&#8221; error while running tests in Selenium IDE even if its shows that all tests passed below is the cure for it: This issue only happens on versions of Selenium IDE prior to 1.0.6 So there are two workarounds to this problem: 1) Get the]]></description>
			<content:encoded><![CDATA[<p>If you get the &#8220;Your browser doesnt support Xml Http Request&#8221; error while running tests<br />
in Selenium IDE even if its shows that all tests passed below is the cure for it:</p>
<p>This issue only happens on versions of Selenium IDE prior to 1.0.6</p>
<p>So there are two workarounds to this problem:</p>
<p>1) Get the newest version and use that (currently 1.0.7) :</p>
<p>http://seleniumhq.org/download/</p>
<p>2) Or if for whatever reason you are stuck with the version you have here is a workaround:</p>
<p>http://code.google.com/p/selenium/issues/detail?id=388</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/08/solution-for-selenium-ide-your-browser-doesnt-support-xml-http-request/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Selenium test in Java with Eclipse and JUnit</title>
		<link>http://blog.wedoqa.com/2010/07/selenium-test-in-java-with-eclipse-and-junit/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=selenium-test-in-java-with-eclipse-and-junit</link>
		<comments>http://blog.wedoqa.com/2010/07/selenium-test-in-java-with-eclipse-and-junit/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 15:28:31 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Selenium IDE]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=86</guid>
		<description><![CDATA[Its quite easy to run Selenium tests using Eclipse and JUnit. Basically all you need is to get Selenium RC: http://seleniumhq.org/download/ and get Eclipse (Eclipse Classic will do if you don&#8217;t need the rest, the Helios 3.6 already includes JUnit) http://www.eclipse.org/downloads/ to make things easier also get Selenium IDE (Firefox plugin for recoding tests and]]></description>
			<content:encoded><![CDATA[<p>Its quite easy to run Selenium tests using Eclipse and JUnit. Basically all you need is to get Selenium RC:</p>
<p><em>http://seleniumhq.org/download/</em></p>
<p>and get Eclipse (Eclipse Classic will do if you don&#8217;t need the rest, the Helios 3.6 already includes JUnit)</p>
<p><em>http://www.eclipse.org/downloads/</em></p>
<p>to make things easier also get Selenium IDE (Firefox plugin for recoding tests and exporting to the desired language)</p>
<p><em>http://seleniumhq.org/download/</em></p>
<p>Install Selenium IDE the rest just unpack to a desired dir and you are ready to roll. If you already have Eclipse its most likely</p>
<p>that you have JUnit as well but just in case you need it it can be found here:</p>
<p><em>http://www.junit.org/</em></p>
<p>Record some test case in Selenium IDE by opening up FireFox and going to Tools-&gt;Selenium IDE</p>
<p>For example open up blog.wedoqa.com and assert some text (or do whatever test you desire)</p>
<p>While Selenium IDE is running you can easily assert things by right clicking (except on web pages that</p>
<p>have their own right click handling) and looking at the bottom commands on the popup all those come from</p>
<p>Selenium IDE.</p>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/07/Selenium-IDE.jpg" class="thickbox no_icon" rel="gallery-86" title="Selenium IDE"><img class="aligncenter size-medium wp-image-94" title="Selenium IDE" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Selenium-IDE-300x172.jpg" alt="" width="300" height="172" /></a></p>
<p>After you have the desired test go to Options-&gt;Format and pick Java(JUnit) format and you&#8217;ll get the test formated for Java and JUnit</p>
<p>and will look something like this:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class Untitled extends SeleneseTestCase {
	public void setUp() throws Exception {
		setUp(&amp;amp;quot;http://blog.wedoqa.com/&amp;amp;quot;, &amp;amp;quot;*chrome&amp;amp;quot;);
	}
	public void testUntitled() throws Exception {
		selenium.open(&amp;amp;quot;/&amp;amp;quot;);
		assertTrue(selenium.isTextPresent(&amp;amp;quot;Because quality matters!&amp;amp;quot;));
	}
}</pre>
<p>Now start up Eclipse and create a new Java project and add in the selenium-java-client-driver.jar from selenium-remote-control-1.0.3selenium-java-client-driver-1.0.1</p>
<p>(note versions might be different but you get the idea of its location), you can choose to migrate the jar will make it easier if you give the project to someone etc. At this point</p>
<p>you can add the JUnit jar as well or let Eclipse auto add it when you create a JUnit Test Case.</p>
<p>Now add a JUnit Test Case to the project (in package explorer right click the desired location and pick new-&gt; JUnit Test Case:</p>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/07/Junit-test-case.jpg" class="thickbox no_icon" rel="gallery-86" title="Junit test case"><img class="aligncenter size-medium wp-image-106" title="Junit test case" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Junit-test-case-300x199.jpg" alt="" width="300" height="199" /></a></p>
<p>Copy in the code that the Selenium IDE generated. You&#8217;ll notice some errors fix them (the name of the class should be the same as the file that was just create</p>
<p>also fix the package or just remove it)</p>
<p>Now its time to run the test. Start up the Selenium server from console using <em>java -jar selenium-server.jar</em> or create a neat bat file that will do this for you every time</p>
<p>something like:</p>
<div id="_mcePaste"><em>cd E:Seleniumselenium-remote-control-1.0.3selenium-server-1.0.3</em></div>
<div id="_mcePaste"><em>E:</em></div>
<div id="_mcePaste"><em>java -jar selenium-server.jar</em></div>
<div><em><br />
</em></div>
<div>After the Server is started it should look something like this:</div>
<div><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/07/Selenium-server.jpg" class="thickbox no_icon" rel="gallery-86" title="Selenium server"><img class="aligncenter size-medium wp-image-107" title="Selenium server" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Selenium-server-300x152.jpg" alt="" width="300" height="152" /></a></div>
<div>Now run your test from Eclipse and watch the thing come to life <img src='http://blog.wedoqa.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<p>Happy testing! <img src='http://blog.wedoqa.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/07/selenium-test-in-java-with-eclipse-and-junit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Solution for Selenium already running on port problem</title>
		<link>http://blog.wedoqa.com/2010/07/solution-for-selenium-already-running-on-port-problem/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=solution-for-selenium-already-running-on-port-problem</link>
		<comments>http://blog.wedoqa.com/2010/07/solution-for-selenium-already-running-on-port-problem/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 14:40:07 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Selenium Problem]]></category>
		<category><![CDATA[Selenium RC]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=66</guid>
		<description><![CDATA[When running selenium server often it happens that it can&#8217;t start with the following error: &#8220;Selenium is already running on port 4444. Or some other service is.&#8221; This happens because Selenium uses the 4444 port as its default and if you already started selenium or some other application is using that port Selenium will be]]></description>
			<content:encoded><![CDATA[<p>When running selenium server often it happens that it can&#8217;t start with the following error:</p>
<p>&#8220;Selenium is already running on port 4444. Or some other service is.&#8221;</p>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture2.jpg" class="thickbox no_icon" rel="gallery-66" title="Selenium already running on port"><img class="aligncenter size-medium wp-image-68" title="Selenium already running on port" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture2-300x141.jpg" alt="" width="300" height="141" /></a>This happens because Selenium uses the 4444 port as its default and if you already started selenium or some other application is using that port Selenium will be prevented from using the same port.</p>
<p>There are several ways around this problem:</p>
<ul>
<li><strong>Find the application that is blocking/using the 4444 port and turn it off</strong> or change its port. Using the command <em>&#8220;netstat -ano&#8221;</em> (under Linux use &#8220;<em>netstat &#8211;tcp &#8211;listening &#8211;programs&#8221;</em>) from command prompt identify the applications PID and then look it up in task manager. If you don&#8217;t see the PID in task manager make sure to turn the column on in View-&gt;Select Columns:<img class="aligncenter size-medium wp-image-71" title="Task manager PID" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture11-300x191.jpg" alt="" width="300" height="191" /><br />
Once you have identified the application either kill it or change its port. Now its safe to run &#8220;<em>java -jar selenium-server.jar</em>&#8221; and Selenium will start up correctly.</li>
<li><strong>Change the port Selenium is using</strong>. Run &#8220;java -jar selenium-server.jar -port XXXX&#8221; where XXXX is the desired unused port for example &#8220;java -jar selenium-server.jar -port 4448&#8243;.<br />
This fix is also useful if you want several instances of the selenium server running on the same machine.</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/07/solution-for-selenium-already-running-on-port-problem/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Solution for Selenium IDE Export to C# problem</title>
		<link>http://blog.wedoqa.com/2010/07/solution-for-selenium-ide-export-to-c-sharp-problem/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=solution-for-selenium-ide-export-to-c-sharp-problem</link>
		<comments>http://blog.wedoqa.com/2010/07/solution-for-selenium-ide-export-to-c-sharp-problem/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 12:05:08 +0000</pubDate>
		<dc:creator>Tibor Dudjik</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Selenium IDE]]></category>

		<guid isPermaLink="false">http://blog.wedoqa.com/?p=49</guid>
		<description><![CDATA[[ad#WeDoQa blog TOP] When using the Selenium IDE to generate C# tests users get the following error &#8220;Suite export not implemented for the cs-rc formatter&#8221;: This happens because there is an error in the code that can&#8217;t convert from the default HTML Format to C#. The workaround is to go to Options -&#62; Format and]]></description>
			<content:encoded><![CDATA[<p>[ad#WeDoQa blog TOP]<br />
When using the Selenium IDE to generate C# tests users get the following error &#8220;Suite export not implemented for the cs-rc formatter&#8221;:</p>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture.jpg" class="thickbox no_icon" rel="gallery-49" title="Selenium IDE C# Error"><img class="aligncenter size-medium wp-image-54" title="Selenium IDE C# Error" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture-300x282.jpg" alt="" width="300" height="282" /></a></p>
<p>This happens because there is an error in the code that can&#8217;t convert from the default HTML Format to C#. The workaround is to go to Options -&gt; Format and then select C# &#8211; Selenium RC. Once converted you don&#8217;t need to export anything you can just save it or copy paste it to your C# test.</p>
<p><a  href="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture1.jpg" class="thickbox no_icon" rel="gallery-49" title="Selenium IDE Error"><img class="aligncenter size-medium wp-image-56" title="Selenium IDE Error" src="http://blog.wedoqa.com/wp-content/uploads/2010/07/Capture1-300x284.jpg" alt="" width="300" height="284" /></a></p>
<p>With this workaround you can also export existing saved selenium test cases from HTML or any of the others to C#. Just open up the saved test case and then switch to C# in Options -&gt; Format<br />
[ad#WeDoQA Bottom]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wedoqa.com/2010/07/solution-for-selenium-ide-export-to-c-sharp-problem/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

