Re: Issues testing file upload Servlet using SerlvetUnit
sriram srinivasan <[email protected]> Tue, 6 Oct 2009 10:08:34 -0700
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============9215124194398605376== Content-Type: multipart/alternative; boundary=000e0cd2114ed023f904754747e7 --000e0cd2114ed023f904754747e7 Content-Type: text/plain; charset=ISO-8859-1 Thanks Wolfgang, The only FAQ I find is from the main website: http://httpunit.sourceforge.net/doc/faq.html Could you provide me with a link to the FAQ for this mailing list? I do not see a link in the welcome message I got when I joined this list, so I'm struggling to locate that. I did find a unit test that you wrote in the SVN repo that does file upload: http://httpunit.svn.sourceforge.net/viewvc/httpunit/trunk/httpunit/test/com/meterware/httpunit/FileUploadTest.java?view=markup The issue here is that the HttpUserAgentTest functionality in use is running the test against a PsuedoServlet (MimeEcho), and I want to run my test against the servlet I wrote for FileUpload. I see the test (linked above) as totally valid for the context of HttpUnit/Servlet (you're testing the file upload capablities) but I do not easily see how I would inject my functionality into this example as the unit under test. Thanks Sriram 2009/10/6 Wolfgang Fahl <[email protected]> > Dear Sriram, > > you might want to have a try with version 1.7 and read the FAQ of this > mailing list. There you'll find a link to the subversion repository and > hints on how to find junit tests for a topic. I am pretty sure file upload > is covered. We are still looking for more people > to support the documentation of httpunit. > > Yours > Wolfgang > > Am 05.10.09 23:49, schrieb sriram srinivasan: > > I have a servlet with a method called uploadFile that takes Http Request > and Response objects as parameters and returns a byte array of the uploaded > file to the caller...which in this case is the doPost method. I am trying to > unit test the uploadFile method with servletUnit but I am getting this > exception <http://gist.github.com/202486> (http://gist.github.com/202486). > > I am using version 1.6.2. (This is a maven project). > > I googled and found the following links talking about problems that are > some what related > 1. http://osdir.com/ml/web.httpunit.devel/2005-02/msg00031.html > 2. http://osdir.com/ml/web.httpunit.devel/2005-11/msg00020.html > > I also looked in the unit tests for the project for way to handle this. I > searched the mail archives - that wasn't helpful. I went > through the tutorials, but don't see any examples on the homepage that > involve > file upload. > > Here <http://gist.github.com/202485> (http://gist.github.com/202485) is > the code(unit-test) that I have. > > > Any help or guidance is greatly appreciated. Thank you very much for your > time in advance. > > Regards, > -Sriram Srinivasan > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now!http://p.sf.net/sfu/devconf > > _______________________________________________ > Httpunit-develop mailing [email protected]://lists.sourceforge.net/lists/listinfo/httpunit-develop > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Httpunit-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/httpunit-develop > > -- -Sriram Srinivasan ----------------------------------- What ever you do assign it to god,Then sorrow will never be yours. --000e0cd2114ed023f904754747e7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div>Thanks Wolfgang,</div><div><br></div><div>The only FAQ I find is from = the main website: <a href=3D"http://httpunit.sourceforge.net/doc/faq.html">= http://httpunit.sourceforge.net/doc/faq.html</a> =A0Could you provide me wi= th a link to the FAQ for this mailing list? =A0I do not see a link in the w= elcome message I got when I joined this list, so I'm struggling to loca= te that.</div> <div><br></div><div>I did find a unit test that you wrote in the SVN repo t= hat does file upload:</div><div><br></div><div><a href=3D"http://httpunit.s= vn.sourceforge.net/viewvc/httpunit/trunk/httpunit/test/com/meterware/httpun= it/FileUploadTest.java?view=3Dmarkup">http://httpunit.svn.sourceforge.net/v= iewvc/httpunit/trunk/httpunit/test/com/meterware/httpunit/FileUploadTest.ja= va?view=3Dmarkup</a></div> <div><br></div><div>The issue here is that the HttpUserAgentTest functional= ity in use is running the test against a PsuedoServlet (MimeEcho), and I wa= nt to run my test against the servlet I wrote for FileUpload. =A0I see the = test (linked above) as totally valid for the context of HttpUnit/Servlet (y= ou're testing the file upload capablities) but I do not easily see how = I would inject my functionality into this example as the unit under test.</= div> <div><br></div><div>Thanks</div><div>Sriram</div><br><div class=3D"gmail_qu= ote">2009/10/6 Wolfgang Fahl <span dir=3D"ltr"><<a href=3D"mailto:wf@bit= plan.com">[email protected]</a>></span><br><blockquote class=3D"gmail_quote= " style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> =20 <div text=3D"#000000" bgcolor=3D"#ffffff"> Dear Sriram,<br> <br> you might want to have a try with version 1.7 and read the FAQ of this mailing list. There you'll find a link to the subversion repository and hints on how to find junit tests for a topic. I am pretty sure file upload is covered. We are still looking for more people <br> to support the documentation of httpunit. <br> <br> Yours<br> =A0=A0 Wolfgang<br> <br> Am 05.10.09 23:49, schrieb sriram srinivasan: <blockquote type=3D"cite"><div><div></div><div class=3D"h5">I have a servle= t with a method called uploadFile that takes Http Request and Response objects as parameters and returns a byte array of the uploaded file to the caller...which in this case is the doPost method. I am trying to unit test the uploadFile method with servletUnit but I am getting this <a href=3D"http://gist.github.com/202486"= target=3D"_blank">exception</a> (<a href=3D"http://gist.github.com/202486"= target=3D"_blank">http://gist.github.com/202486</a>). <br> I am using version 1.6.2. (This is a maven project).<br> <br> I googled and found the following links talking about problems that are some what related<br> 1. <a href=3D"http://osdir.com/ml/web.httpunit.devel/2005-02/msg00031.html"= target=3D"_blank">http://osdir.com/ml/web.httpunit.devel/2005-02/msg00031.= html</a><br> 2. <a href=3D"http://osdir.com/ml/web.httpunit.devel/2005-11/msg00020.html"= target=3D"_blank">http://osdir.com/ml/web.httpunit.devel/2005-11/msg00020.= html</a><br> <br> I also looked in the unit tests for the project for way to handle this.=A0 I<br> searched the mail archives - that wasn't helpful. I went<br> through the tutorials, but don't see any examples on the homepage that involve<br> file upload.<br> <br> <a href=3D"http://gist.github.com/202485" target=3D"_blank">Here</a> (<a href=3D"http://gist.github.com/202485" target=3D"_blank">http://gist.gi= thub.com/202485</a>) is the code(unit-test) that I have.<br> <br clear=3D"all"> <br> Any help or guidance is greatly appreciated. Thank you very much for your time in advance.<br> <br> Regards,<br> -Sriram Srinivasan<br> <br> <br> </div></div><pre><fieldset></fieldset>-----------------------------------= ------------------------------------------- Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay= =20 ahead of the curve. Join us from November 9&#45;12, 2009. Register now&= amp;#33; <a href=3D"http://p.sf.net/sfu/devconf" target=3D"_blank">http://p.sf.net/s= fu/devconf</a></pre> <pre><fieldset></fieldset>_______________________________________________ Httpunit-develop mailing list <a href=3D"mailto:[email protected]" target=3D"_blank"= >[email protected]</a> <a href=3D"https://lists.sourceforge.net/lists/listinfo/httpunit-develop" t= arget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/httpunit-deve= lop</a> </pre> </blockquote> <br> </div> <br>-----------------------------------------------------------------------= -------<br> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA<= br> is the only developer event you need to attend this year. Jumpstart your<br= > developing skills, take BlackBerry mobile applications to market and stay<b= r> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&= amp;#33;<br> <a href=3D"http://p.sf.net/sfu/devconf" target=3D"_blank">http://p.sf.net/s= fu/devconf</a><br>_______________________________________________<br> Httpunit-develop mailing list<br> <a href=3D"mailto:[email protected]">Httpunit-develop@= lists.sourceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/httpunit-develop" t= arget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/httpunit-deve= lop</a><br> <br></blockquote></div><br><br clear=3D"all"><br>-- <br>-Sriram Srinivasan<= br>-----------------------------------<br>What ever you do assign it to god= ,Then sorrow will never be yours.<br> --000e0cd2114ed023f904754747e7-- --===============9215124194398605376== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf --===============9215124194398605376== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Httpunit-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/httpunit-develop --===============9215124194398605376==--