# V-Model (Verification and Validation)

The V-Model is an SDLC model where execution of processes happens in a sequential manner in a V-shape. It is also known as the Verification and Validation model. It is an extension of the Waterfall model and is based on the association of a testing phase for each corresponding development stage.

## 1. The V-Shape Structure

Instead of moving down in a linear way like Waterfall, the process steps are bent upwards after the coding phase, to form the typical V shape.

*   **Left Side (Verification):** The Development phases (Requirements, Design, Coding).
*   **Right Side (Validation):** The Testing phases (Unit, Integration, System, Acceptance).
*   **The Point of the V:** Implementation (Coding).

## 2. The Phases

Each verification phase has a corresponding validation phase.

### Verification Phases (Down the V)
1.  **Requirement Analysis:** Gather needs. (Corresponding Test: User Acceptance Testing).
2.  **System Design:** High-level architecture. (Corresponding Test: System Testing).
3.  **Architectural Design:** Module breakdown. (Corresponding Test: Integration Testing).
4.  **Module Design:** Low-level logic. (Corresponding Test: Unit Testing).

### Validation Phases (Up the V)
1.  **Unit Testing:** Testing individual modules/components.
2.  **Integration Testing:** Testing interaction between modules.
3.  **System Testing:** Testing the complete application.
4.  **User Acceptance Testing (UAT):** Verifying the system meets user requirements in the real world.

## 3. Verification vs. Validation

*   **Verification:** "Are we building the product right?" (Static analysis, reviews, inspections).
*   **Validation:** "Are we building the right product?" (Dynamic testing, executing code).

## 4. Pros and Cons

| Pros | Cons |
| :--- | :--- |
| **Discipline:** Highly disciplined model, phases are completed one at a time. | **Rigid:** Least flexible. Difficult to go back and change functionality. |
| **Early Testing:** Testing planning happens early (during design phases). | **No Early Prototype:** No working software is produced until late in the cycle. |
| **Simple:** Easy to understand and manage. | **High Risk:** High risk and uncertainty if requirements are not clear. |

## 5. Static vs. Dynamic Testing

The V-Model clearly distinguishes between these two types of testing activities.

### Static Testing (Verification)
Testing without executing the code. This happens during the verification phases (left side of the V).
*   **Activities:** Reviews, walkthroughs, inspections of requirements and design documents.
*   **Goal:** Prevent defects early.

### Dynamic Testing (Validation)
Testing by executing the code. This happens during the validation phases (right side of the V).
*   **Activities:** Unit testing, integration testing, system testing.
*   **Goal:** Find and fix defects in the running software.

[[programming/software-development-life-cycle]]
[[programming/software-testing-basics]]