[ 
https://issues.apache.org/jira/browse/PDFBOX-1977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13932046#comment-13932046
 ] 

Michael McCandless commented on PDFBOX-1977:
--------------------------------------------

[~tilman] I'm confused: the test seems to do 10 iterations, picking a random 
seed every time, and then if there is a failure, it reports which seed leads to 
the failure?

[~jahewson] I agree tests must be deterministic, and, with the specified seed, 
this test is.  The randomization allows us to test a wide range of data without 
sacrificing reproducibility.  In Lucene we make heavy use of this, picking 
random codecs, random documents, etc. ... Lucene's testing framework has since 
been factored out as a separate project: 
https://github.com/carrotsearch/randomizedtesting

I wrote this brief blog post about Lucene's randomized tests a while back: 
http://blog.mikemccandless.com/2011/03/your-test-cases-should-sometimes-fail.html

Had the seed in this test been constant, this issue would not have been found.  
It's because the seed is randomly selected that the test finally produced a 
sequence of data that provokes the bug.

> LZWFilter fails / TestFilters is non-determinate
> ------------------------------------------------
>
>                 Key: PDFBOX-1977
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1977
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.5, 2.0.0
>            Reporter: John Hewson
>            Assignee: Tilman Hausherr
>              Labels: LZW
>             Fix For: 1.8.5, 2.0.0
>
>
> TestFilters uses Random().nextLong() to generate a seed for random data, 
> which means that it is non-determinate. Depending on the seed value, the test 
> may fail or succeed.
> Using the following seed results in the LZW filter failing:
> final long seed = -6257105096642706464L;



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to