- This topic has 3 replies, 2 voices, and was last updated 18 years ago by Riyad Kalla.
-
AuthorPosts
-
shirodkar4Memberhi,
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.
Riyad KallaMemberJUnit 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.
shirodkar4Memberi 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
Riyad KallaMemberYou 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.
-
AuthorPosts