What are some approaches to testing Javascript when dynamic HTML templating systems (such as JSP, PHP, etc) are used? If I have a static HTML page then there are a variety of Javascript testing tools that can be used.
Though with a JSP, there are JSTL variables that are evaluated to produce HTML. The HTML that is finally produced can then be used by the Javascript functions to do the manipulation, ajax calls, etc.
How do y开发者_如何转开发ou test?
Usually, it is not a good idea to mix javascript and dymanic parameters. I.e. you should avoid:
var foo = '${bar}'
Ideally, you should have a javascript that does not depend on any external parameters, by providing defaults. Then these defaults can be overridden by the dynamic values.
Either way, you can use Selenium to functionally test your page.
精彩评论