aspose file tools*
The moose likes Testing and the fly likes StrutsTestCase Exception - Not reading few <init-param> parameters in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "StrutsTestCase Exception - Not reading few <init-param> parameters in web.xml" Watch "StrutsTestCase Exception - Not reading few <init-param> parameters in web.xml" New topic
Author

StrutsTestCase Exception - Not reading few <init-param> parameters in web.xml

Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 459
    
    1
I'm using StrutsTestCase for unit testing my code but I'm getting javax.servlet.ServletException: init parameter struts-filter-config not set in web.xml exception whilst running my test case.

Initially Test Class was not reading web.xml file but after setting context directory in setup() that issue is resolved.



The code snippet of web.xml where the issue is occuring is as under:



There is velicity related servlet defined above this servlet and its working fine. The code is giving same error even if I remove all <init-param> in above class. Unfortunately I cannot share the code due to organisational directives. Pointers in resolving the issue would be appreciated.


Vinod Tiwari | Twitter
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 459
    
    1
Issue resolved, there is setInitParameter(java.lang.String key, java.lang.String value) method in MockStrutsTestCase class using which Init Params can be set.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: StrutsTestCase Exception - Not reading few <init-param> parameters in web.xml