You are on page 1of 10

In the calculator1.

c
Summary Steps to reproduce Expected Result

24: printf spelling is wrong - 1.. Find “prnitf” Printf(“\nUse = at the beginning of
prnitf 2.. Replace it with “printf” a line to operate on “)

Ouput – Use = at the beginning of a


line to operate on
26: missing terminating “ 1.. Go to source code Find printf(“Use quit by itself to
character 2.. Find printf(“Use quit by itself stop the calculator.\n\n”);
to stop the calculator.\n\n);
3.. Put double quote or Output -- Use quit by itself to stop
terminating character before the the calculator
parenthesis closed

29: expected expression 1.. Go to line number 26 While(strcp(gets(input),”quit” != 0)


before ‘while’ 2.. Put the terminating character

107: missing terminating ‘ 1.. Go to line number 29 case ‘-‘:


character 2.. Add terminating character result -= number;
before ‘case’ break;
120: missing terminating 1.. Go to line number 120 Case ‘%’:
character 2. Add terminating character after If(long)number == 0)
‘%’ Print(“Divising by error”)
else:
result = (double)
((long)result % (long)number);
break;

136: expected ‘;’ before ‘}’ 1.. Go to line number 136 Print(“\n\n\aIllegal operation!”);
2.. Add ‘}’ before ‘;’ }
}
}
In the calculator2.c
Summary Steps to reproduce Expected Result
21: expected ‘;’ before ‘:’ 1.. Go to line number 21 Printf(“\nTo use this calculator,
token 2.. remove ‘:’ after enter any expression with or
parenthesis and replace it without spaces”);
with ‘;’

25: missing terminating ‘ 1.. Go to line number 25 Print(‘\nthe result of the previous
character 2.. replace single quote (‘) calulation.”);
with double quote(“)

29: expected ‘)’ before ‘;’ 1.. Go to line number 25 Printf(“\nthe result of the previous
token 2.. .. replace single quote (‘) calculation”);
with double quote(“) Print(“\nUse quit by itself to stop
the calculator\n\n”)
71: expected ‘;’ before ‘}’ 1.. Go to line number 69 If (number_length>0){
token 2. Remove the extra Result = atof(number_string);
parenthesis }
3.. add curly bracket after
the if statement
74: expected identifier or ‘(‘ 1.. Go to line number 74 For(index=0; index < input_length;)
before ‘for’ 2. provide the identifier
3. index = <any_number>
74: expected ‘=’ ‘;’ ‘asm’ or 1.. Go to line number 74 For (index = 0; index <
‘__attribute__’before’<’ 2.. Provide the identifier input_length; index++){
token 3.. Provide the condition
136: expected declaration 1.. Go to line number 136 }
specifiers or ‘…’ before 2.. Copy the print Printf(“ = %f\n”,result);
string constant statement }
3. Place it before curly }
bracket
137: expected identifier or 1.. Go to line number 137 }
‘(‘ before ‘}’ token 2. Copy the print statement Printf(“ = %f\n”,result);
3. place it before curly }
bracket }
138: expected identifier or 1.. Go to line number 138 }
‘(‘ before ‘}’ token 2. Copy the print statement Printf(“ = %f\n”,result);
3. place it before curly }
bracket }

CR02 : Prepare defect log for the following program


Summary Steps to reproduce Expected Result
Line 21: ‘arr’ undeclared 1.. Go to line number 3 Arr[100]
2. Declared the array ‘arr’

CR03 : Prepare defect log for the following program


Summary Steps to reproduce Expected Result
Line 28: ‘tmp1’ undeclared 1..Go to line number 28 A[j] = tmp
2.. replace tmp1 with tmp

Line 38 : expected 1.. Go to line number 37 }


expression before ‘int’ 2.. add curly closing Qsort(int a[],int left, int right)
brackets

Line 39: expected ‘;’ before 1.. Go to line number 38 }


‘{‘ token 2.. Add curly closing Qsort(int a[],int left, int right)
bracket
Line 70: expected 1.. Go to line line number Return ;
declaration or statement at 71 }
end of input 2.. Add close curly bracket
CR04 : Prepare defect log for the following program
Version 1.1
Summary Steps to reproduce Expected Result
Line 12: expected identifier 1.. Go to line number 12 Char ch;
or ‘(‘ before ‘int’ 2. Declare char and int on Int I;
new line

Line 24: too many 1.. Go to line number 24 while(fgetchar(fp) != EOF)


arguments to function 2.. remove ch assignment
‘fgetchar’ for fgetchar

Line 31: incompatible type 1.. Go to line number 31 Fclose(*fp)


for argument 1 of ‘fclose’ 2.. replace file with *file

Summary Steps to reproduce Expected Result


Line 23: expected identifier 1.. Go to line number 21 Fclose(fp);
or ‘(‘ before ‘for’ 2.. Cut closing curly bracket }
from line number 21 }
3. Paste to line number 32

Line 29: expected ‘=’,’,’’;’ 1.. Go to line number 28 For (I = 0;I <26; i++){
‘asm’ or ‘__attribute__’ 2.. remove ‘;’
before ‘++’ token 3.. Add curly opening
bracket

Line 29: unknown type 1.. Go to line number 27 Int I ;


name i’ 2.. declare i variable For(i=0; i<26;i++){

Line 31: expected identifier 1.. Go to line number 21 Fclose(fp);


or ‘(‘ before ‘for’ 2.. remove closing curly }
bracket of function }
3. add curly bracket of
function at the end of the
file, on line number 32
Version 1.2

Version 1.3
Summary Steps to reproduce Expected Result
Line 18: ‘agv’ undeclared 1.. Go to line number 18 If (fopen(argc[1],’r’))==null){
2.. find ‘agv’
3.. replace ‘agv’ with ‘argv’

Line 23: too many 1.. Go to line number 23 while(fgetchar(fp) != EOF)


arguments 2.. remove ch assignment
for fgetchar

CR05 : Prepare defect log for the following program


TC1 A life Insurance company charges a premium for a specific Policy as per the following
criteria.
Use cases

 Rs. 4,500/- per year for the clients less than or equals 35 years of age
 Rs. 4,500/- + Rs. 100(For every year above 35 years of age) per year for the clients
above 35 years and less than or equals to 59 years
 Rs. 10,000/- per year for the clients above 59 years and less than or equals to 75
years of age
 No Insurance availed for clients above 75 years of age

Age Rate
Age<=35 years Rs. 4,500/- per year
35<Age<=59 Rs. 4,500/-+Rs. 100 for every year
above 35 years of age
59<Ag<=75 Rs. 10,000/-
Age above 75 Nil/0

TC2 Taxable income for individual person will be calculated as per the following table:

Martial Status Non Taxable Income


Single Rs. 4,750/-
Married filing Joint Return Rs. 9,500
Married Filing separate Return Rs. 7,000/- Use cases
Widowed Some amount to be filled
 deduction of Rs. 1,000/- is applicable for age more than 60.
TC3 A shopping mall gives discounts according to following slabs for bulk purchases

Use case
There must be mentioned if a senior citizen buy first 10 units still will he be discounted
with additional 5%?
Whether wholesale dealers will also be provided with 40% discount on first 10 units(as it
is mentioned for all purchases) or not?

TC4
A Credit Card Company issues a Credit Card to its customer
The customer can use this credit card for withdrawal of cash. If a customer withdraws a cash
amount of say 5000/-. One time transaction amount of 300/- is charged. All Taxes on total
amount is 150/- . From the day of withdrawal an interest of 3% per month (36% annual) is
imposed on the total amount withdrawn (here on 5000/-). Due date is 30 Days after
withdrawal. Irrespective of when the amount is paid an interest for 1 month will be
collected from the customer. If the person pays the entire amount on or before 30 th day the
Status would be marked as Amount Paid on Day 31. In case person repays a partial amount
say Rs.3000/- by cash on 30th day. Then interest will be imposed on the balance amount
after the 30th day.

Use cases

 In a month to be spent <= Rs.5000


 If exceeds Rs. 5000 limit, one time transaction charge is Rs. 300
 The charges will be Rs. 150 per transaction, after the one time transaction(after
exceeding Rs. 5000 limit).
 An interest of 3% over Rs. 5000 per month will be imposed after exceeding Rs.
5000 limit.
 After a period of 30 days compound interest will be imposed over principle amount
 Compound Interest=Principle[1+ (rate/100)] ^time(in years)
 Total Amount= Principle + Interest
 Consider leap year and 28 days of February

HDFC Bank provides Home loan for its customer .The home loans are of two types : Floating
Interest and fixed interest. In case of fixed Interest the interest applicable will be dependent
on the interest rate at the time of loan. In case of Variable interest the interest rate is
dependent on the interest rates prevalent for that period. No EMI will be paid in first month
of the loan. If the EMI is not paid for then a late fee of 1,000/- is added to the next month
and the EMI is carried forward to next month. The EMI is calculated as follows:
Amount of loan * rate of interest
Monthly EMI = ------------------------------------------
100
Assume at the entry interest rate is 11% and amount is 30, 00,000/-. The interest rate
changed after forty five days to 11.5%. The changed interest will be applicable for next
month.
Use cases

 In case of fixed interests, interest rate will be imposed at the time of the loan.
 In case of variable interests, the interest rate is dependent on the interest rates
prevalent for that period.
 No EMI will be paid in first month of the loan.
 If the EMI is not paid for then a late fee of 1,000/- is added to the next month and
the EMI is carried forward to next month.
 After (first month + 45 days=)75 days monthly interest will be imposed using given
formula. The changed interest will be applicable for next month over principle
amount.

TC5 Case study - Public Provident Fund (PPF) Requirements :

1. Any person aged between 18 and 50 can open an account.


2. The maximum amount that can be deposited in an account in a financial year is Rs.
60,000/-.
3. Account holder can withdraw a part of the account balance after completion of six
financial years of opening the account. (e.g. For an account opened in August 1991,
first withdrawal is allowed on or after 01-Apr-98).. The amount of withdrawal
allowed is 50% of the lower of the following two – (1) balance at the end of 4 th
preceeding financial year, (2) balance at the end of the last financial year.
(e.g. on 25-Jun-2008, 50% of the lower these two will be taken into consideration :
balance as on 31-Mar-2008 or 31-Mar-2005).

Use case

 No account opening for person less than 18 years of age


 Age criteria to open an account -- 18<age<50
 Max amount that can be deposited in an account is Rs. 60,000/- per year.
 Account holder can withdraw a part of the account balance after completion of six
financial years of opening the account.
 The amount of withdrawal allowed is 50% of the lower of the following two –
(1) balance at the end of 4th preceeding financial year,
(2) balance at the end of the last financial year.

TC6 Prepare the possible test cases for a typical ATM machine operation.

Use cases
1. Verify the ‘ATM Card Insertion Slot’ is as per the specification
2. Verify the ATM machine accepts card and PIN details
3. Verify the error message by inserting a card incorrectly
4. Verify the error message by inserting an invalid card (Expired Card)
5. Verify the error message by entering an incorrect PIN
6. Verify that the user is asked to enter the PIN after inserting a valid ATM Card
7. Verify that PIN is encrypted
8. Verify that there is an action like blocking of card occurs when the total no. of
incorrect PIN attempts get surpassed
9. Verify the user is allowed to do only one cash withdrawal transaction per PIN
request
10. Verify the machine logs out of the user session immediately after successful
withdrawal
11. Verify the message when there is no money in the ATM
12. Verify the language selection functionality
13. Verify the cash withdrawal functionality by entering some valid amount
14. Verify the cash withdrawal functionality by entering an amount less than 100
15. Verify the cash withdrawal functionality by entering an amount greater than
the total available balance in the account.
16. Verify the cash withdrawal functionality by entering an amount greater than
per day limit
17. Verify the user is allowed to enter the amount again in case the amount
entered is not valid. A proper message should be displayed.
18. Verify the ATM machine successfully takes out the money.
19. Verify the ATM machine takes out the balance printout after the withdrawal
20. Verify the font of the text displayed in ATM screen
21. Verify the text on the screen buttons visible clearly.
22. Verify the functionality of all the buttons on the keypad
23. Verify the text on the buttons visible clearly.
24. Verify that touch of the ATM screen is smooth and operational
25. Verify the user is allowed to choose different account types like Savings,
Current etc. ,
26. Verify the different combinations of operation and check if there will be an
electricity loss in the middle of the operation. If there is an electricity loss in the
middle of the transaction then the transaction should be marked as null and the
amount shouldn’t be disclosed to others.
27. Verify the functionality of the cash dispenser
28. Verify the functionality of the receipt printer
29. Verify whether the printed data is correct or not in the receipt
30. Verify how much time the system takes to log out.

TC7 The Computer Science department at NCSU is in the process of building a new CSC
building on Centennial Campus. We all know that computer scientists love caffene, so
the CSC department is planning on installing a CoffeeMaker in a lounge across the hall
from the 24-hour computer lab. Our job is to test and model the functionality of the
CoffeeMaker. We are only working with the logic code behind the hardware, so only a
command line interface is used.
Consider the CoffeeMaker is a command line interface application that will serve as the
software of a Coffee Maker.
Use cases
1.verify the coffee machine is working properly or not by
switching ON power supply.
2.verify the coffee machine when power supply is improper.
3.verify the machine that all buttons are visible.
4.verify the indicator light that the machine is turned ON
after switching on power supply.
5.Verify the machine when there is no water.
6.verify the machine when there is no coffee powder.
7.Verify the machine when there is no milk.
10.Verify the machine when there is no sugar.
8.Verify the machine operation when it is empty.
9.Verify the machine operation when all the ingredients are
upto the capacity level.
10.Verify the machine operation when water quantity is less
than its limit.
11.Verify the machine operation when milk quantity is less
than its capacity limit.
12.Verify the machine operation when coffee powder is less
than its capacity limit.
13.verify the machine operation when sugar available is
less than its capacity limit.
14.Verify the machine operation when there is metal piece
is stuck inside the machine.
15.verify the machine by pressing the coffee button and
check it is pouring coffee with appropriate mixture and
taste.
16.verify the machine by pressing the Tea button and check
it is pouring Tea with appropriate mixture and taste.
17.It should fill the coffee cup appropriately i,e quantiy.
18.verify coffee machine operation with in seconds after
pouring milk,sugar,water etc.It
should display message.
19.Verify all the buttons operation.
20.Verify all the machine operation by pressing the buttons
simaltaneously one after the other.
21.Verify the machine operation by pressing two buttons at
a time.
22.verify the machine operation at the time power
fluctuations.
23.Verify the machine operation when all the ingredients
are overloaded.
24.Verify the machine operation when one of the ingredient
is overloaded and others are upto limit.
25.Verify the machine operation when one or some of the
parts inside the machine are damaged.

You might also like