I want to test all the jasper reports of my application. I want to be able to detect:
JasperCompileManager.compileReport(some inputStream)
doesn´t throw JRException
is a good option for this?)JasperFillManager.fillReport(someReport, someParameters, someDataSource)
doesn´t throw JRException
is a good option for this?)Ideally I would like to keep the testing process the most generic possible. The thing is that each jasper has a different data source so for detecting this errors i need to generate at list some data (right?) and this data I need to generate is different for each jasper of my application. So i don´t know how much testing code I would be able to reuse. What approach would you take?
Thanks!
I created a couple of unit test for testing aspects.
Compilation problems: I created a class to load and compile all of my templates. My enviornment is web-based. So I tested the path through this as well.
For filling: I mocked data and JRDataSource to fill a template, that works find for me.
For Rendering: I haven't found a good approach to do it. Anyone got ideas?
And also, I usually use JavaBean data source so that I can test the reports using a traditional java unit test method.