wood burning stoves 2.0*
The moose likes Spring and the fly likes Spring security with JUnit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring security with JUnit " Watch "Spring security with JUnit " New topic
Author

Spring security with JUnit

Mohan rvscas
Ranch Hand

Joined: Jul 03, 2010
Posts: 39
Hi friends ,

i am new to spring security.

i have created a login form with username and password.

(mapping also done with authority in applicationContext.xml file).

i am getting username and password from the data base.

By using spring security the user name and password is checked properly.

after running the form its executing properly and iam getting correct page.


Now,

i need to test the methods using junit test cases.

in spring security we are using jar file to login and providing access through the <interceptor-url> tags.

here no need to write the code.

so i do not know how to test the login form using junit test cases.

please give me the solution.

if you have any references please give me.

Thanks in advance


Mark Secrist
Ranch Hand

Joined: Jul 01, 2003
Posts: 89
What methods are you wanting to test? What you are suggesting sounds more like an integration test than a unit test. If you are wanting to test the security mechisms or your configuration of them via the spring config files, you might want to use a browser based test tool like CubicTest/Selenium. This would allow you to test loging in with proper user, invalid user, etc.

Without more information, it's hard to make a better recommendation.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Spring security with JUnit
 
Similar Threads
JAAS, mixing cofigs ..
set original page for j_security_check
JUnit integration with EJB and Spring
Spring binding in FreeMarker not working
Integrating Spring & JDBC into JSF2 login page