• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Test/Debug AJAX?

 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are there any special concerns or techniques when it comes to testing and debugging an AJAX web app? I find testing web apps in general to be a pain. Does it get worse with all the JabberScipt?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One problem is how many brosers there are and if you coded it to meet their requirements/settings. If you use a framework than you know it is okay. If you use OO JvaScript you are even better off.

For debugging do a search on Google for: JavaScript venkman

Eric
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is interesting when somebody starts talking about AJAX application programming, it, automatically, means JavaScript programming. So, AJAX program debugging is a JavaScript debugging as well. This meaning, actually, might have a good outcome in the future and a lot of well designed JavaScript tools appear on the market.
Personally, I suggest that using JavaScript hard codding is absolutely unnecessary when we speak about JSF and AJAX. JSF is like a SWING, but for the web. Does the SWING require any client scripting?
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JavaScript Toolkit
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sergey Smirnov:
JSF is like a SWING, but for the web. Does the SWING require any client scripting?



I smell a syllogistic fallacy. While JSF leads to a component-like approach to JSPs, if you create your own component, it will likely involve scripting. And maybe things are different for you, but I find my JSF+JSP pages involves some little tweaks that cause me to add bits of scripting to the page, manually.

There are various approaches to mixing JSF and AJAX, and I'm only beginning to take that in, but I expect some approaches may ask the programmer to roll up his sleeves and write more JavaScript. Or am I wrong on this count?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sergey Smirnov:
It is interesting when somebody starts talking about AJAX application programming, it, automatically, means JavaScript programming. So, AJAX program debugging is a JavaScript debugging as well. This meaning, actually, might have a good outcome in the future and a lot of well designed JavaScript tools appear on the market.
Personally, I suggest that using JavaScript hard codding is absolutely unnecessary when we speak about JSF and AJAX. JSF is like a SWING, but for the web. Does the SWING require any client scripting?



Well the thing is this: Everyone should know how to debug an application on the server, but probably have no clue how to do it on the client. Since Ajax is the XHR object which is JavaScript, most people want to know how to test this portion.

Eric
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This is a page from Implementing dependent select boxes in JSF example. The page is shown from top to bottom. There is no application JavaScript there, right? If you need to debug such application, you will debug the server side code. The client side script provided by the components. You do not need to write or modify it.

The third example from Exadel VCP:



This example is similar to the previous one, but <ajax:support> component enhances the standard <h:selectOneListbox> making it AJAXable. No javaScript is required here also. <ajax:support> defines the client side event and part of the page that should be re-rendered during the AJAX request-response cycle. you do not have to care about gathering data, creating the XMLHTTP object, sending the AJAX request, receiving the response and updating a part of the page. The framework code does it for you.
[ April 07, 2006: Message edited by: Sergey Smirnov ]
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergey,

There is still JavaScript code on the page. There can still be issues with it if the person that developed it did mistakes. I have found a lot of bugs in frameworks already and they still exist. You ned to learn how to debug the JavaScript. Just because you are using a framework or library does not mean there is not JavaScript involved.

One example is this. Take that code. Add a session. Set the timeout to a small peroid of time. Log in. Goto that page and wait. After your timeout period make a request. Will the code fail?

Another example is I log bugs on my application. I klept getting an error message on my pages from the server. I fianlly realized it was a 3rd party plug in. It was throwing errors with a certain setting. I found tha out by using Javascript debugging tools. I was able to go to them and tell them what the problem was.

Eric
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
There is still JavaScript code on the page. There can still be issues with it if the person that developed it did mistakes. I have found a lot of bugs in frameworks already and they still exist. You ned to learn how to debug the JavaScript. Just because you are using a framework or library does not mean there is not JavaScript involved.



Exactly.

As an experienced Swing developer, now and again I debug into Swing code. Sometimes just to find out what about how I used it was wrong.
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:

Exactly.
As an experienced Swing developer, now and again I debug into Swing code. Sometimes just to find out what about how I used it was wrong.

How many time you spend to debug the part of the SWING that represents UI on the screen such as drawing the border lines? JSF stands for JavaServerFaces. So, it is not a secret that server plays important important role. Should this specific reflects on the paradigm, how the AJAX works? I cannot say for MyFaces and ADF, but in Exadel VCP the Javascript plays very limited role bringing request data from clent to server and replacing the portions of the page when the response comes. There is no application specific javascript code and end developer does not have to write it.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How many time you spend to debug the part of the SWING that represents UI on the screen such as drawing the border lines?



That is not JavaScript. That is the browser putting CSS/HTML onto the page from the backend. It is writing HTML to the page. Sometimes if you throw a strict doc type on the page, IE and Firefox will not show the borders. There will be debugging in your code to figure out what caused the borders not to show up. A lot of people may not realize it is a doc type. (I have seen questions like this, esp. with older frameworks!)

When you are talking about a framework that is using Ajax, they are putting HTML on the page and they are putting JavaScript on the page. Trust me, those few lines of code you are talking about can be bad.

For example if they did not use a try catch around the ActiveX control, IE will throw an error if activeX is disabled. Not good.

If they are displaying an error message with Mozilla and uses statusText it can throw an error. I have seen frameworks that did not cover this error. It would be important to be able to spot these things.

These things are what my new talk is about. So many people overlook basic errors and think that their frameworks are perfect. There are too many browsers, versions, settings, OS, RAM, memory, multiple programs running, add ons, and so on to test for. Hence why errors occur.

I code Ajax applications for a living and see errors all the time that people have never seen. I have to debug this stuff and find a solution!

I have tested frameworks for people and I have found issues in them.

Now if you need to develop an Ajax compnent that no framework can support, that is when debugging Ajax really is important. The clientside with a framework is like a blackbox. You have no clue what is happening, but some magic happens and your info from the server appears on the client. There might be a problem in that blackbox. You need to learn the tools to find that problem.

Also Everyone knows how to debug their serverside applications. WHY? Because we have been doing it for a long time. We log the errors, we use error messages, etc. Those same things apply to the serverside in Ajax applications. Why? The server sees a POST or GET. It has no clue if it is a form, a link, or the XHR object.

I personally hate frameworks and libraries. WHY? Because I know how to fix my code when it is broken. I know how to debug it. I know how it was written. I have a good test team and I log my clientside errors for those weird cases.

Eric
[ April 07, 2006: Message edited by: Eric Pascarello ]
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergey,

Also

Do a view source on that page that you said had no JavaScript on it. Look for the JavaScript that is injected. Could be an external js file or it can be inline code. If it uses Ajax, then you should find some JavaScript since it is Asynchronous JavaScript And XML. Heck they could use a JavaApplet, iframes, or flash!

Eric
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What Eric is trying to say is that even though you wouldn't have to write any JavaScript yourself, using server-side framework X, you still might need to debug a problem by looking at both what you wrote (JSF markup) and what the framework has generated into the HTML.
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lasse Koskela:
What Eric is trying to say is that even though you wouldn't have to write any JavaScript yourself, using server-side framework X, you still might need to debug a problem by looking at both what you wrote (JSF markup) and what the framework has generated into the HTML.


Yep! If all you have is a hammer, everything looks like a nail. Eric and I came to here from the different positions and have the different areas of expertise. Actually, we are here now because Jonas and John presents thier new book. So, I would like to pospone this dispute right now to let forum readers concentrate on the main topic.
Thank you Eric for your interesting suggestions. It was a previlage for me to discuss with you. See you soon.
 
Maybe he went home and went to bed. And took this tiny ad with him:
Master Gardener Program
https://coderanch.com/t/771761/Master-Gardener-Program
reply
    Bookmark Topic Watch Topic
  • New Topic