0 ratings 0% found this document useful (0 votes) 15 views 60 pages Software Testing Lab File
The document outlines various programming experiments focused on testing methods such as boundary value analysis, equivalence class testing, decision table testing, and data flow testing for different mathematical problems, including determining the type of triangle and calculating areas of geometric shapes. Each experiment includes code snippets, test cases, and expected outputs, demonstrating the application of testing techniques in software development. Additionally, it discusses the nature of quadratic equations and includes a case study on static and dynamic testing tools.
AI-enhanced title and description
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save software testing lab file (1) For Later INDEX
[S.No
Date
‘Signature
To determine the nature of a quadratic roots.
Design boundary value testing
To determine the type of triangle. Its input is triple
of positive integers (say x, y, 2) and the values may
be from interval [1,100].The program output may be
one of the following [Scalene, Isosceles, Equilateral,
Not a Triangle]. Perform BVA.
To determine area of circle, square, rectangle and
triangle. Design equivalence testing
Consider a program for determination of a previous
date using decision table based testing and design
its test cases
To determine the values of a reuse to b and design
test cases by performing decision table based
testing on it.
Perform decision table based testing on triangle
problem
Perform data flow testing on Quadratic equations.
To determine the three sides of the triangle, its
input will be +ve integers greater than 0 and less
than or equa! to 100. Draw DD Path Graph for the
same.
Design the test cases by using cause effect graphing
testing technique on triangle problem.
10.
Make a case study on static and dynamic testing
tools.EXPERIMENT 2
AIM
To determine the type of triangle. Its input is triple of positive integers (say x,
y, 2) and the values may be from interval [1,100].The program output may be
one of the following [Scalene, Isosceles, Equilateral, Not a Triangle].Perform
BVA.
CODE
#include
#include
using namespace std;
int main()
{
inta,b,c,flag=0;
cout<<"\nEnter the First side of Triangle :";
cin>>a;
cout<<"Enter the Second side of Triangle : ";
cin>>b;
cout<<"Enter the Third side of Triangle : ";
cin>>c;
iff(a>O)&8&(a<=100)& &(b>0)&& (b<=100)&.8&(c>0)&&(c<=100))
{
if(((a+b)>c)&&((b+c)>a)&&((a+c)>b))
6ii(fiage=)
Wazeb && v==c)
cout<<'"Triangle is equilateral";
else if{a==b || b
cout<<"Triangle is isosceles";
cout<<"Triangle Is scalene";
cout<<"It's not a Triangle";
else
cout<<''Values are out of range";
return 0;OUieor
1) Sersnshot with Output as “Equilateral Triangle” Is as under
nter the First side of Tri
ater the Second side of Tria
ater the Third side of Triangle : 100
riangle is equilateral
‘ess exited after 9.933 seconds with return value
Ss any key to continue...
2) Screenshot with Output as” Isosceles triangle” is as under
er the First side of Triangle : 50
Enter the Second side of Tria : 50
enter the Third side of Triangle : 1
riangle is isosceles
ocess exited after 33.47 seconds with return value @
s any key to continue . .3) Screenshot with Output as” Not a triangle” is as under
inter the First side of Triangle : 50
Enter the Second side of Triangle + 100
inter the Third side of Triangle : 50
It's not a Triangle
ocess exited after 5.815 seconds with return value 0
Press any key to continue .
4) Screenshot with Output as” Values out of range” is as under
jalues are out of range
rocess exited after 7.761 seconds with return value @
Press any key to continue . . .Bounguary Vaiue Analysis Test cases
Number of Test cases generated: 4*n+1
Here =o
So total test cases generated: 4*3+1 = 13
1 50 50 1 Isosceles
triangle
2 50 50 2 Isosceles
triangle
3 50 50 50 Equilateral
triangle
4 50 50 99 Isosceles
triangle
s 50 50 100 Nota
triangle
é 50 1 50 \sosceles
triangle
7 50 2 50 Isosceles
triangle
8 50 99 50 Isosceles
triangle
9 50 100 50 Nota
triangle
10 1 50 50 Isosceles
triangle
11 “ 50 50 Isosceles
1 triangle
12 99 50 50 Isosceles
triangle
13 100 50 50 Nota
triangle
10EXPERIMENT 3
Aww
To determine the area of the circle, triangle, square and rectangle and write
test cases by performing equivalence class testing.
COUE
#includeciostream>
#include
using namespace std;
int main()
{
intch;
floatb,h,|;
cout<<"Choose
One:"<<"\n1.Triangle"<<"\n2.Square"<<"\n3.Circle"<<"\n4.Rectangle";
cout<<"\nWhat's your choice:";
cin>>ch;
switch(ch)
il
case1: _cout<<"Enter the base of Triangl
cin>>b;
cout<<"Enter the height of Triangl
cin>>h;
if((b<=0) | | (b>=201)| | (h<=0)| | (h>=201))
cout<<"Invalid Input";else
cout<<"Area of Triangle:"<<0.5*b*h;
break;
case 2: cout<<"Enter the side of the Square:";
cin>>b;
if((b<=0) | (b>200))
cout<<"Invalid Input";
else
cout<<"Area of Square:"<>b;
if((b<=0)| | (b>200))
cout<<"Invalid Input";
else
cout<<" Area of Circle:"<<3.14*b*b;
break;
case 4: cout<<"Enter the length of Rectangle";
cin>>b;
cout<<"Enter the Breadth of Rectangle:";
cin>>h;
if((b<=0)| | (b>200)| | (h<=0)| |(h>200))
cout<<"Invalid Input";
else
cout<<"Area of Rectangle:""<200}
th: 1<=h<=200}
+: b<=0)
: b>200}
\6= =2001}
Test Cases for the Case of Triangle are as under:
0 100 Invalid Input
1
eB 100 | __100 5000
3 201_-| 100 Invalid Input
a 100 | 0 Invalid Input
5 100 | 100 5000
6 100 201 Invalid Input
14Ouipur Domain:
O1 = {: Triangle if h > 0, b > 0}
02 ={: Nota triangle if h <= 0, b <= 0}
Screenshot of output with Inputs of Triangle is as under:
-Rectangle
that's your choice:1
Process exited after 16.46 seconds with return value @
invalid Input
process exited after 54.74 seconds with return value @
Press any key to continue . - -
15s.circle
jectangle
*s your choice:1
inter the base of Triangle:100
nter the height of Triangle:100
rea of Triangle:5000
rocess exited after 5.911 seconds with return value 0
iss any key to continue . .
Case 2: Square
Input Domain:
I= {s:s<=0}
12 = {s: s>200)
1B = (5: 1<=s<=
100}
Test Cases for the Case of Square are as under:
1 0 Invalid Input
2 100 10000
3 201 Invalid Input
Output Domain:
01 ={: Square if s>)
02 ={: Not a square if s <= 0}
16under:
yat's your choice:2
enter the side of the Square:0
Invalid Input
rocess exited after 3.106 seconds with return value @
Ipress any key to continue. . .
|
-Triangle
:Square
-Circle
Rectangle
ats your choice:
nter the side of the Square:100
rea of Square: 10000
Process exited after 8.866 seconds with return value @
Press any key to continue . . .
Case 3: Circle
Input Domain:
I= {r: r<=0)
12 = {r:>200)
13 =r: 1<=r<=200)
7Test Cases for the Case of Rectangle are as under:
1 0 100 Invalid Input
2 100 100 10000
3 201 100 Invalid Input
4 100 0 Invalid Input
3 100. 100 10000
6 100 201 Invalid Input
Screensict of output with inputs of Rectangle is as under:
Process exited after 7.927 seconds with return value @
Press any key to continue . . .
RESULT
The area of the shapes problem is successfully tested.)
cout<<"Previous Date:
hb
int main()
{ practice q;
q.input();
return 0;
Decision Table Based Test Cases
1964 31 May 1964
"eedde<"/"cemonth<<"/"<
using namespace std;
. int main()
{
. inta,b,c,d;
|. Double D;
. cout<<"Enter the value of co-efficent of X*2 :";
. cin>>a;
. cout<<"Enter the value of co-efficent of X
. cin>>b;
. cout<<"Enter the value of constant :";
10.cin>>c;
41.if((a<0) | | (b<0)| |(c<0) | | (a>100) | (b>100)| | (c>100)){
12.validinput=1;
13.if (a==0){
WMNANnNAWNE
14.validinput=-
3321}
22.Else if(d>0)
23.{D=sqrt(d);
24.cout<<"Real Roots"<
#include
using namespace std;
38.int main()
39.{
40.inta,b,c, flag=0;
41.cout<<"\nEnter the First side of Triangle : ";
42.cin>>a;
43.cout<<"Enter the Second side of Triangle : ";
44.cin>>b;
45.cout<<"Enter the Third side of Triangle :";
46.cin>>c;
47.if((a>0)&&(a<=100)&& (b>0) && (b<=100)&& (c>0)&&(e<=100)){
48.if(((a+b)>c)&&((b+c)>a)&&((a+c)>b)){
49.flag=1;
50.}
51.}
52.else {
53.flag= -1;
54.}
55. if(flag==1){
56.if(a==b && b==c){
57.cout<<"Triangle is equilateral";
58.}
5059.cise if(a==b ||
¢ | | a==c){
G0.cout<<"Triangle is isosceles";
61.}
62.else{
63.cout<<"Triangie is s¢
64.}
65.}
66.else if(flag==0){
67.cout<<"it's not a Triangle";
68.}
69.uisef{
70.cout<<"Values are out of range";
713
72.getche();
73.return 0;
74.3
stOuTrUr
1) Screenshot with Outputas “Equilateral Triangle” is as under
nter the First side of Tria
ter the Second side of Tri
nter the Third side of Triangle :
riangle is equilateral
rocess exited after 9.933 seconds with return value ©
ress any key to continue...
2) Screenshot with Output as” Isosceles triangle” is as under
enter the First side of Triangle :
inter the Second side of Triangle
inter the Third side of Triangle : 1
riangle is isosceles
rocess exited after 33.47 seconds with return value @
ress any key to continue . . .
523) Screenshot with Output us” Not a triangle” is as under
4) Screenshot with Output as” Values out of range” is as under
nter the First side of Triangle
nter the Second side of Triangle
rocess exited after 7.761 seconds with return value @
Press any key to continue . . .
53Cause effect graph of triangle problem
RESULT
Hence cause effect graph for the triangle problem is constructed.EXPERIMENT 10
AIM
Make a case study on static and dynamic testing tools.
THEORY
Static Testing:
Itis a forra of software tasting wiiere sie software isn’t actually used. This is in
Contrast to dynamic testing. it is generaity not detailed testing, but checks
mainly for the sanity cf the code, algorithm, or document. It is primarily
checking of the code and/or manually reviewing the code or document to find
errors. This type of testing can be used by the developer who wrote the code,
in isolation. Code reviews, inspections and software walkthroughs are also
used. From the black box testing point of view, static testing involves reviewing
requirements and specifications. This is done with an eye toward completeness
or appropriateness for the task at hand. This is the verification portion of
verification and validation. Bugs discovered at this stage of development are
less expensive to fix than later in the development cycle. This people involved
in static testing are application developers and testers
Static Test Tools
These tools do not involve actual input and output. Rather, they take a
symbolic approach to testing, i.e. they do not test the actual execution of the
software, These tools include the following:
Flow Analyzers: They ensure consistency in data flow from input to output.
Path Testers: They find unused code and code with contradictions.
Coverage Analyzers: It ensures that all logic paths are tested,
56ve Analyzers: Ii examines the effect of passing variables and data
between modules,
Dynamic Testing:
Dynamic testing or dynamic analysis is a term used in software engineering to
describe the testing of the dynamic behavior of code. That is, dynamic analysis
refers to the examination of the physical response from the system to variables
that are not constar. and change with time. In dynamic testing the software
must actually be compiled and run, Actually Dynamic Testing involves working
with the software, giving input values and checking if the output is as
expected. Unit Tests, Integration Tests, System Tests and Acceptance Tests are
few of the dynamic Testing methodologies. Dynamic testing means testing
based on specific test cases by execution of the test object or running
programs.
Dynamic Test Tools:
These tools test the software system with live data. Dynamic test tools include
the following.
Test Driver: It inputs data into a module-under-test
Test Driver: It simultaneously displays source code along with the program
under execution.
Emulators: The response facilities are used to emulate parts of the system not
yet developed.
Mutation Analyzers: The Errors are deliberately ‘fed’ into the code in order to
test fault tolerance of the system.
57