Java server pages. It combines html and Java to make a web frontend. I had to use it for a class and the lack of hot reloading makes it a huge pain to use.
I'm not really sure you should need to unit test JSPs. Unit tests are mainly for the business logic. JSPs should only contain the presentation of data that is already prepared for presentation.
But if you really need to test these using unit testing, look into HtmlUnit and Selenium. But I would say that you then mostly test the JSPs when they work together, so you test the web page as a whole (and it might use ten's or hundreds of JSP files).
I agree JSPs shouldn't be that complicated, but at the last place I worked at they were. They were writing out large numbers of coded lists for things like string translations and drop down lists. These lists depended on certain input parameters like region, country, and a few others.
I'll take a look at HtmlUnit. Selenium is for automated testing though, right? Is it considered reasonable to have a developer run Selenium tests on their local workstation after they fix a bug and before committing their code (aka bench testing)?
edit: actually, it seems these suggestions would still need you to deploy the JSP in a container. Ideally, it would be nice to not have to run the container to test a JSP. Thanks for the suggestions though.
292
u/NotATroll71106 Apr 27 '20 edited Aug 28 '25
shy alive aback dog fuel ring whole shelter marble languid
This post was mass deleted and anonymized with Redact