Is this your first time here? SwingWiki is a Java Swing Developer community site with an big archive of Swing-related usenet groups and mailing lists, but also tips, tricks and articles and book reviews written by your colleagues from around the world. If you came here through a search engine and did not find what you were looking for, make sure to check the wiki table of contents.

Re: [Jmagick] Testing JMagick

From:"Jacob Nordfalk" [jacob.nordfalk@masked-domain]
Sent on:Wed, 26 Mar 2008 10:39:03 +0545
In reply to:[Jmagick] Testing JMagick sent on Thu, 28 Feb 2008 11:55:12 +0545 by "Jacob Nordfalk" [jacob.nordfalk@masked-domain]
Now almost a month have passed (so my proposal is definitely approved :-).

I would very much like some feedback from more of you:

1) Did you try the tests?
2) Did they run OK? (please send error reports)
3) Do you understand the principle? Would it be easy enough for you to
contribute with some tests?

Jacob


2008/2/28, Jacob Nordfalk <[jacob.nordfalk@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).
>
>
>
>
> --
> Jacob Nordfalk
> http://javabog.dk
> Skype: jacobnordfalk
>


--
Jacob Nordfalk
http://javabog.dk
Skype: jacobnordfalk
_______________________________________________
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.
Found what you were looking for? If not - continue at Wiki Index

Other messages in this topic

SenderDate sentSubject
"Terence M. Bandoian" [terence@masked-domain]Fri, 29 Feb 2008 16:51:29 -0600Re: [Jmagick] Testing JMagick
"Jacob Nordfalk" [jacob.nordfalk@masked-domain]Thu, 28 Feb 2008 22:45:03 +0545Re: [Jmagick] Testing JMagick
Bob Friesenhahn [bfriesen@masked-domain]Thu, 28 Feb 2008 09:43:50 -0600 (CST)Re: [Jmagick] Testing JMagick
"Jacob Nordfalk" [jacob.nordfalk@masked-domain]Thu, 28 Feb 2008 11:55:12 +0545[Jmagick] Testing JMagick

 
Recent changes | RSS changes | Table of contents | News Archive | Terms And Conditions | Register | The Quest For Software++| Ruby Resources
FitNesse Resources