Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

does not contain handler parameter named 'method'. This may be caused by whitespace

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am testing ACTION class using JUNIT(WSAD5.1.2) ,I am getting a bug whle testing it

JUNIT is throwing an error as given below
servletunit.struts.ExceptionDuringTestError: An uncaught exception was thrown during actionExecute()
at servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:546)
at com.sbc.dcomm.ui.cart.pa.actions.PAActionTest.testSession(PAActionTest.java:73)


Console output is as given below :
ServletRedirector: init
DispatchActio E org.apache.struts.actions.DispatchAction Request[/pricingAnalysis] does not contain handler parameter named 'method'. This may be

caused by whitespace in the label text.
RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class javax.servlet.ServletException

JAVASCRIPT CODE for opening the screen :

function openPricingAnalysis()
{
var id= document.pAActionForm.id.value;
var str = 'pricingAnalysis.do?method=createPricingAnalysis&id='+id;
window.open(str,"PAT","scrollbars=yes,status=no,statusbar=no,width=800,height=600");
}

CODE FROM CONFIG FILE :
<action path="/pricingAnalysis" name="popUpForm" scope="request" type="com.sbc.dcomm.ui.cart.pa.actions.PAAction" parameter="method">
<forward name="success" path="/cart/pa/paAnalysis.jsp"/>
</action>

CODE FROM ACTION CLASS :

public Map getKeyMethodMap() {
Map map = new HashMap();
map.put("pricing.createPricingAnalysis", "createPricingAnalysis");

Could you please look into this issue and find out the solution as fast as possible.
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Further to above ,I am using struts framework for my application
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TEST CASE CLASS :

public void testPricing()
{

setConfigFile("/WEB-INF/struts-config-pa.xml");
setRequestPathInfo("/pricingAnalysis");
//setRequestPathInfo("/pricingAnalysis.do");
addRequestParameter("id","1097");
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward("success");


}
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the JavaScript function takes method as a parameter with value of method name.I have added one more line of code in the method for method parameter.

addRequestParameter("method","createPricingAnalysis");

public void testPricing()
{

setConfigFile("/WEB-INF/struts-config-pa.xml");
setRequestPathInfo("/pricingAnalysis");
addRequestParameter("method","createPricingAnalysis");
addRequestParameter("id","1097");
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward("success");


}
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now the error does not say "Request[/pricingAnalysis] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text."

But it does throw following error :

JUNIT console says:
servletunit.struts.ExceptionDuringTestError: An uncaught exception was thrown during actionExecute()
at servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:546)
at com.sbc.dcomm.ui.cart.pa.actions.PAActionTest.testSession(PAActionTest.java:73)



Application (Server)Console output is as given below :
[dcomm-ui] [/dcomm-ui] [Servlet.LOG]: ServletRedirector: init

RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class javax.servlet.ServletException
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solution :
I have not set method name in my test case method ,I have set it as follows :
addRequestParameter("method", "createPricingAnalysis");

Problem got solved
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junit does not work with LookUpDispatchAction,it would work with DispatchAction instead.Hence you need to extend DispatchAction instead of LookUpDispatchAction
 
ranger
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas,
It looks like you posted a solution followed by a statement that you could not find a solution and therefore had to abandon the use of LookupDispatchAction; which was it?

Thanks,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic