{"id":47,"date":"2009-04-22T12:16:27","date_gmt":"2009-04-22T06:46:27","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=47"},"modified":"2016-12-19T15:04:55","modified_gmt":"2016-12-19T09:34:55","slug":"grails-functional-testing-uploading-a-file-in-input-typefile-tag-using-g-func-plugin","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/grails-functional-testing-uploading-a-file-in-input-typefile-tag-using-g-func-plugin\/","title":{"rendered":"Grails Functional Testing: Uploading a file using G-Func plugin"},"content":{"rendered":"<p>At Intelligrape we face many challenges while developing web-applications. One of the small challenge was to test the web pages that contains file input field <strong>&lt;input type=&#8221;File&#8221;&gt;<\/strong>(to upload files). After few hours drilling with Canoo webtest plugin I decided to use the new fabulous plugin, Grails functional Testing by Marc Palmer (http:\/\/www.grails.org\/Grails+Functional+Testing).<\/p>\n<p>The syntax for setting value for the file input field is<\/p>\n<pre lang=\"groovy\">NameOfFileInputField.setValueAttribute(\"PathOfFileAsString\")<\/pre>\n<p>Let me explain you with an example:<br \/>\nFollowing component&#8217;s HTML is<\/p>\n<pre lang=\"html\"><input name=\"FileInputField\" type=\"file\" \/><\/pre>\n<p><input name=\"FileInputField\" type=\"file\" \/><\/p>\n<p>The name of the file input field is <strong>FileInputField.<\/strong>The code for setting value\/path will be<\/p>\n<pre lang=\"groovy\">FileInputField.setValueAttribute(\"testFile.txt\")<\/pre>\n<p>any kind of suggestions and comments are welcome\u2026\u2026<\/p>\n<p>Cheers,<br \/>\nChandan Luthra<\/p>\n<p><a href=\"http:\/\/www.tothenew.com\">www.IntelliGrape.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>At Intelligrape we face many challenges while developing web-applications. One of the small challenge was to test the web pages that contains file input field &lt;input type=&#8221;File&#8221;&gt;(to upload files). After few hours drilling with Canoo webtest plugin I decided to use the new fabulous plugin, Grails functional Testing by Marc Palmer (http:\/\/www.grails.org\/Grails+Functional+Testing). The syntax for [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4},"categories":[7],"tags":[14,78,4840,9],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}