• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

j2ee testing for beginner

 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After I completed a 20-class, 5-jsp, 1 servlet system, I found myself overwhelmed on how to test the whole thing. I am stuck even on testing individual components.

Any tips for new j2ee developer? (you can include ejb and web service on your comments.)

(I come from procedural programming background that is why I am a 'dummy' at testing this mentioned system.)

Will appreciate your comment.

(This is one of the 2 items I got stuck in this system; the other one is 'designing the system'.)
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suspect this is an HTML-based web application we're talking about? If so, I'd suggest starting with looking into the JWebUnit library. JWebUnit is a library for simulating a web browser. In other words, you can tell it to "navigate" to a URL and then perform assertions against the HTML content the library received from the URL in question.
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it is an html internet application; although it does jdbc and mq at the back.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesus Angeles:
Yes it is an html internet application; although it does jdbc and mq at the back.


By "MQ" do you mean standard JMS or is your code using proprietary APIs from a specific vendor such as IBM (WebSphere MQ)?

If it's all standard interfaces, I might try the following setup:
  • Let the tests start an embedded HSQLDB instance (for JDBC)
  • Let the tests start an embedded ActiveMQ instance (for JMS)
  • Deploy the web application on an embedded Jetty instance (configured to connect to HSQLDB and ActiveMQ)
  • Exercise the user interface with JWebUnit
  • Exercise suitable portions of business logic directly since you're running within the same JVM as the system under test

  •  
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    It is an IBM MQ type.
     
    Ranch Hand
    Posts: 109
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I didn't notice what development environment you use. We use Rational Application Developer which includes Websphere Application Server. So to test, I can just take an HTML for, example, and click "Run on Server" and my local server starts up and runs the application. It also has testing capability built in for Web services so that you can just test a web service directly or start up the web service requester and then watch a TCPIP monitor that shows you the SOAP messages going between them. In otherwords, Rational has everything. Sounds like a commercial but I'm not sure how I would do this type of testing without it.
     
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Dan Walin:
    In otherwords, Rational has everything. Sounds like a commercial but I'm not sure how I would do this type of testing without it.



    I am hoping my company upgrades from WSAD 5.X to RAD. (Being a government company who is trying to keep in budget so that the government wont outsource the whole IT department, upgrading is a little slow.)

    Are you able to do both unit test, and system test on RAD? So if you need unit test and system test only, RAD is all you need?

    I have seen RAD include stuff like code coverage.
     
    Dan Walin
    Ranch Hand
    Posts: 109
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    By "system test" I assume you mean connect to other components (other than the code I'm working on)? The answer to that is "yes" - at least with the limited scope of the things I develop. For example, we pull messages from a Websphere MQ queue on one server or write to DB2 on another server but the servlet we're testing can still run on the local WAS6 environment. You can create the necessary JNDI datasources locally to do that. You can even have another workstation call your servlet if you have it running and give the other person your ip address. I keep learning new things we can do all the time.
     
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Dan Walin:
    By "system test" I assume you mean connect to other components (other than the code I'm working on)? The answer to that is "yes" - at least with the limited scope of the things I develop. For example, we pull messages from a Websphere MQ queue on one server or write to DB2 on another server but the servlet we're testing can still run on the local WAS6 environment. You can create the necessary JNDI datasources locally to do that. You can even have another workstation call your servlet if you have it running and give the other person your ip address. I keep learning new things we can do all the time.



    That is done also where I work. To lessen traffic in the test server, we are encouraged to use local server, while still connecting to the same DB2 and MQ system.

    Actually, I dont even know how to test. (I am familiar with procedural stuff.)
     
    No holds barred. And no bars holed. Except this tiny ad:
    New web page for Paul's Rocket Mass Heaters movies
    https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
    reply
      Bookmark Topic Watch Topic
    • New Topic