Software Engineering Essentials
Cheatsheet Content
Software Validation and Verification 1. Verification and Validation Planning Verification: "Are we building the product right?" Ensures software is built correctly according to specifications. Validation: "Are we building the right product?" Ensures the software meets user needs and expectations. Planning: Defines objectives, scope, resources, and schedules for V&V activities. Verification Example: For a calculator app, ensuring arithmetic operations (addition, subtraction) work as per specifications. Validation Example: For the same app, ensuring it meets user expectations (ease of use, accurate results). Planning Example: A test plan for an e-commerce website including testing shopping cart, payment, and order confirmation. 2. Testing Fundamentals Covers principles, objectives, and processes of software testing, including planning, test case creation, execution, and reporting. Test Plan Creation Example: For a hospital management system, outlining objectives (patient data security), scope (exclude third-party integrations), and resources (testers, tools). Test Case Generation Example (Login System): Valid credentials log in successfully. Invalid credentials display an error message. Empty fields prompt "Field required." 3. Black-Box Testing Techniques Focuses on software functionality without knowledge of internal structure. Techniques include equivalence partitioning, boundary value analysis, and decision table testing. BLACK BOX Input Output Black Box Testing Types of Black-Box Testing 01 Functional Testing 02 Regression Testing 03 Nonfunctional Testing (NFT) Functional Testing: Verifies each function conforms to requirements. Not concerned with source code. Focuses on UI, APIs, database, security. Regression Testing: Tests modified code parts and affected areas to ensure no new errors are introduced and that existing functionality still works after changes. Nonfunctional Testing (NFT): Checks non-functional attributes like performance, usability, and scalability. Tests readiness against non-functional parameters not covered by functional testing. Black-Box Testing Examples Equivalence Partitioning: For a ticket booking system, input values are divided into valid (1-10 tickets) and invalid (negative or >10 tickets) partitions. Boundary Value Analysis: For the same system, test edge cases like 0 tickets, 1 ticket, and 10 tickets. Decision Table Testing: For a loan approval system, create a table to test combinations of income, credit score, and employment status. 4. White-Box Testing Techniques Examines internal logic and structure of code. Techniques include statement coverage, branch coverage, and path testing. Application Code Test Case Input Test Case Output Unit Testing Integration Testing System Testing Types of White-Box Testing Unit Testing Integration Testing Regression Testing Types Of White Box Testing Unit Testing: Checks if each part/function works correctly in isolation, meeting design requirements. Integration Testing: Examines how different parts work together after unit testing. Regression Testing: Verifies that changes/updates don't break existing functionality; ensures all existing tests pass. White-Box Testing Examples Statement Coverage: For a function calculating discounts, ensuring every line of code is executed at least once. Branch Coverage: For an if-else condition in a grading system, testing both "Pass" and "Fail" branches. Path Coverage: For a program with nested loops, testing all possible paths through the code. 5. Unit Testing Verifies individual components (functions, methods) in isolation. Calculator App: `add()` function returns correct results. `divide()` handles division by zero gracefully. Banking App: `calculateInterest()` function works for various inputs. `validateAccountNumber()` rejects invalid formats. 6. Integration Testing Ensures multiple components work together. Approaches: top-down, bottom-up, sandwich testing. Top-Down Example: For a university portal, testing "Student Module" before integrating "Faculty Module." Bottom-Up Example: For a payment system, testing database interactions before integrating the UI. Sandwich Example: For a video streaming app, combining top-down and bottom-up to test UI and backend simultaneously. 7. Validation Testing Ensures the system meets user requirements and expectations. Fitness Tracker App: Validating users can accurately track steps, heart rate, and sleep. Restaurant Billing System: Validating invoices are generated correctly and match customer orders. 8. System Testing Evaluates the complete, integrated system against specified requirements. E-learning Platform: Checks video playback quality, quiz scoring accuracy, user login functionality. Smart Home System: Ensures devices respond to commands, alerts are triggered during emergencies. 9. Object-Oriented Testing Focuses on testing objects, classes, and their interactions. Techniques include class testing, state-based testing, and interaction testing. Class Testing Example: For a gaming app, testing the `Player` class (attributes like health, methods like `takeDamage()`). State-Based Testing Example: For a traffic light system, testing transitions between states (Green $\to$ Yellow $\to$ Red). Interaction Testing Example: For a chat application, testing how `User` objects interact with `Message` objects. 10. Inspections Manual reviews of software artifacts (code, design documents) to identify defects early. Code Inspection: Reviewing a login module for secure password hashing. Design Document Inspection: Checking a database schema for normalization and consistency. Peer Review: Team members reviewing each other's code for adherence to coding standards. Software Evolution 1. Software Maintenance Modifying existing software after initial release to correct faults, improve performance, or adapt to new environments. Four types: Corrective Maintenance: Fixing bugs or defects. Adaptive Maintenance: Modifying software for new environments (e.g., OS upgrades). Perfective Maintenance: Enhancing functionality or performance based on user feedback. Preventive Maintenance: Making changes to prevent future issues (e.g., code refactoring). Software Maintenance Examples Corrective: For a banking app, fixing a bug where transactions fail during peak hours. Adaptive: Updating a desktop application to support Windows 11. Perfective: Adding a "dark mode" feature to a social media app based on user requests. Preventive: Refactoring a legacy system to improve code readability and reduce technical debt. 2. Characteristics of Maintainable Software Maintainable software is easy to understand, modify, and extend. Key characteristics include modularity, readability, scalability, and testability. Software Characteristics Operational Transitional Maintenance Characteristics of Good Software: Functionality: Meets requirements and specifications; behaves as expected. Usability: Easy to use and understand; positive user experience. Reliability: Free of defects; performs consistently and accurately. Performance: Runs efficiently and quickly; handles large data/traffic. Security: Protected against unauthorized access; keeps data safe. Maintainability: Easy to change and update; well-documented. Reusability: Can be reused in other projects; promotes code reuse. Scalability: Handles increasing workload; easily extended. Testability: Designed for easy testing and validation; comprehensive test coverage. Maintainable Software Examples Modularity: Library management system with separate modules (Book Issuance, Member Registration, Fine Calculation). Readability: Using meaningful variable names like `calculateTotal()` instead of `func1()`. Scalability: A cloud-based app that scales horizontally by adding more servers. Testability: Writing unit tests for a calculator app for quick issue identification. 3. Re-engineering Restructuring or rewriting existing software to improve quality, performance, or maintainability without changing functionality. Code Restructuring: Converting a monolithic inventory management system into microservices for better scalability. Database Optimization: Normalizing a legacy database to eliminate redundancy and improve query performance. UI Modernization: Updating a hospital management system interface with modern frameworks (React, Angular). 4. Legacy Systems Outdated software systems still in use but difficult to maintain or extend. Decisions involve replacement, re-engineering, or continued maintenance. Replacement Example: Company replaces COBOL-based payroll system with cloud-based solution. Re-engineering Example: Bank updates mainframe transaction system to use REST APIs for mobile app integration. Continued Maintenance Example: Manufacturing plant continues using legacy production control system due to high replacement costs. 5. Software Reuse Reusing existing components, modules, or designs to reduce development time and cost. Techniques include libraries, frameworks, design patterns. Advantages of Software Reuse: Reduces development cost and time. Leads to higher quality products. What can be reused? Almost all software development artifacts can be reused, including: Requirements specification Design Code Test cases Knowledge Software Reuse Examples Library Reuse: Using a logging library like Log4j for error tracking across multiple projects. Framework Reuse: Building a web application using the Django framework to leverage pre-built authentication and routing. Design Pattern Reuse: Applying the Singleton pattern to ensure only one instance of a database connection exists. 6. Configuration Management Managing changes to software artifacts (code, documentation) to ensure consistency and traceability. Tools: Git, SVN, Jenkins. Version Control: Using Git to track changes, allowing developers to revert to previous versions. Branching Strategy: Implementing a GitFlow workflow for feature development and merging. Automated Builds: Using Jenkins to automate builds and deployments, ensuring consistent configurations.