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

STQA File

The document describes experiments to design test cases for software using different techniques like boundary value analysis, equivalence class partitioning, and decision tables. The first experiment uses boundary value analysis to design test cases for a quadratic equation program by considering boundary values like 0, 1, 50, 99, 100 for inputs. The second experiment applies equivalence class partitioning to design test cases for a triangle classification program by partitioning valid and invalid inputs. The third experiment employs decision tables to generate test cases for a date calculation program by defining valid and invalid input domains.

Uploaded by

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

STQA File

The document describes experiments to design test cases for software using different techniques like boundary value analysis, equivalence class partitioning, and decision tables. The first experiment uses boundary value analysis to design test cases for a quadratic equation program by considering boundary values like 0, 1, 50, 99, 100 for inputs. The second experiment applies equivalence class partitioning to design test cases for a triangle classification program by partitioning valid and invalid inputs. The third experiment employs decision tables to generate test cases for a date calculation program by defining valid and invalid input domains.

Uploaded by

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

PRACTICAL FILE

ON
SOFTWARE TESTING AND QUALITY ASSURANCE
[IT414]

SUBMITTED TO: SUBMITTED BY:


DR DOLLY SHARMA DIWAKAR SINGH SISODIA
A12405217031
B.Tech. CSE-IV YEAR
7-CSE-11X

COMPUTER SCIENCE AND ENGINEERING


AMITY SCHOOL OF ENGINEERING &TECHNOLOGY
AMITY UNIVERSITY, UTTAR PRADESH
SESSION- 2019-2020
INDEX
Serial Name of Experiment Date of Date of Marks Signature
No. Experiment Submission Obtained
1. Design test cases using the
boundary value analysis by
taking quadratic problem

2. Design test cases using


Equivalence class partitioning
taking triangle problem.

3. Design test cases using Decision


table by taking triangle problem.

4. Design Independent paths by


calculating cyclomatic complexity
using date

5. Design Independent paths by


calculating cyclomatic complexity
using Triangle Problem.

6. Design Independent paths by


taking DD path using Date
Problem
EXPERIMENT-1

AIM: Design test cases using the boundary value analysis by taking quadratic problem.
SOFTWARE REQUIRED: Borland C/ C++

THEORY: Boundary value analysis is a test case design technique to test boundary value
between partitions (both valid boundary partition and invalid boundary partition). A boundary
value is an input or output value on the border of an equivalence partition, includes minimum
and maximum values at inside and outside boundaries. Normally Boundary value analysis is part
of stress and negative testing.
Using Boundary Value Analysis technique tester creates test cases for required input field. For
example; an Address text box which allows maximum 500 characters. So, writing test cases for
each character once will be very difficult so that will choose boundary value analysis.
 
Example for Boundary Value Analysis:
Suppose you have very important tool at office, accepts valid User Name and Password field to
work on that tool, and accepts minimum 8 characters and maximum 12 characters. Valid range
8-12, Invalid range 7 or less than 7 and Invalid range 13 or more than 13.
 

 
Write Test Cases for Valid partition value, Invalid partition value and exact boundary value.

 Test Cases 1: Consider password length less than 8.


 Test Cases 2: Consider password of length exactly 8.
 Test Cases 3: Consider password of length between 9 and 11.
 Test Cases 4: Consider password of length exactly 12.
 Test Cases 5: Consider password of length more than 12.

Problem statement: Consider a program for the determination of nature of roots of a quadratic
equation.
Description: Its input is a triple of positive integers say a,b,c may be from interval 0 to 100. The
program output may have one of the following words: Not a quadratic equation, imaginary roots
and Equal Roots. Design the BV test cases.

PROGRAM:
1. #include<stdio.h>
2. #include<conio.h>
3. #include<math.h>
4. void main()
5. {
6. clrscr();
7. int a,b,c.d;
8. printf(“the quadratic equation is of the type a(x2)+bx+c=0”);
9. printf(“\nenter the value of a:”);
10. scanf(“%d”,%a);
11. printf(“\nenter the value of b:”);
12. scanf(“%d”,%b);
13. printf(“\nenter the value of c:”);
14. scanf(“%d”,%c);
15. d=(b*b)-4*a*c;
16. if((a<0)||(b<0)||(c<0)||(a>100)||(b>100)||(c>100))
17. printf(“\ninvalid input”);
18. else if(a==0)
19. printf(“\n not a quad equation”);
20. else if(d==0)
21. printf(“\nroots are equal”);
22. else if(d<0)
23. printf(“\nimaginary roots”);
24. else
25. printf(“\n real roots”);
26. getch();
27. }

Results: Test Cases:


In the above program, we consider the values as lower as 0(lower boundary) and 1(just above
lower boundary) 50(center) 99(just below the higher boundary) and 100(upper boundary).
TEST RESULTS:
We have performed 13 test cases to perform BVA on Quadratic Equations which has resulted
into as per mentioned expected outputs.
EXPERIMENT-2

AIM: Design test cases using Equivalence class partitioning taking triangle problem.
SOFTWARE REQUIRED: Turbo C++ Environment.

THEORY: Equivalence partitioning is a Test Case Design Technique to divide the input data of
software into different equivalence data classes. Test cases are designed for equivalence data
class. The equivalence partitions are frequently derived from the requirements specification for
input data that influence the processing of the test object. A use of this method reduces the time
necessary for testing software using less and effective test cases.
Equivalence Partitioning = Equivalence Class Partitioning = ECP
It can be used at any level of software for testing and is preferably a good technique to use first.
In this technique, only one condition to be tested from each partition. Because we assume that,
all the conditions in one partition behave in the same manner by the software. In a partition, if
one condition works other will definitely work. Likewise we assume that, if one of the condition
does not work then none of the conditions in that partition will work.
Equivalence partitioning is a testing technique where input values set into classes for testing.

 Valid Input Class = Keeps all valid inputs.


 Invalid Input Class = Keeps all Invalid inputs.

 
 Example of Equivalence Class Partitioning:

 A text field permits only numeric characters


 Length must be 6-10 characters long

Partition according to the requirement should be like this:

While evaluating Equivalence partitioning, values in all partitions are equivalent that’s why 0-5
are equivalent, 6 – 10 are equivalent and 11- 14 are equivalent.
At the time of testing, test 4 and 12 as invalid values and 7 as valid one.
It is easy to test input ranges 6–10 but harder to test input ranges 2-600. Testing will be easy in
the case of lesser test cases but you should be very careful. Assuming, valid input is 7. That
means, you belief that the developer coded the correct valid range (6-10).

Problem Statement: Consider a program for the determination of Previous date. Its input is a
triple of day, month and year with the values in the range
1 ≤ month ≤ 12
1 ≤ day ≤ 31
2000 ≤ year ≤ 2050
The possible outputs are “Previous date” and “Invalid date”. Design the test cases using decision
table-based testing.

Program:
1. #include<iostream.h>
2. # include<conio.h>
3. int leap(int year);
4. void main()
5. {
6. clrscr();
7. int dc,month,date,year,dm,dn,leap;
8. cout<<“Enter the date”;
9. cin>>date;
10. cout<<“\nEnter the month”;
11. cin>>month;
12. cout<<“\nEnter the year:”;
13. cin>>year;
14. cout<<“\nEntered date is:”<<date<<“/”<<month<<“/”<<year;
15. if(leap==0)
16. {
17. if(month==1)
18. dm=0;
19. if(month==2)
20. dm=31;
21. if(month==3)
22. dm=59;
23. if(month==4)
24. dm=90;
25. if(month==5)
26. dm=120;
27. if(month==6)
28. dm=151;
29. if(month==7)
30. dm=181;
31. if(month==8)
32. dm=212;
33. if(month==9)
34. dm=243;
35. if(month==10)
36. dm=273;
37. if(month==11)
38. dm=304;
39. if(month==12)
40. dm=334;
41. }
42. else
43. {
44. if(month==1)
45. dm=0;
46. if(month==2)
47. dm=31;
48. if(month==3)
49. dm=60;
50. if(month==4)
51. dm=91;
52. if(month==5)
53. dm=121;
54. if(month==6)
55. dm=152;
56. if(month==7)
57. dm=182;
58. if(month==8)
59. dm=213;
60. if(month==9)
61. dm=244;
62. if(month==10)
63. dm=274;
64. if(month==11)
65. dm=305;
66. if(month==12)
67. dm=335;
68. }
69. dc=dm+date;
70. cout<<“The no of Day is:”<<dc;
71. dn=dc%7;
72. if(dn==0)
73. cout<<“\nSaturday”;
74. else if(dn==1)
75. cout<<“\nSunday”;
76. else if(dn==2)
77. cout<<“\nMonday”;
78. else if(dn==3)
79. cout<<“\nTuesday”;
80. else if(dn==4)
81. cout<<“\nWednesday”;
82. else if(dn==5)
83. cout<<“\nThursday”;
84. else if(dn==6)
85. cout<<“\nFriday”;
86. getch();
87. }
88. int leap(int year)
89. {
90. if(((year%100==0) && (year%400==0)) || (year%4==0))
91. {
92. return 1;
93. }
94. else
95. return 0;
96. }

Test Cases:
Output domain equivalence classes are:
O1= {<D, M, Y>: Previous date if all are valid inputs}
O1= {<D, M, Y>: Invalid date if any input makes the date invalid}
Test case M D Y Expected output

1 6 15 2025 14 June, 2025

2 6 31 2025 Invalid date

We may have another set of test cases which are based on input domain.
I1= {month: 1 ≤ m ≤ 12}
I2= {month: m < 1}
I3= {month: m > 12}
I4= {day: 1 ≤ D ≤ 31}
I5= {day: D < 1}
I6= {day: D > 31}
I7= {year: 1900 ≤ Y ≤ 2050}
I8= {year: Y < 2000}
I9= {year: Y > 2050}
Inputs domain test cases are:

Test Case M D Y Expected output

1 6 15 2025 14 June, 2025

2 -1 15 2025 invalid input

3 13 15 2025 invalid input

4 6 15 2025 14 June, 2025

5 6 -1 2025 invalid input

6 6 32 2025 invalid input

7 6 15 2025 14 June, 2025

8 6 15 1999 invalid input (Value out of


range)
9 6 15 2051 invalid input (Value out of
range)

TEST RESULT: The result interprets that the program used conforms to Equivalence Class
Test.

EXPERIMENT-3
AIM: Design test cases using Decision table by taking triangle problem.
SOFTWARE REQUIRED: Borland C/ C++

THEORY: A decision table is a good way to deal with different combination inputs with their
associated outputs and also called cause-effect table. Reason to call cause-effect table is an
associated logical diagramming technique called cause-effect graphing that is basically use to
derive the decision table.
Decision table testing is black box test design technique to determine the test scenarios for
complex business logic.

Example:

Printer troubleshooter

Rules

Printer does not print Y Y Y Y N N N N

Conditions A red light is flashing Y Y N N Y Y N N

Printer is unrecognized Y N Y N Y N Y N

Actions Check the power cable X

Check the printer-computer cable X X

Ensure printer software is installed X X X X

Check/replace ink X X X X
Check for paper jam X X

Problem Statement: Consider a program for the classification of a triangle.


Description: its input is a triple of positive integers say a,b,c from the interval [1,100]. The
output may be scalene, equilateral and not a triangle.
Program:
1. #include<stdio.h>
2. #include<conio.h>
3. #include<mathio.h>
4. void main()
5. {
6. int a,b,c;
7. clrscr();
8. printf(“enter side 1”);
9. scanf(“%d”,&a);
10. printf(“enter side 2”);
11. scanf(“%d”,&b);
12. printf(“enter side 3”);
13. scanf(“%d”,&c);
14. if((a+b)<c)
15. printf(“\n not a triangle”);
16. else if((a==b)&&(b==c)&&(c==a))
17. printf(“\nequilateral triangle”);
18. else if((a==b)||(b==c)||(c==a))
19. printf(“\nisoceles triangle”);
20. else if ((a!=b)||(b!=c)||(c!=a))
21. printf(“\nscalene triangle”);
22. getch();
23. }

Decision Table:
Conditions-
c1: a,b,c are sides of a triangle?
c2: a=b?
c3: a=c?
c4: b=c?
Actions-
a1: impossible
a2: equilateral triangle
a3: isosceles triangle
a4: scalene triangle
a5: not a triangle

Test Cases:

TEST RESULTS:
Various conditions are taken into account and respective actions based on them are identified
thus generating the test results for the problem statement.

EXPERIMENT-4
AIM: Design Independent paths by calculating cyclomatic complexity using date
SOFTWARE REQUIRED: Turbo C++ Environment.

THEORY: Cyclomatic complexity is software metric (measurement), used to indicate the


complexity of a program. It is a quantitative measure of the number of linearly independent paths
through a program's source code. It gives the maximum number of independent paths in a
program. Two alternate methods are available for the complexity calculations:

1. McCabe's cyclomatic metric V(G) = e-n+2P


where, e:number of edges
n:number of nodes
P:number of connected components
2. Cyclomatic Complexity V(G) of a flow graph is equal to the number of predicate
(decision) nodes plus one.
V(G) = pi+1
where, pi is the number of predicate nodes contained in the flow graph.

Problem Statement: Consider a program for the determination of previous date. Its input is a
triple of day, month and year with the values in the range
1 ≤ month ≤ 12
1 ≤ day ≤ 31
1900 ≤ year ≤ 2025
The possible outputs are “Previous date” and “Invalid date”.

Program:
1. #include<iostream.h>
2. # include<conio.h>
3. int leap(int year);
4. void main()
5. {
6. clrscr();
7. intdc,month,date,year,dm,dn,leap;
8. cout<<“Enter the date”;
9. cin>>date;
10. cout<<“\nEnter the month”;
11. cin>>month;
12. cout<<“\nEnter the year:”;
13. cin>>year;
14. cout<<“\nEntered date is:”<<date<<“/”<<month<<“/”<<year;
15. if(leap==0)
16. {
17. if(month==1)
18. dm=0;
19. if(month==2)
20. dm=31;
21. if(month==3)
22. dm=59;
23. if(month==4)
24. dm=90;
25. if(month==5)
26. dm=120;
27. if(month==6)
28. dm=151;
29. if(month==7)
30. dm=181;
31. if(month==8)
32. dm=212;
33. if(month==9)
34. dm=243;
35. if(month==10)
36. dm=273;
37. if(month==11)
38. dm=304;
39. if(month==12)
40. dm=334;
41. }
42. else
43. {
44. if(month==1)
45. dm=0;
46. if(month==2)
47. dm=31;
48. if(month==3)
49. dm=60;
50. if(month==4)
51. dm=91;
52. if(month==5)
53. dm=121;
54. if(month==6)
55. dm=152;
56. if(month==7)
57. dm=182;
58. if(month==8)
59. dm=213;
60. if(month==9)
61. dm=244;
62. if(month==10)
63. dm=274;
64. if(month==11)
65. dm=305;
66. if(month==12)
67. dm=335;
68. }
69. dc=dm+date;
70. cout<<“The no of Day is:”<<dc;
71. dn=dc%7;
72. if(dn==0)
73. cout<<“\nSaturday”;
74. else if(dn==1)
75. cout<<“\nSunday”;
76. else if(dn==2)
77. cout<<“\nMonday”;
78. else if(dn==3)
79. cout<<“\nTuesday”;
80. else if(dn==4)
81. cout<<“\nWednesday”;
82. else if(dn==5)
83. cout<<“\nThursday”;
84. else if(dn==6)
85. cout<<“\nFriday”;
86. getch();
87. }
88. int leap(int year)
89. {
90. if(((year%100==0) && (year%400==0)) || (year%4==0))
91. {
92. return 1;
93. }
94. else
95. return 0;
96. }

Test Cases:
TEST RESULTS:

As per the DD path graph for the date problem:

Number of edges (e) = 65

Number of nodes(n) = 49

V(G) = e-n+2P = 65-49+2 = 18

V(G) = Number of regions(inside +outside) = 17 + 1 = 18

EXPERIMENT-5
AIM: Design Independent paths by calculating cyclomatic complexity using Triangle Problem.
SOFTWARE REQUIRED: Turbo C++ Environment.
THEORY: Cyclomatic complexity is software metric (measurement), used to indicate the
complexity of a program. It is a quantitative measure of the number of linearly independent paths
through a program's source code. It gives the maximum number of independent paths in a
program. Two alternate methods are available for the complexity calculations:

1. McCabe's cyclomatic metric V(G) = e-n+2P


where, e: number of edges
n: number of nodes
P: number of connected components
2. Cyclomatic Complexity V(G) of a flow graph is equal to the number of predicate
(decision) nodes plus one.
V(G) = pi+1
where, pi is the number of predicate nodes contained in the flow graph.

Problem Statement: Consider a program for the determination of Previous date. Its input is a
triple of day, month and year with the values in the range
1 ≤ month ≤ 12
1 ≤ day ≤ 31
2000 ≤ year ≤ 2050
The possible outputs are “Previous date” and “Invalid date”. Design the test cases using decision
table-based testing.

Program:
1. #include<iostream.h>
2. # include<conio.h>
3. int leap(int year);
4. void main()
5. {
6. clrscr();
7. int dc,month,date,year,dm,dn,leap;
8. cout<<“Enter the date”;
9. cin>>date;
10. cout<<“\nEnter the month”;
11. cin>>month;
12. cout<<“\nEnter the year:”;
13. cin>>year;
14. cout<<“\nEntered date is:”<<date<<“/”<<month<<“/”<<year;
15. if(leap==0)
16. {
17. if(month==1)
18. dm=0;
19. if(month==2)
20. dm=31;
21. if(month==3)
22. dm=59;
23. if(month==4)
24. dm=90;
25. if(month==5)
26. dm=120;
27. if(month==6)
28. dm=151;
29. if(month==7)
30. dm=181;
31. if(month==8)
32. dm=212;
33. if(month==9)
34. dm=243;
35. if(month==10)
36. dm=273;
37. if(month==11)
38. dm=304;
39. if(month==12)
40. dm=334;
41. }
42. else
43. {
44. if(month==1)
45. dm=0;
46. if(month==2)
47. dm=31;
48. if(month==3)
49. dm=60;
50. if(month==4)
51. dm=91;
52. if(month==5)
53. dm=121;
54. if(month==6)
55. dm=152;
56. if(month==7)
57. dm=182;
58. if(month==8)
59. dm=213;
60. if(month==9)
61. dm=244;
62. if(month==10)
63. dm=274;
64. if(month==11)
65. dm=305;
66. if(month==12)
67. dm=335;
68. }
69. dc=dm+date;
70. cout<<“The no of Day is:”<<dc;
71. dn=dc%7;
72. if(dn==0)
73. cout<<“\nSaturday”;
74. else if(dn==1)
75. cout<<“\nSunday”;
76. else if(dn==2)
77. cout<<“\nMonday”;
78. else if(dn==3)
79. cout<<“\nTuesday”;
80. else if(dn==4)
81. cout<<“\nWednesday”;
82. else if(dn==5)
83. cout<<“\nThursday”;
84. else if(dn==6)
85. cout<<“\nFriday”;
86. getch();
87. }
88. int leap(int year)
89. {
90. if(((year%100==0) && (year%400==0)) || (year%4==0))
91. {
92. return 1;
93. }
94. else
95. return 0;
96. }

TEST RESULTS:

As per the DD path graph for the Triangle problem:

Number of edges (e) = 23


Number of nodes(n) = 18

V(G) = e-n+2P = 23-18+2 = 7

V(G) = Number of regions(inside +outside) = 6 + 1 = 7

EXPERIMENT-6

AIM: Design Independent paths by taking DD path using Date Problem.


SOFTWARE REQUIRED: Borland C/ Turbo C
THEORY: Every node on a flow graph of a program belongs to one DD-path. If the first node
on a DD-path is traversed, then all other nodes on that path will also be traversed. The DD path
graph is used to find independent path for testing. Every statement in the program has been
executed at least once.

Problem Statement: Give the present date in the form of a triplet of day, month and year. To
check whether the date given is valid or invalid. If valid then the output is previous date.

Program:

1. #include<stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. clrscr();
6. int day,month,year,flag=0;
7. int prev_day, prev_month, prev_year;
8. Printf(“enter the date=dd-mm-yy”);
9. Printf(“\nenter the day:”);
10. Scanf(“%d”,&day);
11. Printf(“\nenter the month:”);
12. Scanf(“%d”,&month);
13. Printf(“\nenter the year:”);
14. Scanf(“%d”,&year);
15. if((day>=1 && day<=31) && (month==1 || month==3|| month==5||
16. month==7|| month==8|| month==10 month==12||) && (year>=1))
17. {
18. Printf(“The date entered is valid”);
19. flag=1;
20. }
21. else if((day>=1 && day<=30) && (month==4|| month==6|| month==9||
22. month==11) && (year>=1))
23. {
24. Printf(“The date entered is valid”);
25. flag=1;
26. }
27. else if((day>=1 && day<=29) && (month=2) && (year>=1) && ((year%100==0
&& year%400==0) || (year>=1) && (year%100!==0 && year%4==0)))
28. {
29. Printf(“The date entered is valid”);
30. flag=1;
31. }
32. else if((day>=1 && day<=28) && (month==2) && (year>=1))
33. {
34. Printf(“The date entered is valid”);
35. flag=1;
36. }
37. else
38. {
39. Printf(“\n The date is invalid”);
40. }
41. if(flag==1)
42. {
43. if(day>=2)
44. {
45. prev_day = -prev_day;
46. printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
47. }
48. else if(day==1)
49. {
50. if(month==1)
51. {
52. prev_day = 31;
53. prev_month = 12;
54. prev_year= -year;
55. printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
56. }
57. if(month==5||month==7|| month==10||month==12)
58. {
59. prev_day = 31;
60. prev_month = -month;
61. printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
62. }
63. else if(month==2|| month==4|| month==6||month==8|| month==9|| month==11)
64. {
65. prev_day = 31;
66. prev_month = -month;
67. printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);

68. else
69. if(month==3)
70. {
71. if((year%100==0 && year%400==0) || (year>=1) && (year%100!==0
&& year%4==0))
72. {
73. prev_day = 29;
74. prev_month = -month;
75. printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
76. }
77. else
78. {
79. prev_day = 28;
80. prev_month = -month;
81. printf(“\nThe previous date is:%d%d%d”,&prev_day,&month,&year);
82. }
83. }
84. }
85. }
86. getch();
87. }

FLOW GRAPH:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy