V-Model (verification and validation) in Testing Fundamentals - Build an Automation Script
import unittest class TestVModelVerificationValidation(unittest.TestCase): def setUp(self): # Define development phases and their verification activities self.development_phases = { 'Requirements': 'Requirements Review', 'System Design': 'System Design Review', 'Architecture Design': 'Architecture Review', 'Module Design': 'Module Design Review', 'Coding': 'Code Review' } # Define testing phases and their validation activities self.testing_phases = { 'Unit Testing': 'Module Validation', 'Integration Testing': 'Architecture Validation', 'System Testing': 'System Validation', 'Acceptance Testing': 'Requirements Validation' } # Define expected mapping between development and testing phases self.v_model_mapping = { 'Requirements': 'Acceptance Testing', 'System Design': 'System Testing', 'Architecture Design': 'Integration Testing', 'Module Design': 'Unit Testing', 'Coding': 'Unit Testing' } def test_verification_activities_exist(self): for phase, activity in self.development_phases.items(): self.assertIsInstance(activity, str, f'Verification activity missing for {phase}') def test_validation_activities_exist(self): for phase, activity in self.testing_phases.items(): self.assertIsInstance(activity, str, f'Validation activity missing for {phase}') def test_v_model_phase_mapping(self): for dev_phase, test_phase in self.v_model_mapping.items(): self.assertIn(dev_phase, self.development_phases, f'Development phase {dev_phase} not defined') self.assertIn(test_phase, self.testing_phases, f'Testing phase {test_phase} not defined') if __name__ == '__main__': unittest.main()
This test class checks the V-Model phases and their verification and validation activities.
In setUp, we define dictionaries for development phases with their verification activities, testing phases with validation activities, and the expected mapping between them.
The first test test_verification_activities_exist ensures each development phase has a verification activity defined.
The second test test_validation_activities_exist ensures each testing phase has a validation activity defined.
The third test test_v_model_phase_mapping verifies that each development phase maps to a valid testing phase according to the V-Model.
Assertions include clear messages to help understand failures.
Now add data-driven testing to verify multiple sets of V-Model mappings with different project types
Practice
Solution
Step 1: Understand the V-Model concept
The V-Model connects each development phase with a matching testing phase to ensure thorough testing coverage.Step 2: Analyze the options
Only 'To link development phases with corresponding testing phases' correctly describes this linking of development and testing phases. Other options describe incorrect or unrelated ideas.Final Answer:
To link development phases with corresponding testing phases -> Option CQuick Check:
V-Model = Link dev and test phases [OK]
- Thinking V-Model is only about validation
- Believing it removes manual testing
- Assuming no documentation is needed
Solution
Step 1: Define verification in V-Model context
Verification means checking if the product is built correctly according to specifications and design documents.Step 2: Match options to verification definition
Ensuring the product is built according to specifications matches this definition. Checking if the product meets user needs describes validation, testing the product after deployment is incorrect timing, and validating the user interface design is a specific validation activity.Final Answer:
Ensuring the product is built according to specifications -> Option AQuick Check:
Verification = built correctly [OK]
- Confusing verification with validation
- Thinking verification happens only after deployment
- Assuming verification tests user needs
Requirements Analysis and Acceptance Testing.Which statement is true about their relationship?
Solution
Step 1: Identify matching phases in V-Model
In the V-Model, Acceptance Testing corresponds to and verifies the Requirements Analysis phase.Step 2: Evaluate options based on this mapping
Acceptance Testing verifies the Requirements Analysis phase correctly states this relationship. The option 'Requirements Analysis is validated by Unit Testing' incorrectly pairs Requirements Analysis with Unit Testing, the option 'Acceptance Testing is unrelated to Requirements Analysis' denies the relationship, and the option 'Requirements Analysis is tested after system deployment' is incorrect timing.Final Answer:
Acceptance Testing verifies the Requirements Analysis phase -> Option BQuick Check:
Req Analysis ↔ Acceptance Testing [OK]
- Mixing up which test phase matches which dev phase
- Thinking Unit Testing validates requirements
- Ignoring the V shape mapping
Solution
Step 1: Understand V-Model phase alignment
The V-Model requires testing phases to start only after their corresponding development phases complete.Step 2: Analyze the problem
Starting system testing before design completion breaks this alignment, causing potential test mismatches.Final Answer:
Testing phases are not aligned with development phases -> Option DQuick Check:
Test phases must follow dev phases [OK]
- Confusing verification and validation order
- Assuming validation is skipped
- Blaming requirements instead of phase timing
Solution
Step 1: Understand timing of validation in V-Model
Validation ensures the product meets user needs and is usually done after the product is stable.Step 2: Analyze early validation impact
If validation happens too early, the product may be incomplete or unstable, causing inaccurate or misleading validation results.Final Answer:
Validation results may be inaccurate due to incomplete product -> Option AQuick Check:
Early validation = inaccurate results [OK]
- Believing verification fixes defects automatically
- Thinking testing phases can be skipped
- Assuming requirements are ignored
Ready to prove it?
Pass the test and this pattern moves unknown
