Vahid,

Vahid wrote
> Is it possible to write unit tests for programs based on the iText or
> iTextSharp?

Yes, to a certain extent.

> If yes, what should be tested? because the result is a binary file and
> it's a highly visual medium...

That depends on the functional specification of your code.

If it is specified to add some form field at some location, you can easily
check the result document for the presence of that field using AcroFields.

If it is specified to add some image or text on some page, you can use the
classes from the iText parser package to analyze the contents of that page.

...

If it is specified to create a beautyful flyer, though, you might be at a
loss when trying to measure beauty.

Regards,   Michael

PS: Obviously there is some hazard in using the same library to create
something and test it. You can mitigate this by using libraries by different
vendors for production and test code, or at least different versions of the
same library, e.g. the current stable iText 5.x for the production code and
some fixed "trusted" iText version 5.y or even 4.2 ("trusted" as in "bugs
and shortcomings are well known")  for test methods.

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Unit-tests-tp4268660p4268853.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to