Lab 2 PDF
Lab 2 PDF
Lab 2 PDF
Ragavendhar
Reg No : 15MIS0087
Lab : L43+L44
A program takes as input a string (5-20 characters) and a single character and checks
whether that single character is present in the string or not. Implement the given
program using any programming language and design test cases using BVA, robust
testing and worst-case testing method
Program :
if (string.count(character) > 0) :
else :
else :
ROBUSTNESS :
WORST CASE :
Output :
Consider this situation. We are writing a module for a human resources system that
decides how we should process employment applications based on a person's age. Our
organization's rules are:
Develop the program for these rules and design the test case using Equivalence class
partitioning.
Program :
def Class_Of_Hire(x) :
else :
else :
STEP 2
EC TABLE
STEP 4
TC No Test ER AR Status EC
input Coverage
Age
1 9 Don’t hire Don’t hire Pass EC1
2 -1 Invalid Age Invalid Age Pass EC2
3 18 Invalid age Part time Fail EC3,EC4
basis only
4 17 Part-time basis Part time Pass EC4
only basis only
5 15 Invalid age Don’t hire Fail EC5,EC1
6 19 Invalid age Full time Fail EC6,EC7
Employee
7 28 Full time Full time Pass EC7
Employee Employee
8 17 Invalid age Part-time Fail EC8,EC4
basis only
9 56 Invalid age Advisory Fail EC9,EC10
committee
only
10 58 Advisory Advisory Pass EC10
committee committee
only
11 54 Invalid age Full time Fail EC11,EC7
Employee
12 100 Invalid age Invalid age Pass EC12,EC2
STEP 5
Output :
A mobile phone service provider uses a program that computes the monthly bill of
customers as follows:
Plus Rs. 0.40 per call for call beyond 240 calls
Write a program and implement the above application. Design test cases for this program
using equivalence class testing technique and test the given application.
Program :
def call (x) :
a = ( x * 1 ) + 300 - 120
print (a)
print (b)
if (x > 240) :
print (c)
Condition 1:
Condition 2:
Condition 3:
Condition 4:
Step 3: EC Table:
Condition Valid Invalid
1 EC1 EC2, EC3
2 EC4 EC5, EC6
3 EC7 EC8, EC9
4 EC10 EC11
Step 4:
TEST CASE TABLE
Step 5:
REMOVE DUPLICATES IN TEST CASE TABLE
An electricity board charges the following rates for the use of electricity:
All users are charged a minimum of Rs. 100 as meter charge.If the total amount is more
than Rs. 400, then an additional surcharge of 15% of total amount is charged.Write a
program to read the names of users and number of units consumed and printout the
charges with names. Design the Test case for this scenarios using suitable Black box
testing technique.
Program :
def read (x) :
a = x * 0.80
c = 200 * 0.80
print ("electricity charge :" , b + c + 100)
if (x > 300) :
d = ( x * 1) - (200 * 1) - (100 * 1)
e = 200 * 0.80
f = 100 * 0.90
amnt = d+e+f+100
STEP 2
STEP 3
EC TABLE
STEP 4
Output :