0% found this document useful (0 votes)
122 views

Lab2 Error Fault Failures

The document discusses concepts related to software testing such as errors, faults, and failures. It provides definitions for each term and examples to demonstrate the differences between them. The document also outlines activities and tasks for a software testing lab that focuses on understanding these fundamental concepts, identifying errors, faults and failures in code examples, designing classes to represent concepts like points and lines, and generating test cases to introduce failures and validate functionality.

Uploaded by

Hassan Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Lab2 Error Fault Failures

The document discusses concepts related to software testing such as errors, faults, and failures. It provides definitions for each term and examples to demonstrate the differences between them. The document also outlines activities and tasks for a software testing lab that focuses on understanding these fundamental concepts, identifying errors, faults and failures in code examples, designing classes to represent concepts like points and lines, and generating test cases to introduce failures and validate functionality.

Uploaded by

Hassan Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab 2 Software Testing 22/09/2021

Errors, Fault, Failures:

Statement Purpose:
The purpose of this lab is to create an understanding of the fundamental concepts of Software
Testing like Errors, Fault/Bug/Defect, Failure.

Activity Outcomes:
- Understanding of Error, Fault and Failure in Java Program.
- Student will be able to find Bugs in any of the software products.

1) Stage J (Journey)

Introduction:

According to IEEE Definitions:


Fault : It is a condition that causes the software to fail to perform its required function.
Error : Refers to difference between Actual Output and Expected output.
Failure : It is the inability of a system or component to perform required function according
to its specification.

 Failure: External behavior is incorrect


 Fault: Discrepancy in code that causes a failure.
 Error: Human mistake that caused fault
Note:
 Error is terminology of Developer.
 Bug is terminology of Tester

2) Stage a1 (apply)

Lab Activity 1:
The example demonstrates the difference in Error, Fault and Failure.
pre: param is an integer.
post: returns the product of the param multiplied by 2.

1. int double (int param) {


2. int result;
3. result = param * param;
4. return result;
5. }
Identification of Error, Fault and Failures
. A call to double(3) returns 9, but the post condition says it should return 6.
• Result 9 represents a failure.
• The failure is due to the fault at line 3, ( "* param" is used instead of "* 2")
• The error is a typo, ( someone typed "* param" instead of "* 2" by mistake).

Lab Activity 2:
The example demonstrates the difference in Error, Fault and Failure.

2) Stage v (verify)

Activity 1:
Evaluate software by observing it’s execution. Introduce some errors, faults and failures to explain
your answer.

Consider the concept of a CourseResult. The CourseResult should have data members like
the student name, course name and grade obtained in that course. This concept can be
represented in a class as follows:
Public class CourseResult
{
Public String studentname;
Public String coursename;
Public String grade;
public void display()
{
System.out.println("Student Name is: ― + studentname + "Course Name is: ― +
coursename + "Grade is: ― + grade); }
}
Public class CourseResultRun
{
public static void main(String[]args)
{
CourseResult c1=new CourseResult (); c1.studentName= ―Ali‖; c1.courseName= ―OOP‖;
c1.grade= ―A‖;
c1.display();
CourseResult c2=new CourseResult ();
c2.studentName= ―Saba‖;
c2.courseName= ―ICP‖;
c2.grade= ―A+‖;
c2.display();
}
}

Activity 2:

Design a class Point with two data members x-cord and y-cord. This class should have an arguments
constructor, setters, getters and a display function. Now create another class ―Line‖, which contains
two Points ―startPoint‖ and ―endPoint‖. It should have a function that finds the length of the line.
Hint: formula is: sqrt((x2-x1) 2 + (y2-y1) 2 ) Create two line objects in runner and display the length
of each line.

Write test cases to check the above functionality by introducing different errors, faults and failure
Mention 3 test cases for failures and 3 for Non failures as shown in above example.

Activity 3:
Find the maximum number of bugs in the following website and fill the provided Bug report sheet
template.

https://homeshopping.pk/

You might also like