← 返回资讯屏轩教育 · 行业资讯

Verification and Validation: Concepts and Applications | 验证与校验:概念辨析与应用

2026-08-30 14:30 · 本文部分内容由AI辅助创作

📚 Verification and Validation: Concepts and Applications | 验证与校验:概念辨析与应用

In computer science, verification and validation are two essential quality assurance processes that are often confused. They both aim to improve software quality, but they address different questions and are used at different stages of development.

在计算机科学中,验证与校验是两个至关重要的质量保证过程,经常被混淆。它们都旨在提高软件质量,但关注的问题不同,并且在开发的不同阶段使用。


1. What Are Verification and Validation? | 什么是验证与校验?

Verification is the process of checking that a product, service, or system meets its specified requirements. It answers the question: 'Are we building the product right?'

验证是检查产品、服务或系统是否满足其规定要求的过程。它回答的问题是:"我们是否正确地构建了产品?"

Validation is the process of checking that the final product actually satisfies the user's needs and intended purpose. It answers the question: 'Are we building the right product?'

校验是检查最终产品是否实际满足用户需求和预期目的的过程。它回答的问题是:"我们是否构建了正确的产品?"

In the context of data entry, verification and validation have more specific meanings. Verification checks that the data entered matches the original source, while validation checks that the data is reasonable and within acceptable bounds.

在数据录入的语境中,验证与校验具有更具体的含义。验证检查输入的数据是否与原始来源一致,而校验检查数据是否合理且在可接受范围内。


2. Key Differences | 主要区别

The main difference lies in the reference point. Verification uses the requirements specification as the reference, while validation uses the user's real-world expectations as the reference.

主要区别在于参考点。验证以需求规格说明书为参考,而校验以用户在真实世界中的期望为参考。

Using the popular comparison: Verification ensures the product is built according to the design; Validation ensures the design itself is what the user asked for.

用流行的对比来说:验证确保产品按照设计构建;校验确保设计本身是用户所要求的。


3. Verification Methods | 验证的方法

Verification methods include both static and dynamic techniques. Static verification does not involve executing the code, while dynamic verification involves running the program with test data.

验证方法包括静态和动态技术。静态验证不涉及执行代码,而动态验证涉及使用测试数据运行程序。

Common static verification techniques:

常见的静态验证技术:

Dynamic verification includes unit testing and integration testing, where components are executed to check for expected behaviour.

动态验证包括单元测试和集成测试,在这些测试中执行组件以检查预期行为。

For example, a module that calculates a student's average score can be unit-tested by feeding it a known set of marks and checking the output against a manually calculated result.

例如,一个计算学生平均分的模块可以通过输入一组已知分数并对照手动计算结果来测试输出,这就是单元测试。


4. Validation Methods | 校验的方法

Validation methods focus on user needs. They are usually performed after the system is complete or at the end of each increment.

校验方法侧重于用户需求。它们通常在系统完成后或每个增量结束时执行。

Common validation techniques:

常见的校验技术:

It is important to note that in data entry, the term 'validation' is used for automatic checks that reject invalid data, while 'verification' is used to detect human transcription errors.

需要注意的是,在数据录入中,"校验"用于自动拒绝无效数据的检查,而"验证"用于检测人工转录错误。

For example, a hospital system may use a format check on a National Health Service number, which is a validation rule. A second nurse entering the patient's details separately is a verification process.

例如,医院系统可能对国家医疗服务号码使用格式检查,这是校验规则。而由另一位护士再次输入患者详细信息则属于验证过程。


广告 / Sponsored

5. Worked Example: Student Registration System | 实例分析:学生注册系统

Consider a student registration system. The requirement specification states that the system must accept a student ID as a 6-digit number.

考虑一个学生注册系统。需求规格说明规定系统必须接受6位数字的学生ID。

Verification: Check that the code correctly reads and stores the 6-digit number in the database. Unit tests can confirm the format is preserved.

验证:检查代码是否正确读取6位数字并将其存储在数据库中。单元测试可以确认格式被保留。

Validation: Ask the registrar (user) if the system actually makes their job easier and if all necessary fields are present. UAT is used to confirm the final system meets their needs.

校验:询问注册人员(用户)系统是否确实使他们的工作更轻松,以及所有必要字段是否都存在。使用UAT来确认最终系统满足他们的需求。

Additionally, for data input, a range check (1-999999) is a validation rule, while double-entry of the ID by two different people is a verification method.

此外,对于数据输入,范围检查(1-999999)是校验规则,而由两个不同的人重复输入ID是验证方法。

If the range check rejects 0000000, it is performing validation because the value is outside the acceptable set. If one typist enters 123456 and another enters 123457, the system detects a mismatch; this is verification.

如果范围检查拒绝0000000,这是因为该值超出可接受集合,属于校验。如果一位录入员输入123456,另一位输入123457,系统检测到不匹配;这属于验证。


6. Verification in Data Transfer | 数据传输中的验证

In data communication, verification ensures that data has not been corrupted during transmission. Checks such as checksums, parity bits, and echo checking are used.

在数据通信中,验证确保数据在传输过程中未被破坏。使用校验和、奇偶校验位和回显检查等检查方法。

For example, a checksum is calculated before sending and recalculated after receiving. If the two values match, the data is considered verified.

例如,在发送前计算校验和,在接收后重新计算。如果两个值匹配,则认为数据已验证。

Parity checks are another common verification method. A parity bit is added to a binary sequence so that the total number of 1s is even (even parity) or odd (odd parity).

奇偶校验是另一种常见的验证方法。一个奇偶校验位被添加到二进制序列中,使1的总数为偶数(偶校验)或奇数(奇校验)。

This type of verification does not check whether the data is meaningful or logical; it only checks transmission accuracy.

这种类型的验证不检查数据是否有意义或符合逻辑;它只检查传输的准确性。


7. Validation Rules in Databases | 数据库中的校验规则

Database systems use validation rules to prevent invalid data from being entered. Common rules include:

数据库系统使用校验规则来防止无效数据被输入。常见规则包括:

These are validation checks because they enforce rules about what data is reasonable, not whether the user intended to type it.

这些是校验检查,因为它们强制执行关于什么数据是合理的规则,而不是用户是否打算输入它。

For example, an online form asking for a date of birth might reject 31/02/2024 because there is no such date. This is a range/format validation, not a verification of the user's birthday itself.

例如,一个要求输入出生日期的在线表单可能会拒绝31

Published by TutorHao | Computer Science Revision Series | aleveler.com

广告 / Sponsored
现货 Cambridge International AS & ALevel IT Coursebook剑桥国际IGC…
计算机 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥467.0

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao