Pierpaolo
Pierpaolo

Reputation: 559

Can JStestDriver be used to test js code within JSP files?

Quick question:

It is possible to do unit testing, particularly with JStestDriver, on Javascript code written inside JSP files?

Or I have to necessarily extract it into external js files?

Upvotes: 2

Views: 627

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24627

The JavaScript source with the substitutions from the compiled JSP have to be extracted into separate files. Here is an example using CoffeeScript:

For JSP in particular, it is necessary to find the path to the compiled output and debug the result. Use jspc, the JSP compiler, to test the output with JsTestDriver.

The jspc command-line tool enables you to precompile JSPs at the command line.

You must disable dynamic reloading of JSP when deploying a web application archive that has precompiled JSP without the corresponding jsp source files.

References

Upvotes: 0

Related Questions