facebook

running Junit test case on struts based project

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #263928 Reply

    shirodkar4
    Member

    hi,

    i am completely new to Junit testing

    could anyone help me with how to run the Junit test in MyEclipse for the struts based project.

    i have a index.jsp page which has two fields login and password

    these are linked to UserAction.java and UserForm.java(the action class and the form for it).

    if the authentication is correct then it displays the wellcome.jsp
    if the authentication fails it displays the index.jsp page again.

    #263953 Reply

    Riyad Kalla
    Member

    JUnit is solely intended for unit-tests… meaning small specific tests. For example, like writing a unit test to make sure your form takes the name/password arguments correctly, that it’s validate and reset methods work and so on. JUnit is not going to help you test the actual flow of your application, like logging in and so on. Also JUnit is basically just a glorified normal class file, so in order to test your classes from it, you need to be able to instantiate them. This might prove hard for the Struts classes since I believe they will want session references and other Servlet instances that you won’t have access to during test time.

    Try googling “Struts unit testing”, I believe there are specialized frameworks for testing Struts apps for these purposes.

    #264406 Reply

    shirodkar4
    Member

    i have found a struts test framework but i cant understand how do i link it with my MyEclipse so that when i create a new testcase i get an option for a new struts test case with the superclass of the struts rather than the basic junit testcase framework.
    the link where i downloaded the struts testing framework is http://sourceforge.net/project/showfiles.php?group_id=39190

    #264415 Reply

    Riyad Kalla
    Member

    You are going to need to use the new Class wizard and not the JUnit wizards. Those wizards are hard-coded to create simple JUnit test cases, they aren’t aware of all the optional test platforms out there.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: running Junit test case on struts based project

You must be logged in to post in the forum log in