Software_Testing_Lab_Assignment_1
Software_Testing_Lab_Assignment_1
Campus
Department of Computer Science
FALL 2024
Lab Assignment 1
Name: Mian Habib Jan Reg No: Sp21-Bse-042
Name: Muhammad Ibrahim Reg No: Sp21-Bse-096
Name: Sayed Mujtaba Reg No: Sp21-Bse-091
QUESTION 1
Solution:
Error:
Human mistake: The programmer mistakenly multiplied the parameter by itself instead of
multiplying it by 2.
Location: Line 3: result = param * param;
Fault:
Incorrect implementation: The code contains a defect that causes it to produce incorrect results.
Location: Line 3: result = param * param;
Failure:
Deviation from expected behavior: When the function is called with a non-zero input, it returns
an incorrect result, which is different from the specified postcondition.
Impact: The function's intended purpose is not fulfilled.
Correct java code:
int double (int param) {
int result = param * 2;
return result;
}
Explanation:
Error: The human error of multiplying by the parameter itself was identified.
Fault: The incorrect implementation of the multiplication operation was corrected.
Failure: The incorrect behavior of the function, which was caused by the fault, is now resolved.
QUESTION 2
Consider Cu-online system Identify, document, and report defects found
during testing
1. Identify Defects
In university online system, some of the main areas that could be tested include:
Functional Areas:
User Authentication: Login/logout, password reset, multi-factor authentication.
Course Management: Enrollments, course content access, assignment uploads.
Student Records: Access to grades, transcripts, attendance records.
Communication Tools: Announcements, email notifications, discussion forums.
Payment Gateway: Tuition fee payments, transaction history, receipt generation.
Profile Management: Updating personal information, photo upload, contact details.
2. Document Defects
Each defect should be documented with a clear and concise format to ensure it can be understood
and addressed by the development team. A typical defect report includes:
Defect ID: Unique identifier for tracking.
Title: A brief description of the defect.
Description: Detailed explanation of the issue.
Steps to Reproduce: Clear, step-by-step instructions to recreate the defect.
Expected Result: What should have happened if the system worked correctly.
Actual Result: What actually happened.
Severity: Impact level (e.g., Critical, Major, Minor).
Priority: Importance for fixing (e.g., High, Medium, Low).
Environment: Information on browser, OS, version, etc.
Attachments: Screenshots, videos, or logs as evidence.
3. Report Defects
Let’s look at some sample defect reports for an online university system:
QUESTION 3
Test Case ID Test Case Test Data Expected Actual Pass/Fail
Description Result Result
QUESTION 3
Draw CFG and DFG of a given code to analyze it in white box way.
Control Flow Graph (CFG):
Data Flow Graph (DFG):