You are on page 1of 6

Software Testing

Assignment#02

Submitted To:
Mam Najmun Nisa

Submitted By: Registration No.:


Muqaddas FA17-BSE-103

Date:
November 22, 2020.
Question 1:

Every person receives a benefit of 350. In addition, it is determined whether a person has worked
and that his/her age is higher than 40. In this case the benefit is raised by 100. Alternatively
(else) for persons that are not working and have exactly 4 children the benefit is raised by 50.

For this specification, the following three input attributes can be


distinguished:
• Working history
• Age
• Number of Children.

You have to perform the following:

a) Identify the equivalence classes for each attribute.


Valid and Invalid Input Values:
For equivalence partition classes, first we have to find all valid and invalid input values for
the above-mentioned attributes:

Attributes Valid Invalid


Working History Person is working Person is not working
Age >40 <=40
No. of Children 4 >4, <4

Equivalence Partition Classes:

Invalid Valid Invalid


Partition 1 Partition 2 Partition 3
- Working Person Not a working Person
- >40 <=40
<4 4 >4

b) Identify the test cases both for valid and invalid cases.
Test Cases:
Test cases are written in such a way that they cover all valid and invalid equivalence classes.
One test case should include all valid equivalence classes and the other. The remaining test
cases should cover only one invalid class at a time because if we place multiple invalid classes
in one test case, then all test cases that will come after this test case will never be executed. In
this way, if any error occur due to multiple invalid inputs then this test case terminate the
execution of remaining test cases.

Attributes TC-01 TC-02 TC-03 TC-04 TC-05 TC-06 TC-07


Working History Yes No No No Yes Yes Yes
Age >40 <=40 <=40 >40 <=40 >40 >40
No. of Children 4 <4 >4 4 4 <4 >4
Expected 450 350 350 400 400 450 450
Outcome

In the above table, TC-01 contains all valid equivalence classes, TC-02 and TC-03 contain all
invalid classes and the remaining test cases cover only one invalid class at a time.

Question 2:
The program reads three integer values from a card. The three values are interpreted as representing the
lengths of the sides of a triangle. The program prints a message that states whether the triangle is
scalene, isosceles, or equilateral.

Write a set of test cases that would adequately test this program.

Test Test Case Risk Why this test is power Expected


full Result
TC-01 0, 1, 2 An error will be This test is powerful System
expected if user because the user might displays a
enters 0 value in enter 0 length of any message that,
any of the input side. “All values
field. So, this case should be must be
handled in the system as greater than
the triangle with this 0”.
input has 0 area and
known as degenerated
triangle.
TC-02 0, 0, 0 An error will be This test case is System
generated if user powerful because user displays a
enters 0 value in might enter 0 value in all message that,
all fields. fields to generate “All values
equilateral triangle. So, must be
the system should not greater than
accept the input if all 0”.
values are 0.
TC-03 4, __, 6 An error will be The system should System
expected if user handle this case if user displays a
has missed any of the message that,
has left any of the input value because all “Missing
filed empty. three inputs are required required
to generate any triangle. fields”.
That is why this test case
is important.
TC-04 5, 5, 5 System might This test case is System
accept that all powerful as the system displays a
three values are should test all message that,
equal and show Equal values and named “Triangle is
wrong triangle it to proper category of Equilateral”.
input. triangle.
TC-05 -5, 6, 15 System generate This test case is System
an error message if important as user might displays a
user enters any enter negative value in message that,
negative value. any of the field. So, the “Sides of the
system should also triangle
respond against negative should not be
values negative”.
TC-06 Five, 6, An error message This test case is System
12 will be expected if important because the displays a
the user enters any user might enter any key message that,
input value other other than integer. So, “All values
than integer. the system should must be
handle this case. integer”.
TC-07 6, 2, 3 The system might This test case is
(A+B > accept a “triangle” powerful because the System
C) in which the sum user might check the displays a
6+2>3 of two sides is less scalene triangle by message that,
Valid than or equal to entering all different “Triangle is
third side. input values. But the Scalene”.
system should check that
the sum of two sides
must be greater than the
third side (A+B > C) to
avoid invalid triangle.
Similar Test cases:
we have to check
permutations of the sides
of the triangle to avoid
invalid triangles. i-e
(B+C>A) and (C+A>B)
TC-08 6, 2, 3 The system might This test case is System
(B+C>A) accept a “triangle” important because it will displays a
2+3>6 in which the sum check the second message that,
Invalid of two sides is less permutation to avoid “Triangle is
than or equal to non-valid triangle. invalid, as the
third side. sum of two
sides must be
greater than
the third
side”.

TC-09 6, 2, 3 The system might This test case is System


(C+A>B) accept a “triangle” important because it will displays a
3+6>6 in which the sum check the third message that,
Valid of two sides is less permutation to avoid “Triangle is
than or equal to non-valid triangle. Scalene”.
third side.
TC-10 2, 2, 3 The system might This test case is System
(A+B > generate wrong powerful because the displays a
C) triangle when user user might check the message that,
2+2>3 enters two equal isosceles triangle by “Triangle is
Valid sides. entering two same input isosceles”.
values. But the system
should check that the
sum of two sides must
be greater than the third
side (A+B > C) to avoid
invalid triangle.
Similar Test cases:
we have to check
permutations of the sides
of the triangle to avoid
invalid triangles. i-e
(B+C>A) and (C+A>B)

TC-11 2, 2, 3 The system might This test case is System


(B+C>A) generate wrong important because it will displays a
2+3>2 triangle when user check the second message that,
Valid enters two equal permutation to avoid “Triangle is
sides. non-valid triangle. isosceles”.
TC-12 2, 2, 3 The system might This test case is System
(C+A>B) generate wrong important because it will displays a
3+2>2 triangle when user check the second message that,
Valid enters two equal permutation to avoid “Triangle is
sides. non-valid triangle. isosceles”.

You might also like