0% found this document useful (0 votes)
352 views12 pages

Software Testing Lab1

Uploaded by

ASSR
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
352 views12 pages

Software Testing Lab1

Uploaded by

ASSR
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 12

SOFTWARE TESTING LAB

21ISL66
Syllabus
SOFTWARE TESTING
LABORATORY
Course Code 21ISL66 CIE Marks 50
Teaching Hours/Week (L:T:P: S) 0:0:2:0 SEE Marks 50
Total Hours of Pedagogy 24 Total Marks 100
Credits 1 Exam Hours 03
Course Objectives:

CLO 1. Explain the test cases for any given problem


CLO 2. Analyze the requirements for the given problem statement.
CLO 3. Design the solution and write test cases for the given problem.
CLO 4. Construct control flow graphs for the solution that is implemented.
CLO 5. Create appropriate document for the software artifact
Note: two hours tutorial is suggested for each laboratory sessions.
Prerequisite
● Students should be familiar with programming languages like C, C++, Java,
Python etc.
● Usage of IDEs like Eclipse, Netbeans and software testing tools should be
introduced

Sl. No. PART A – List of problems for which student should develop program and execute in the
Laboratory
Design, develop, code and run the program in any suitable language to solve the
1 commission problem. Analyze it from the perspective of boundary value testing, derive
different test cases, execute these test cases and discuss the test results.

Design, develop, code and run the program in any suitable language to implement the NextDate
2 function. Analyze it from the perspective of equivalence class value testing, derive different test
cases, execute these test cases and discuss the test results.

Design, develop, code and run the program in any suitable language to solve the commission
3 problem. Analyze it from the perspective of decision table-based testing, derive different test
cases, execute these test cases and discuss the test results.

Design and develop a program in a language of your choice to solve the triangle problem
defined as follows: Accept three integers which are supposed to be the three sides of a triangle
and determine if the three values represent an equilateral triangle, isosceles triangle, scalene
4 triangle, or they do not form a triangle at all. Assume that the upper limit for the size of any
side is 10. Derive test cases for your program based on boundary-value analysis, equivalence
class partitioning and decision-table approach and execute the test
cases and discuss the results.
Design, develop, code and run the program in any suitable language to solve the commission
5 problem. Analyze it from the perspective of dataflow testing, derive different test cases, execute
these test cases and discuss the test results.
Design, develop, code and run the program in any suitable language to implement the
6 binary search algorithm. Determine the basis paths and using them derive different test
cases, execute these test cases and discuss the test results.
PART B – Practical Based
Learning
Develop a Mini Project with documentation of suitable test-cases and their results to perform
01 automation testing of any E-commerce or social media web page.

Programs Pseudocode : Chapter 2


Generalized Pseudocode
Pseudocode provides a language-neutral way to express program source code. This version is loosely
based on Visual Basic and has constructs at two levels: unit and program components. Units can be
interpreted either as traditional components (procedures and functions) or as object-oriented
components (classes and objects)

Three examples will be used throughout this syllabus:

1.Triangle Program
2.Next Date program
3. Commission program

1.1 The Commission Problem

Problem Statement

A rifle salesperson in the former Arizona Territory sold rifle locks, stocks, and
barrels made by a gunsmith in Missouri. Locks cost $45, stocks cost $30, and
barrels cost $25. The salesperson had to sell at least one lock, one stock, and one
barrel (but not necessarily one complete rifle) per month, and production limits
were such that the most the salesperson could sell in a month was 70 locks, 80
stocks, and 90 barrels. After each town visit, the salesperson sent a telegram to
the Missouri gunsmith with the number of locks, stocks, and barrels sold in that
town. At the end of a month, the salesperson sent a very short telegram showing
–1 lock sold. The gunsmith then knew the sales for the month were complete and
computed the salespersons commission as follows: 10% on sales up to (and
including) $1000, 15% on the next $800, and 20% on any sales in excess of
$1800.
1. Design, develop, code and run the program in any suitable language to solve the
commission problem. Analyze it from the perspective of boundary value, derive
test cases, execute these test cases and discuss the test results.

/*Assumption price for lock=45.0, stock=30.0 and barrels=25.0 production limit


could sell in a month 70 locks,80 stocks and 90 barrels commission on sales = 10 % <=
1000 and 15 % on 1000 to 1800 and 20 % on above 1800.*/

AIM: The aim of the commission program is to find out the commission value by using
user given criteria.
SCOPE: To check whether the given values of locks, stocks and barrels are within the range and
calculate the commission value
1.1 Requirement
Problem Definition: The Commission Problem includes a salesperson in the former Arizona
Territory sold rifle locks, stocks and barrels made by a gunsmith in Missouri. Cost includes
Locks- $45
Stocks- $30
Barrels- $25
The salesperson had to sell at least one complete rifle per month and production limits were
such that the most the salesperson could sell in a month was 70 locks, 80 stocks and 90
barrels. After each town visit, the sales person sent a telegram to the Missouri gunsmith with
the number of locks, stocks and barrels sold in the town. At the end of the month, the
salesperson sent a very short telegram showing -1 lock sold. The gunsmith then knew the
sales for the month were complete and computed the salesperson’s commission as follows:
On sales up to(and including) $1000= 10%
On the sales up to(and includes) $1800= 15%
On the sales in excess of $1800= 20%
The commission program produces a monthly sales report that gave the total number of
locks, stocks and barrels sold the salesperson’s total dollar sales and finally the commission.

The salesperson had to sell at least one complete rifle per month

1.2 Algorithm
Step 1: Define Lockprice=45.0, Stockprice=30.0, Barrelprice=25.0
Step2: Input Locks
Step3: while (locks!=-1) ‘input device uses -1 to indicate end of data go to STEP 12
Step4: input (stocks, barrels)
Step5: Compute Locksales, Stocksales, Barrelsales and Sales
Step6: Output (“Total Sales:” Sales)
Step7: If (Sales > 1800.0) Goto Step 8 Else Goto Step 9
Step8: commission=0.10*1000.0; commission=commission+0.15 * 800.0;
commission = commission + 0.20 * (sales-1800.0)
Step9: if (sales > 1000.0) goto STEP 10 else goto STEP 11
Step10: commission=0.10* 1000.0; commission=commission + 0.15 *
(sales-1000.0)
Step11: Output(“Commission is $”, commission)
Step12: exit.
1.3 TEST FUNCTION(Program Code)
#include<stdio.h>
int main()
{
int locks, stocks, barrels, tlocks, tstocks, tbarrels;
float lprice, sprice, bprice, sales, comm;
int c1,c2,c3,temp;
lprice=45.0, sprice=30.0, bprice=25.0, tlocks=0, tstocks=0, tbarrels=0;
printf("\nenter the number of locks and to exit the loop enter -1 for locks\n");
scanf("%d",&locks);
while(locks!=-1)
{
//check the range of locks, stocks and barrels
c1=(locks<=0||locks>70);
printf("enter the number of stocks and barrels\n");
scanf("%d%d",&stocks,&barrels);
c2=(stocks<=0||stocks>80);
c3=(barrels<=0||barrels>90);
if(c1)
printf("value of locks not in the range 1..70 ");
else
{
temp=tlocks+locks;
if(temp>70)
printf("new total locks =%d not in the range 1..70 so old ",temp);
else
tlocks=temp;
}
printf("total locks = %d\n",tlocks);
if(c2)
printf("value of stocks not in the range 1..80 ");
else
{
temp=tstocks+stocks;
if(temp>80)
printf("new total stocks =%d not in the range 1..80 so old ",temp);
else
tstocks=temp;
}
printf("total stocks=%d\n",tstocks);
if(c3)
printf("value of barrels not in the range 1..90 ");
else
{
temp=tbarrels+barrels;
if(temp>90)
printf("new total barrels =%d not in the range 1..90 so old ",temp);
else
tbarrels=temp;
}
printf("total barrel=%d",tbarrels);
printf("\n enter the number of locks and to exit the loop enter -1 for locks\
n");
scanf("%d",&locks);
}
printf("\ntotal locks = %d\ntotal stocks =%d\ntotal barrels =%d\
n",tlocks,tstocks,tbarrels);
//calculation of sales and commission

sales = lprice*tlocks+sprice*tstocks+bprice*tbarrels;
printf("\n the total sales=%f\n", sales);
//depending on sales calculate the commission

if(sales > 0)
{
if(sales > 1800.0)
{
comm=0.10*1000.0;
comm=comm+0.15*800;
comm=comm+0.20*(sales-1800.0);
}
else if(sales > 1000)
{
comm =0.10*1000;
comm=comm+0.15*(sales-1000);
}
else
comm=0.10*sales;
printf("the commission is=%f\n",comm);
}
else
printf("there is no sales\n");
return 0;
}

1.4 Test Case Design Specification

Test Case Name: Boundary Value for Commission Problem


Test data: price Rs for lock - 45.0, stock - 30.0 and barrel - 25.0
Sales = total lock * lock price + total stock * stock price + total barrel * barrel
price
commission: 10% up to sales Rs 1000, 15 % of the next Rs 800 and 20 % on
any
sales in excess of 1800
Pre-condition: lock = -1 to exit and 1< =lock < = 70, 1<=stock <=80 and 1<=barrel<=90
a. Test Design Specification Identifier:
This example test design specification has the ID:com1

b. Features to be tested:
 The given integer values of stock, lock and barrels (ranges from 0 to
32768)
 The given values are invalid inputs.

c. Approach Refinement:
i. Selection of specific test techniques: Boundary value analysis
1. Reasons for technique selection: there is it makes use of
the fact that the inputs and outputs of the components
under test can be partitioned into order sets with
identifiable boundaries.
ii. Method(s)for results analysis: Manual testing with appropriate test
case
iii. Relationship of the test items/features to the levels of testing:
unit level testing.

d. Test Identification: Boundary value Testing

Min Min+ Normal Max- Max


Locks 1 2 35 69 70
Stocks 1 2 40 79 80
Barrels 1 2 45 89 90

Features Test Test case Description


case ID
1<=Locks, stocks and barrels>=10 Com1.1 10% of commission on
sales<=$1000
10<=Locks, stocks and barrels<=18 Com1.2 15% of commission on
sales<=$1800 and >=1000
18<=locks<=70 and 18<=stocks Com1.3 20% of commission on
<=80 and 19<=barrels<=90 sales>$1800

1.5 TESTCASES

Checking Boundary Value for Locks, Stocks and Barrels and Commission
Commission Problem Output Boundary Value Analysis Cases
Input Data Expected Actual output
Test Case Description Output Status Comment
Id Total Total Total Sales Comm- Sales Comm-
Locks Stocks Barre ission ission
ls
Comm1.1 Enter the min 1 1 1 100 10 output
value for locks, minimum
stocks and
barrels
Comm1.1 Enter the min 1 1 2 125 12.5 output
Comm1.1 value for 2 items 1 2 1 130 13 minimum
Comm1.1 and min +1 for 2 1 1 145 14.5 +
any one item
Comm1.1 Enter the value 5 5 5 500 50 Midpoint
sales
approximately
mid value
between 100 to
1000
Comm1.1 Enter the values 10 10 9 975 97.5 Border
Comm1.1 to calculate the 10 9 10 970 97 point -
Comm1.1 commission for 9 10 10 955 95.5
sales nearly less
than 1000
Comm1.1 Enter the values 10 10 10 1000 100 Border
sales exactly point
equal to 1000
Comm1.2 Enter the values 10 10 11 1025 103.75 Border
Comm1.2 to calculate the 10 11 10 1030 104.5 point +
Comm1.2 commission for 11 10 10 1045 106.75
sales nearly
greater than
1000
Comm1.2 Enter the value 14 14 14 1400 160 Midpoint
sales
approximately
mid value
between 1000 to
1800
Comm1.2 Enter the values 18 18 17 1775 216.25 Border
Comm1.2 to calculate the 18 17 18 1770 215.5 point -
Comm1.2 commission for 17 18 18 1775 213.25
sales nearly less
than 1800
Comm1.2 Enter the values 18 18 18 1800 220 Border
sales exactly point
equal to 1800
Comm1.3 Enter the values 18 18 19 1825 225 Border
Comm1.3 to calculate the 18 19 18 1830 226 point +
commission for
Comm1.3 19 18 18 1845 229
sales nearly
greater than
1800
Comm1.3 Enter the values 48 48 48 4800 820 Midpoint
normal value for
lock, stock and
Barrel
Comm1.3 Enter the max 70 80 89 7775 1415 Output
Comm1.3 value for 2 items 70 79 90 7770 1414 maximum
Comm1.3 and max - 1 for 69 80 90 7755 1411 -
any one item
Comm1.3 Enter the max 70 80 90 7800 1420 Output
value for locks, maximum
stocks and
barrels

Output Special Value Test Cases


Case Description Input Data Expected Output Actual output
Status Comment
Id Total Total Total Sales Commissi Sales Commiss
Locks Stocks Barrels on ion
SV1 enter the 10 11 8 995 99.5 Border
random values point -
such that to
calculate
commission
for sales nearly
less than 1000
SV2 Enter the 10 11 9 1005 100.75 Border
random values point +
such that to
calculate
commission
for sales nearly
greater than
1000
SV3 Enter the 18 17 19 1795 219.25 Border
random values point -
such that to
calculate
commission
for sales nearly
less than 1800
SV4 Enter the 18 19 17 1805 221 Border
random values point +
such that to
calculate
commission
for sales nearly
greater than
1800

1.6 TESTPROCEDURE
Step1: Store the commission program in your system.
Step2: Compile and run the program
Step3: Enter three integer values for locks, stocks and barrels to find out
commission (excluding negative values).
Step4: Check for features to be tested using test cases.

1.7 TEST REPORT

o Using boundary value analysis, we tested all the test cases specified
in the test case (com1.1 to 1.3) and also special value test cases.
o All the feature e test cases are tested and got the expected results.

You might also like