[译]EUnit——erlang的轻量级单元测试框架(2)
原文:
二、术语
2.1 单元测试
测试一个程序单元以让它规定进行工作。 当以后程序因为一些原因需要修改,单元测试这时就有另一个重要的功能——来作回归测试,用来测试它是否还按照规定工作
2.2回归测试
在修改程序时,运行一系列测试来检查它是否按照修改之前工作(当然前提是没有想要修改它的行为)。单元测试是很重要的回归测试,但回归测试不只是单元测试,它还要测试可能不是它正常规定的一部分的行为(and may also test behaviour that might not be part of the normal specification)。
2.3 集成测试
测试一系列单独的开发程序单元(这儿假定它们已经单独进行过单元测试)一起是否按规定工作。在系统开发完成之后,集成测试有点像另一个层次的单元测试,但它也可能牵涉到其他的测试。
2.4 系统测试
测试整个系统是否按规定运行。一般来说,系统测试不需要知道任何实现的细节。它一般不用来测试基本功能,只用来从多个角度测试系统行为(如性能、适用性和稳定性)。
2.5 测试驱动开发
XXX
2.6 Mock object
xxx
2.7 测试实例
xxx
2.8 测试集
xxx
译文:
Terminology
- Unit testing
- Testing that a program unit behaves as it is supposed to do (in itself), according to its specifications. Unit tests have an important function as regression tests, when the program later is modified for some reason, since they check that the program still behaves according to specification.
- Regression testing
- Running a set of tests after making changes to a program, to check that the program behaves as it did before the changes (except, of course, for any intentional changes in behaviour). Unit tests are important as regression tests, but regression testing can involve more than just unit testing, and may also test behaviour that might not be part of the normal specification (such as bug-for-bug-compatibility).
- Integration testing
- Testing that a number of individually developed program units (assumed to already have been separately unit tested) work together as expected. Depending on the system being developed, integration testing may be as simple as "just another level of unit testing", but might also involve other kinds of tests (compare system testing).
- System testing
- Testing that a complete system behaves according to its specification. Specifically, system testing should not require knowing any details about the implementation. It typically involves testing many different aspects of the system behaviour apart from the basic functionality, such as performance, usability, and reliability.
- Test-driven development
- A program development technique where you continuously write tests before you implement the code that is supposed to pass those tests. This can help you focus on solving the right problems, and not make a more complicated implementation than necessary, by letting the unit tests determine when a program is "done": if it fulfils its specifications, there is no need to keep adding functionality.
- Mock object
- Sometimes, testing some unit
A
(e.g., a function) requires that it collaborates somehow with some other unitB
(perhaps being passed as an argument, or by reference) - butB
has not been implemented yet. A "mock object" - an object which, for the purposes of testingA
, looks and behaves like a realB
- might then be used instead. (This is of course only useful if it would be significantly more work to implement a realB
than to create a mock object.) - Test case
- A single, well-defined test, that somehow can be uniquely identified. When executed, the test case either passes or fails; the test report should identify exactly which test cases failed.
- Test suite
- A collection of test cases, generally with a specific, common target for testing, such as a single function, module, or subsystem. A test suite may also be recursively composed by smaller test suites.