After several hours surfing the web looking for an answer to this issue, finally I decided to post the question here.
I'm using the struts 2 junit plugin to test some actions of a struts 2 application. The main struts config file (struts.xml) is something like this:
<struts>
<package name="default" extends="struts-default">
</package>
<include file="/com/jmc/textil/productcard/action/productcard.xml"/>
<!--More includes...-->
</struts>
The productcard.xml file:
<struts>
<!--Some other packages...-->
<package name="productClasification" namespace="/productClasification" extends="default">
<!--More actions...-->
<action name="edit" method="edit" class="com.jmc.textil.productcard.action.ProductClasificationAction">
<result>/main/jsp/json_struts2.jsp</result>
</action>
</package>
</struts>
I have a test class that extends StrutsTestCase, and a test method for "/productClasification/edit" action. When the following call is made:
ActionProxy proxy = getActionProxy("/productClasification/edit.action");
ProductClasificationAction clasificationAction =
(ProductClasificationAction) proxy.getAction();
an exception is thrown because the action could not be located. By default, StrutsTestCase uses struts.xml but what about other struts configuration xml files?
Thanks in advance.