• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

test my jsp of my web application no in the networc company

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
How can test a jsp that use the tag of spring and the controlle exends the simpleformcontroller of my webapplicatio but I am not on the network company so I don't find the databes,webservise and other.
Someone can suggest me there is a way??

thans

D.Donato
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are describing here, including the controllers, application, database, webservices, is not Unit Testing. That sounds very much like an Integration Test to me.

Unit testing the presentation layer is, and always has, been a difficult task. But there are a couple of tools in the kit that we can use.

First off you can use a web testing tool such a Selenium to drive and observe the Browser user interface. These sorts of tools hook into the browser using the xpath, DOM id, or DOM class. The advantage of these sorts of tools is that they're relatively easy to get going with. The downside is that they require a browser to be installed to run and can be quite picky with what browsers and versions they're run with. Another downside is that if you change the UI you may break your tests. This leads your tests to be pretty flakey.

Secondly you can use something like JspTest which will directly test the data being passed up to the presentation layer in the JSP tags. While you are not testing the layout of your UI (which you probably shouldn't be doing anyway) it will test that the required data is being received correctly and for submission data is being sent correctly. You are now testing the functionality of your presentation layer with a Unit Test which is really what we want to be doing. (Disclaimer: I haven't used JspTest, just read about it in Lasse Koskela's Test Driven book).

If you setup your test cases so that the controllers are mocked out then you do not need access to anything beyond that to run your presentation Unit Tests. So lack of network access will not be a problem.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic