iText单元测试和自动测试问题 [英] iText Unit Testing and Automated Testing Questions

查看:225
本文介绍了iText单元测试和自动测试问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找iText程序的一些单元测试而没有运气。有人知道任何这样的测试吗?另外,有没有人知道开发人员是否在iText上使用任何自动测试工具,例如Jenkins?

I have been searching for some unit tests for the program iText with no luck. Is anyone aware of any such tests? Also, does anyone know if the developers use any automatic testing tools on iText, such as Jenkins?

推荐答案

在内部,我们使用Jenkins以及TeamCity。

Internally, we use Jenkins as well as TeamCity.

我们有两种类型的测试:

We have two types of tests:


  1. 添加新核心功能时添加的测试,您可以在Maven预期的位置找到它们:每个Maven项目都有一个带有2个子目录的 src 目录: main test 。例如:如果您查看iText核心,您将找到已发布的内容这里和测试这里。大多数这些测试都建立在我们的 testutils

  2. 当我们在SO上提问或者为书籍创建代码示例时添加的测试。对于这些,我们使用通用测试类,例如 GenericTest SandboxSampleWrapper 。包装器类使得创建测试变得简单。将样本转换为测试所需要做的就是添加 @WrapToTest 注释。好吧,实际上涉及的更多:在编写样本时需要遵循特定的模式:始终使用 SRC DEST 对于源PDF和生成的PDF,总是使用 createPdf() manipulatePdf()方法,并始终给出cmp文件名与 DEST 文件同名,前缀为 cmp _

  1. The tests that are added when new core functionality is added, you can find them where Maven expects them: each Maven project has a src directory with 2 sub directories: main and test. For instance: if you look at iText core, you'll find the released stuff here and the tests here. Most of these tests are built on top of our testutils.
  2. The tests that are added when we get questions on SO or when we create code samples for the books. For these we use a generic test classes such as GenericTest and SandboxSampleWrapper. The wrapper class makes creating a test a no-brainer. All you need to do to turn a sample into a test is adding the @WrapToTest annotation. Well, actually there's more involved: you need to follow a specific pattern when writing a sample: always use SRC and DEST for source PDFs and resulting PDFs, always use a createPdf() or manipulatePdf() method, and always give the cmp file the same name as the DEST file prefixed with cmp_.

在这两种情况下,您都可以找到名称以 cmp _ 开头的PDF文件,例如参见 cmpfiles文件夹。在这两种情况下,您都会找到对Ghostscript和比较工具的引用(您需要配置它们)。

In both cases, you'll find PDF files of which the name starts with cmp_, see for instance the cmpfiles folder for the examples. In both cases, you'll find references to Ghostscript and a compare tool (you'll need to configure these).

这篇关于iText单元测试和自动测试问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆