Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Newbie having problems with StrutsMocktestCase

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I was trying to practice a Struts tutorial of testing a UserRegistrationActionTest by extending MockStrutsTestCase in MyEclipse IDE. When I ran the Action class as a Junit, I get 3 errors.
This is the trace
junit.framework.AssertionFailedError
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:284)
at strutsTutorial.struts.UserRegistrationActionTest.setUp(UserRegistrationActionTest.java:28)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Here is the code for the UserRegistrationActionTest

Please help me figure out the problem!
Thanks in advance
Vidya moorthy
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you follow the API's note :
NOTE: By default, the Struts ActionServlet will look for the file WEB-INF/struts-config.xml, so you must place the directory that contains WEB-INF in your CLASSPATH. If you would like to use an alternate configuration file, please see the setConfigFile() method for details on how this file is located.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vidya Moorthy:
Are you studing struts by the book "JakartaStrutsLive"?
I do it.But I also have many issues .Can you show me the code of class "JDBCTestUtils".
I really can't find the code in the book.

Thanks
 
Vidya Moorthy
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here it is

I have lot of problems too because that book is based on Struts 1.1 and many methods are deprecated now.
I am not able to finish it only
 
Hannibal Ou
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your code!
I also feel it is so hard that when you have a book which using Struts1.1 but you work environment is based on struts 1.2x.
Because my struts is version 1.2.15. So I reading the book with google!When the compiler throws a warning that I used a deprecated method I will search in google to check which method we should used to instead of the deprecated method.
So if any question you have maybe I also have,I hope can study this books together and can I have your MSN or Skype?
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/731949/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic