Re: [Jmagick] Testing JMagick
| From:"Terence M. Bandoian" [terence@masked-domain] |
| Sent on:Fri, 29 Feb 2008 16:51:29 -0600 |
| In reply to:<mailman.1.1204246802.26437.jmagick@yeo.id.au> |
Hi-
Does 1) mean not testing against JDK1.5 at all?
-Terence M. Bandoian
> Date: Thu, 28 Feb 2008 11:55:12 +0545
> From: "Jacob Nordfalk" <[jacob.nordfalk@masked-domain]>
> Subject: [Jmagick] Testing JMagick
> To: [jmagick@masked-domain]
>
> Hi all,
>
> My proposed JUnit testing scheme for JMagick is ready.
> Please comment if you disagree on any of these things. If no
> objections are made in 5 days I will consider all the below APPROVED
> by the jmagick community.
>
> For those that don't know about Unit testing, the idea is to write
> some methods that use JMagick in different ways and then to compare
> the result against expected values and report an error if the results
> are not as expected. See also http://junit.org/ and
> http://junit.sourceforge.net/junit3.8.1/index.html .
>
> For JMagick I propose
> 1) we use JUnit 3 (that is, JDK1.4 no fancy new things from JDK1.5).
> 2) we maintain a collection of 'correct output' images to compare with
> in 'test/correct_output'
> 3) all accepted tests are in package 'magicktest'. All
> new/proposed/not finished/not yet accepted tests are in package
> 'magicktest.BETA'
> 4) the goal is to get 100% code coverage, that is: Running the test
> suite should activate all JMagick methods.
>
> When 100% code coverage is acieved is will be muuuch easier and safer
> to edit the source code of JMagick:
> * any errors introduced will show up in the tests (probably, at least :-).
> * Any new incompatibilities becaurse of IM code change will
> immediately be found.
> * we can safely (without breaking anything) move to other ways of
> usingIM/GraphicsMagick functions from Java and keep compatibility
> (I have automatick exposure/code generation usning JNA in mind -
> others consider using the much easier C++ API).
>
>
>
> In test/magicktest is the test classes. All test classes are here, and
> not in src/ anymore.
>
> Eric's old simpe 'test' (Test.java - but it's really more some
> examples of usage than a test) have been renamed to
> 'OldSimpleTest.java'
>
> Eric's work has been convertet to a JUnit test case in
> TestJMagick.java. Please have a look now before you continue reading:
> http://jmagick.svn.sourceforge.net/viewvc/jmagick/test/magicktest/TestJMagick.java?view=markup
>
> Here in an example:
>
> 65 ImageInfo info = new ImageInfo(Testtools.path_input + "pics.jpg");
> ...
> 75 image = new MagickImage(info);
> ...
> 82 assertEquals("X resolution is ", 72, image.getXResolution(), 0.1);
> 83 assertEquals("Y resolution is ", 72, image.getYResolution(), 0.1);
>
> The methods assertEquals() CHECKS that the return value of
> image.getYResolution() is 72 (+/- 0.1) and if this is not the case an
> exetion is thrown and the test fails.
> Now: THAT is (unit) testing.
>
>
> Here in another example:
>
> 116 public void testRaise() throws Exception {
> 117 // Raise image
> 118 image.raiseImage(new Rectangle(0, 0, 10, 20), true);
> 119 MagickTesttools.writeAndCompare(image, info, "raised.jpg");
> 120 }
>
> Here we use a utility method MagickTesttools which writes the image in
> the directory test/actual_output ("test/actual_output/raised.jpg") and
> then compares this image with "test/correct_output/raised.jpg". If any
> differences are found (within a small margin) then an exception is
> thrown and the test fails.
>
>
> Please check out/update from SVN and try it!
> UNIX command line users should be able to just wrtie 'make test' (but
> you need to install junit.jar in lib/ directory).
> Windows/GUI users should configure their project to include JUnit
> testing and run the class TestJMagick.
> Please report any problems you may have.
>
> In test/correct_output is images as they are expected to be. If you
> have made an update to JMagick and wants to generate a new set of
> 'correct' output images you should 'make generateCorrect' or run the
> class GenerateCorrectOutput and follow the instructions.
>
>
> I look forward to hear your reactions!
>
> I hope everyone will try the new test suite on as many platforms as
> possible and report any success/failure.
>
> Some tests are dependent on the fonts installed on the system and will
> thus probably fail. These have been '_failMightBeOk' in their name (to
> not upset you).
_______________________________________________
JMagick mailing list
[JMagick@masked-domain]
http://www.yeo.id.au/mailman/listinfo/jmagick
Please ensure that [JMagick@masked-domain] is a recipient when replying.
Other messages in this topic