I am using Struts 2 to create a web application. I am using StrutsTestCase
for Junit test case to test the Action class. I have imported struts2-junit-plugin-2.3.4.jar
as I am using struts2-core-2.3.4.jar
. Inside the testcase method, when i tried to set the request parameters, request variable is not available for use. it is showing compilation error. I am getting 'request cannot be resolve' error. In my test class i am extending StrutsTestCase
which has request as protected parameter. But it is not available inside extended method.
My test action looks like this:
import org.apache.struts2.StrutsTestCase;
public class WallPlanningActionTest extends StrutsTestCase {
public void testList() {
request.setParameter("salesOrg",1);
}