Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test-driven development for JSPs specifically

Tags:

java

tdd

jsp

tomcat

I've been writing test-driven code even before understanding what TDD actually was. Calling functions and classes without having its implementation helps me understand and build my application in a much faster and efficient way. So I'm very used the process of writing code->compiling it->seeing it fail->fixing it by building its implementation.

This process is a bit harder for the Web. Specifically JSPs. When I compile my Java classes, all it's fine, I can see the compile errors. However seeing errors in the JSPs require me to open a browser and call that specific JSP.

Is there a way to avoid this process and show me the JSP compile errors without actually loading up a browser?

like image 826
Luca Matteis Avatar asked Nov 28 '10 10:11

Luca Matteis


1 Answers

Sure. You can pre-compile JSP. There is even ant task that does it. Please refer to link: http://ant.apache.org/manual/Tasks/jspc.html

But I think that this is only first step. This will allow you to see compilation errors. I think that you wanted more, i.e. unit tests. I believe that tools like Jakarta Cactus (or others) may help you.

BTW recently I found the following resource that enumerates a huge number of java testing tools.

like image 75
AlexR Avatar answered Oct 06 '22 06:10

AlexR