RE: Can I pass parameters to ServletTestCase ?
"Nicholas Dierauf" <[email protected]>
| Newsgroups | gmane.comp.jakarta.cactus.user |
|---|---|
| Message-ID | <CFF3C71613AD464B97B9BA232E246172012A90D3@msgusawmb01.ads.autodesk.com> |
I believe that you would have to modify the ServletTestRunner servlet in order to accept parameters. You may want to look into writing a data-driven test instead. When I need configurable test like this, I add a suite() method to the Cactus test to read from a configuration file, such as an XML file. You can then iterate through the configuration file and generate a test case for each item. This way you can just modify the configuration file instead of updating and recompiling the java file every time you want to add a new test case. J.B. Rainsberger's JUnit Recipes has a great chapter on writing data-driven tests. Good luck, Nick. -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Wed 11/22/2006 8:13 AM To: [email protected] Cc: Subject: RE: Can I pass parameters to ServletTestCase ? If you are interested in passing parameters, take a look at this page, http://jakarta.apache.org/cactus/writing/howto_testcase.html, under Step 6. I haven't actually used this functionality. I am still having a problem running cactus tests from a JUnit TestRunner. The only test runner I can use at this point is ServletTestRunner. So, it is not looking like Cactus will be used if I can't resolve the problem of running cactus tests from the command line. I think this forum is sort of dead. Hope that helps, Dan -----Original Message----- From: Jean-Charles Giardina [mailto:[email protected]] Sent: Wednesday, November 22, 2006 8:26 AM To: Cactus User Subject: Can I pass parameters to ServletTestCase ? Hi, Can I pass URL parameters to a ServletTestCase ? I want to test more and more value with the same test method. I don't want to recompile to change value. I want to use an URL like : http://localhost/ServletTestRunner?suite=my.tests.MyTest&foo=bar where "foo" is the parameter name and "bar" is the parameter value. Thks --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]