<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Functional testing in Grails just got a bit sexier</title>
	<atom:link href="http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/</link>
	<description>Grails, Apple, usability and world stuff</description>
	<lastBuildDate>Thu, 26 Jan 2012 17:27:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: João Paulo</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-193957</link>
		<dc:creator>João Paulo</dc:creator>
		<pubDate>Thu, 16 Jun 2011 15:05:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-193957</guid>
		<description>Hi!

Just to help anyone that might come here looking for info on how to test file uploads, here is the code of the test that I got to work:

void testRemoveReport() {
		FileWriter writer = new FileWriter(new File(&quot;newReport.txt&quot;));
		PrintWriter out = new PrintWriter(writer);
		out.println(&quot;Blablabla&quot;);
		out.close();
		writer.close();
		
		(here i get the page where i can upload a report)
		
		form() {
			report.contentType = &quot;text/plain&quot;
			report.data = new File(&quot;newReport.txt&quot;).bytes
			report.valueAttribute = new File(&quot;newReport.txt&quot;).absolutePath
			click &quot;Submit&quot;
		}
		
		assertContentContains &quot;newReport.txt&quot;
	}

The only unmentioned thing here was the valueAttribute bit, where you have to set to the absolute path of your file.

Hope I can help someone!</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>Just to help anyone that might come here looking for info on how to test file uploads, here is the code of the test that I got to work:</p>
<p>void testRemoveReport() {<br />
		FileWriter writer = new FileWriter(new File(&#8220;newReport.txt&#8221;));<br />
		PrintWriter out = new PrintWriter(writer);<br />
		out.println(&#8220;Blablabla&#8221;);<br />
		out.close();<br />
		writer.close();</p>
<p>		(here i get the page where i can upload a report)</p>
<p>		form() {<br />
			report.contentType = &#8220;text/plain&#8221;<br />
			report.data = new File(&#8220;newReport.txt&#8221;).bytes<br />
			report.valueAttribute = new File(&#8220;newReport.txt&#8221;).absolutePath<br />
			click &#8220;Submit&#8221;<br />
		}</p>
<p>		assertContentContains &#8220;newReport.txt&#8221;<br />
	}</p>
<p>The only unmentioned thing here was the valueAttribute bit, where you have to set to the absolute path of your file.</p>
<p>Hope I can help someone!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javen</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-157838</link>
		<dc:creator>Javen</dc:creator>
		<pubDate>Sun, 21 Feb 2010 03:01:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-157838</guid>
		<description>Hi Marc,

I have two testCases in a Class, such as testCase1(),testCase2()
How can I only run one?</description>
		<content:encoded><![CDATA[<p>Hi Marc,</p>
<p>I have two testCases in a Class, such as testCase1(),testCase2()<br />
How can I only run one?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Palmer</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-150578</link>
		<dc:creator>Marc Palmer</dc:creator>
		<pubDate>Tue, 13 Oct 2009 12:14:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-150578</guid>
		<description>Duncan thanks for that - I&#039;ll add to g-func docs online.</description>
		<content:encoded><![CDATA[<p>Duncan thanks for that &#8211; I&#8217;ll add to g-func docs online.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Sommerville</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-150525</link>
		<dc:creator>Duncan Sommerville</dc:creator>
		<pubDate>Mon, 12 Oct 2009 16:00:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-150525</guid>
		<description>Managed to figure this out:

 class MyFunctionalTests extends FunctionalTestCase {
  void testMyThing() {
   client.getCredentialsProvider().addCredentials(&quot;username&quot;,&quot;password&quot;)

    ...
  }
 }</description>
		<content:encoded><![CDATA[<p>Managed to figure this out:</p>
<p> class MyFunctionalTests extends FunctionalTestCase {<br />
  void testMyThing() {<br />
   client.getCredentialsProvider().addCredentials(&#8220;username&#8221;,&#8221;password&#8221;)</p>
<p>    &#8230;<br />
  }<br />
 }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duncan Sommerville</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-150523</link>
		<dc:creator>Duncan Sommerville</dc:creator>
		<pubDate>Mon, 12 Oct 2009 15:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-150523</guid>
		<description>It is possible to do &#039;digest authentication&#039; with this plugin?

I&#039;ve hada look on HtmlUnit which talks about using &#039;addCredentials()&#039;, which sounds promising, - but how to I attach these properties when using this plugin?</description>
		<content:encoded><![CDATA[<p>It is possible to do &#8216;digest authentication&#8217; with this plugin?</p>
<p>I&#8217;ve hada look on HtmlUnit which talks about using &#8216;addCredentials()&#8217;, which sounds promising, &#8211; but how to I attach these properties when using this plugin?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Palmer</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-133834</link>
		<dc:creator>Marc Palmer</dc:creator>
		<pubDate>Wed, 22 Apr 2009 08:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-133834</guid>
		<description>John - that is not (yet) how file uploads are handled. The object you get when accessing a file upload field is a HtmlUnit HtmlFileInput instance. You need to set the contentType and data properties on it:

http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlFileInput.html</description>
		<content:encoded><![CDATA[<p>John &#8211; that is not (yet) how file uploads are handled. The object you get when accessing a file upload field is a HtmlUnit HtmlFileInput instance. You need to set the contentType and data properties on it:</p>
<p><a href="http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlFileInput.html" rel="nofollow">http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlFileInput.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Palmer</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-133833</link>
		<dc:creator>Marc Palmer</dc:creator>
		<pubDate>Wed, 22 Apr 2009 08:41:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-133833</guid>
		<description>Guarav it sounds like your onclick handling is not being called by the HtmlUnit browser, or there is some nuance with simulated alert dialogs. I will JIRA &amp; look into it.</description>
		<content:encoded><![CDATA[<p>Guarav it sounds like your onclick handling is not being called by the HtmlUnit browser, or there is some nuance with simulated alert dialogs. I will JIRA &#038; look into it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Palmer</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-133832</link>
		<dc:creator>Marc Palmer</dc:creator>
		<pubDate>Wed, 22 Apr 2009 08:40:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-133832</guid>
		<description>Greg - functional tests run after bootstrap is run - G-Func builds and runs the entire app before running tests.</description>
		<content:encoded><![CDATA[<p>Greg &#8211; functional tests run after bootstrap is run &#8211; G-Func builds and runs the entire app before running tests.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Bridges</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-133570</link>
		<dc:creator>Greg Bridges</dc:creator>
		<pubDate>Mon, 20 Apr 2009 14:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-133570</guid>
		<description>I tried to use BootStrap.groovy to set up some test data before the tests execute, but it appears to run the tests before BootStrap is executed. Is there a different way to accomplish this?</description>
		<content:encoded><![CDATA[<p>I tried to use BootStrap.groovy to set up some test data before the tests execute, but it appears to run the tests before BootStrap is executed. Is there a different way to accomplish this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav</title>
		<link>http://www.anyware.co.uk/2005/2009/01/08/functional-testing-in-grails-just-got-a-bit-sexier/comment-page-1/#comment-133377</link>
		<dc:creator>Gaurav</dc:creator>
		<pubDate>Sat, 18 Apr 2009 08:13:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=381#comment-133377</guid>
		<description>Hi Marc,

             I am using the impressive Functional Testing Plugin with my Grails App. I have this scenario and i am unable to find a solution for it. I have 2 buttons in my Form &quot;APPROVE&quot; and &quot;DISAPPROVE&quot; when the user click on &#039;DISAPPROVE&quot; an alert box is shown to user and when he click on OK then only we process the form If he click on &quot;CANCEL&quot; then nothing happens. 

           As of now i am using the following Code: 

        form(&#039;approvalForm&#039;)    {
            click &#039;Disapproval&#039;
        }
        click &#039;Cancel&#039;
        assertStatus 200

But as it clicks on Disapproval the form get&#039;s processed at it&#039;s own and i get an error stating that &#039;Cancel&#039; not found. I know that i am using javascript alert() to show that pop-up box so is there any way to simulate this behavior ?

 Any help will be appreciated.

regards
gaurav</description>
		<content:encoded><![CDATA[<p>Hi Marc,</p>
<p>             I am using the impressive Functional Testing Plugin with my Grails App. I have this scenario and i am unable to find a solution for it. I have 2 buttons in my Form &#8220;APPROVE&#8221; and &#8220;DISAPPROVE&#8221; when the user click on &#8216;DISAPPROVE&#8221; an alert box is shown to user and when he click on OK then only we process the form If he click on &#8220;CANCEL&#8221; then nothing happens. </p>
<p>           As of now i am using the following Code: </p>
<p>        form(&#8216;approvalForm&#8217;)    {<br />
            click &#8216;Disapproval&#8217;<br />
        }<br />
        click &#8216;Cancel&#8217;<br />
        assertStatus 200</p>
<p>But as it clicks on Disapproval the form get&#8217;s processed at it&#8217;s own and i get an error stating that &#8216;Cancel&#8217; not found. I know that i am using javascript alert() to show that pop-up box so is there any way to simulate this behavior ?</p>
<p> Any help will be appreciated.</p>
<p>regards<br />
gaurav</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 9/24 queries in 0.034 seconds using disk: basic

Served from: www.anyware.co.uk @ 2012-02-10 15:46:50 -->
