Functional testing of output files when output is not deterministic (or with low control)

Once upon a time, I had to test a program that creates an image of a postscript file. One quick way to find out if the program is creating the correct one, the expected result was to make the result md5 to compare with the md5 “known good” output, which I checked beforehand.

Unfortunately, Postscript contains the current time in the file. This time, of course, is different depending on when the test passes, therefore changing the md5 of the result, even if the expected result is obtained. As a fix, I just deleted the date from sed.

This is a good and simple scenario. We are not always so lucky. For example, now I am programming a writer program that creates a large thick RDF file containing a bunch of anonymous nodes and uuids. In principle, it is impossible to test the functionality of the entire program using simple md5, and the only way is to read the file using a reader, and then check the result through this reader. As you probably understand, this opens up a new possibility for worms: first, you must write the reader (which can take a lot of time), and secondly, you think that the reader is functionally correct and at the same time synchronous with the author. If both the reader and the writer are synchronized, but with incorrect assumptions, the reader will say “no problem”, but the file format is actually erroneous.

This is a common problem when you need to perform functional testing of a file format, and the file format is not fully reproduced using the input you enter. How do you handle this business?

+3
source share
2 answers

( - , ). , , . . , , , , , " ", .

+1

? , , ? , diff . , , (md5 ). , ( ) , .

, . MPEG-2, . PSNR , . , - .

+1

Source: https://habr.com/ru/post/1725169/


All Articles