advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
Average Rating: 2.9/5 | Rate this item | 24 users have rated this item.
Build a Java Web App Using HttpUnit and the Test-driven Methodology, Part I (cont'd)
Put Your Application to the Test
Now test the revised version of the code to see if the application passes. Perform the following steps:
  1. Stop Tomcat by typing ./shutdown.sh in the bin directory in the Tomcat distribution.
  2. Change your working directory to ~/projects/phonelist.
  3. Type ant undeploy.
  4. Type ant deploy.
  5. Start Tomcat by typing ./startup.sh in the bin directory in the Tomcat distribution.
advertisement

You can try out the application at http://localhost:8080/phonelist/showList.do. The application should display the list of contacts successfully.

Go back to the ~/projects/phonelist directory and type "ant test". The showlist test should now pass because the URL it tests contains content and has four or more rows in a table with the title "Phone List".

You still have to build the following functions: delete contacts, new contact, and edit contact. You also need to write the tests for those functions. In fact, you should write the tests before implementing the functionality.

In this article, Part I of "Build a Java Web Application Using HttpUnit and Test-driven Methodology", you have learned the difference between programmatic API-driven testing and recorded macro-driven testing. You have also seen how HttpUnit complements the JUnit functionality to provide testing capability for Web applications, which ordinarily are difficult to test using only JUnit because they use HTTP calls rather than Java method calls. Finally, you have gone through a step-by-step setup of a test-driven environment and its accompanying functionality, as well as writing a test. In Part II, you will complete the example, performing more tests and filling out the functionality of the phone list application.

Previous Page: The Required XML Descriptors for Your Web App  
Wellie Chao has been active in the business of technology for many years, has been involved with software and hardware since 1984, and has been writing Web-based software in a variety of languages and on different platforms since 1994. .
Page 1: IntroductionPage 5: Write Your Tests, Classes, and JSPs
Page 2: Build and Implement an Electronic Phone ListPage 6: The Required XML Descriptors for Your Web App
Page 3: Define Targets for Your Web AppPage 7: Put Your Application to the Test
Page 4: Group Targets Together 
Please rate this item (5=best)
 1  2  3  4  5
advertisement