I have been playing with the idea of using ImageMagic (im4java) to do a comparison of known good page renders against stored good pages.
I have got this working on a test site, but all my images (good, bad and differrent) are stored in my c:\temp folder. I have been toying with the idea of having the "expected" images kept inside the project folder structure, so when the project is checked out, the expected images are there.
(not saying this is a great solution, this is just something I have been playing with.)
So my test is stored in /src/test/java/my.screen.test/compareTest.java and I have my "expected" image in /masterImages/test.png
I have tried various ways to reference this:
I included masterImages in the build path and then tried to use InputStream input = getClass().getResourceAsStream("/masterImages/googleHomePage1.png"); (I then thought I could simply use input.toString() to pass into im4java - but the InputStream gave me nullpointer exception) I also tried removing the masterImages from the buildpath and trying it that way.
I have also tried String path = getClass().getClassLoader().getResource("masterImages/googleHomePage1.png").toString(); Again, null pointer. I know there is something stupid I am not seeing here, like I said this started as me playing but it's now annoying me why I can't get it to work.
Any insights into what I am missing greatly appreciated.