I use a single instance of JasperReportsServer Enterprise, this means that I use the same host for testing as well as production. I ran into a problem where I was making some minor changes and it broke a set of reports, the bad part is I didn’t know they were broken till my users started to send me emails. With a larger set of reports on the horizon, I needed to come up with a plan to test the currently installed reports so I catch problems before any client does.
The plan I put into place seems to work fine for my situation, so I thought I would share what I did.
- Create a servlet (it could be a script) that allows me to run a report and return the data in csv format.
- Run the report and export the data to a file in csv format. Save to a directory call “expected”.
- Create a Junit test that calls the the servlet and dumps the data to a file. Then open the file in the “expected” directory and diff them.
I did this with each test and on error I email myself the results.
Here is how I setup my eclipse project.