Chapter 6: Software Coding & Testing
Q1. What is Software Testing? What is the role of a Software Tester? Compare: Black Box vs White
Box.
Software Testing:
Software testing is the process of evaluating a software application to ensure it meets the specified
requirements and works as expected. It identifies bugs, errors, or defects and ensures the product is
reliable, secure, and efficient.
Role of a Software Tester:
- Detect and report bugs in the software.
- Validate that the software meets business and user needs.
- Execute test cases and analyze results.
- Automate repetitive testing tasks where applicable.
- Communicate test outcomes and improvements to the development team.
Comparison: Black Box vs. White Box Testing
| Aspect | Black Box Testing | White Box Testing |
|-----------------------|------------------------------------------|------------------------------------------|
| Definition | Tests functionality without internal knowledge. | Tests internal code structure and
logic. |
| Focus | What the software does (output). | How the software works
(implementation). |
| Access | No knowledge of code is required. | Requires knowledge of source code.
|
| Techniques | Equivalence Partitioning, Boundary Value Analysis. | Statement, Path, and
Branch Coverage. |
| Examples | Testing login functionality. | Testing loops or condition statements. |
Q2. What is Software Testing? Explain Black-box and White-box Testing in detail with examples.
Software Testing: (See above for definition.)
Black-Box Testing:
- Focuses on testing the software's functionality without knowing its internal code.
- Example: Testing if entering correct credentials allows login while incorrect credentials show an
error message.
White-Box Testing:
- Focuses on the internal structure, logic, and flow of code.
- Example: Checking whether all if-else conditions in a payment processing system are tested
correctly.
Q3. Compare: Verification vs. Validation
| Aspect | Verification | Validation |
|-----------------------|------------------------------------------|-----------------------------------------|
| Definition | Ensures the product is built correctly (meets design specs). | Ensures the
product meets user requirements. |
| Focus | Process-oriented | Product-oriented |
| Performed When | During development phases (e.g., design review). | After development (e.g.,
testing phase). |
| Techniques | Inspections, reviews, walkthroughs | Functional and non-functional testing.
| Example | Checking if design documents align with requirements. | Testing if the login
feature works as expected. |
Q4. Define: Code Review, Code Walkthrough, Code Inspection
1. Code Review:
- A systematic review of source code by developers to find bugs or improve code quality.
- Focuses on readability, maintainability, and adherence to coding standards.
2. Code Walkthrough:
- A semi-formal process where the author explains the code to peers in a meeting.
- Focused on understanding and feedback rather than defect identification.
3. Code Inspection:
- A formal review process to detect defects in code, design, or documentation.
- Follows a structured process with predefined roles and checklists.
Q5. Explain Coding Standards & Coding Guidelines
Coding Standards:
- A set of rules for writing code, ensuring consistency, readability, and maintainability.
- Examples:
- Variable names should use camelCase.
- Indent code blocks with 4 spaces.
- Avoid hardcoding values.
Coding Guidelines:
- Broader recommendations or best practices to improve code quality.
- Examples:
- Use meaningful variable and function names.
- Write modular and reusable code.
- Add comments to explain complex logic.
Coding standards are more formal and enforceable, whereas coding guidelines are flexible and
advisory.