2

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?

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
Pierpaolo
  • 567
  • 3
  • 7
  • 17
  • Did you try it out? What happened? – epascarello May 25 '12 at 11:46
  • actually, I didn't, because I do not have any clue about it. I mean you cannot load the JSP file in the load section of the JSTD cofiguration file... – Pierpaolo May 25 '12 at 13:29
  • 1
    Maybe it is possible using the workaround of this answer: http://stackoverflow.com/questions/14636735/event-listeners-js-test-driver/14642901#14642901 – Uooo Feb 01 '13 at 09:18

1 Answers1

0

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

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265