I'm wondering if there is a program out there that can test .js files. I'm interested in not having to test them manually by actually running them, but I'd be looking for a more automated way of doing it. I would be happy if all I had was some confirmation that they would load without error.
Anyone know of such a thing?
thanks in advance for your time and patience.
02-02-2004, 06:53 PM
If a script has even one syntax error (such as for example a missing bracket) it will not run - as simple as that.
You need to test your scripts thoroughly for both run-time errors which throw when the script is run, and logic errors where syntax is correct but the outcome is not what was desired.
Testing is the msot important stage in the development of any program. You cannot skimp or short-circuit it.
Hi, thanks for your reply.
Perhaps I did not make myself clear. I'm not looking to short circuit the testing process, but rather I'm looking to automate it.
If I have several hundred scripts to keep track of, it would be more efficient for me to be able to have a program checking it for me and reporting problems accordingly.
I guess I'm trying to find out if this is possible.
02-02-2004, 07:11 PM
Well, you can chech entirely destroyed scripts for syntax errors without finding any problems. However, most script errors depends on the document-script-browser interaction, and that is what you have to test - in all browsers you want it to run in.
"Well, you can chech entirely destroyed scripts for syntax errors"
How? Is there a program out there that does this?
I understand what you are saying regarding how the scripts interact with browsers, but I'm just trying to figure out what's going to work best for my situation.
02-03-2004, 04:15 AM
02-03-2004, 09:28 AM
After that, send it through mozilla with strict warnings enabled. See to that you don't cause ANY warnings. Then you send it through op7. And finally ie6w. Fix any bugs at current stage before moving on to the next one.
If it still doesn't work, insert alerts or prompts telling you the state of things before and after you change them. Alert types. Alert objects. Alert whether properties and methods exist or not.
02-03-2004, 06:34 PM
alerting the typeof() of a variable is also a useful debugger. And an alert('') can even be useful just to test if an if branching is going as planned.
I tried the jsint thing. It looks pretty useful. But I don't know how it's error reporting is. Example:
(3) : error at character 47: Bad HTML: :
Does that mean line 3, column 47? That's the doctype that's been w3c validated. :confused:
02-03-2004, 06:59 PM
Alerting typeof for objects, object members and variables was what I meant by "Alert types"...