RE: StrutsTestCase, jUnit and file upload

2012-04-26 Thread Steve Higham
Thanks to Chris, Gabriel for your comments. I finally got this to work yesterday. A neat solution probably requires refactoring StrutsTestCase and deriving a new class (StrutsMultipartTestCase) from it. In the meantime the following changes will work subject to a couple of limitations: - This onl

Re: StrutsTestCase, jUnit and file upload

2012-04-25 Thread Chris Pratt
First of all, I assume you're trying to test your own code, not the framework. With that in mind, by the time the file gets to your action, it's just a series of parameters (which could be slightly different depending on which underlying Multipart support you are using). So, my suggestion would be

Re: StrutsTestCase, jUnit and file upload

2012-04-25 Thread Gabriel Belingueres
Coincidentally, yesterday I was struggling with testing a file upload. I was not using S2 as web framework but I was using Commons Fileupload, which IIRC is the default S2 upload component. I must say that my first strategy was trying to use Spring's MockMultipartHttpServletRequest and MockMultipa