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

Guideline To Make and Understand Unit Test Case: 1. Overview

This document provides guidelines for creating unit test cases, including: 1) Test cases should combine conditions and confirmations, with conditions including preconditions and input values (normal, boundary, abnormal) and confirmations including expected outputs. 2) Each function sheet should include test cases that cover a variety of input combinations, and the number of test cases should meet requirements. 3) Guidelines are provided for documenting test cases, including documenting the function code, name, lines of code, requirements being tested, and results (pass/fail).

Uploaded by

Dương Dũng
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Guideline To Make and Understand Unit Test Case: 1. Overview

This document provides guidelines for creating unit test cases, including: 1) Test cases should combine conditions and confirmations, with conditions including preconditions and input values (normal, boundary, abnormal) and confirmations including expected outputs. 2) Each function sheet should include test cases that cover a variety of input combinations, and the number of test cases should meet requirements. 3) Guidelines are provided for documenting test cases, including documenting the function code, name, lines of code, requirements being tested, and results (pass/fail).

Uploaded by

Dương Dũng
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Guideline to make and understand Unit Test Case

1. Overview
- In the template, Unit test cases are based on functions. Each sheet presents test cases for one function.
- Cover: General information of the project and Unit Test cases
- FunctionList: The list of Classes and Functions in the document.
+ To control that the number of Unit TC meets customer's requirement or the norm, user should fill value for
'Normal number of Test cases/KLOC'.
+ Click on Function link to open the related Test cases of the function.
Note: You should create new Function sheet before creating the link
- Test Report: provive the overview results of Functions Unit test: Test coverage, Test successful coverage
(Summary, for normal/abnormal/boundary cases)
Note: Should check the formula of "Sub Total" if you add more functions

2. Content in Test function sheet


2.1 Combination of test cases.

- To verify that number of Unit TC meets customer's requirement or not. User has to fill number LOC of tested function and fill value of 'Normal number test cases/KLO
- If the number of Unit TC does not meet the requirement, creator should explain the reasons.

- If the number of 'Normal number test cases/KLOC' item in FunctionList sheet is not recorded, the number in 'Lack of test cases' is not calculated.

2.2 Condition and confirmation of Test cases.


Each test case is the combination of condition and confirmation.
a. Condition:
- Condition is combination of precondition and values of inputs.
- Precondition: it is setting condition that must exist before execution of the test case.
Example: file A is precondition for the test case that needs to access file A.
- Values of inputs: it includes 3 types of values: normal, boundary and abnormal.
. Normal values are values of inputs used mainly and usually to ensure the function works.
. Boundary values are limited values that contain upper and lower values.
. Abnormal values are non-expected values. And normally it processes exception cases.
- For examples:
Input value belongs to 5<= input <=10.
. 1,2,3,4,5,6,7,8 are normal values.
. 0, 9, a, f, A, F are boundary values.
. -1, m,... are abnormal values.
b. Confirmation:
- It is combination of expected result to check output of each function.
If the results are the same with confirmation, the test case is passed, other case it is failed.
- Confirmation can include:
+ Output result of the function.
+ Output log messages in log file.
+ Output screen message...
c. Type of test cases and result:
- Type of test case: It includes normal, boundary and abnormal test cases. User selects the type based on the type of input data.
- Test case result: the actual output results comparing with the Confirmation.
P for Passed and F for Failed cases.
It can 'OK' or 'NG' (it depends on habit of the teams or customers)

2.3. Other items:


- Function Code: it is ID of the function and updated automatically according to FunctionList sheet.
- Function Name: it is name of the function and updated automatically according to FunctionList sheet.
- Created By: Name of creator.
- Executed By: Name of person who executes the unit test
- Lines of code: Number of Code line of the function.
- Test requirement: Brief description about requirements which are tested in this function, it is not mandatory.
Normal number test cases/KLOC' item in FunctionList sheet, which is required by customer or normal value. The number of lacked TC is shown in 'Lack of test cases' item.
est cases' item.
Condition Valid partition Tag Invalid partition Tag Valid boundary Tag Invalid boundary Tag
Điểm khách hàng < 1000 điểm A5 <0 điểm B3 0 C8 -1 D3
< 5000 điểm và >= 1000 điểm A6 null B4 4999 C9 Empty D4
< 10000 điểm và >= 5000 điểmA7 1000 C10
>=10000 điểm A8 5000 C11
999 C12
10000 C13

Số tiền vay 0 triệu và < 10 triệu A9 <0 đồng B5 0 đồng C14 -1 đồng D5
>=10 triệu và >100 triệu A10 null B6 9,999,999 C15 empty D6
>=100 triệu và <200 triệu A11 100,000,000 C16
>=200 triệu và <500 triệu A12 199,999,999 C17
>= 500 triệu A13 200,000,000 C18
499,999,999 C19
500,000,000 C20

Kỳ hạn <= 6 tháng và >= 1 tháng A14 null B7 6 tháng C21 0 tháng D7
> 6 tháng A15 7 tháng C22

Test case 1 A14,D6,A8


2 D7,C20,A7
3
4 A8,A13,A15
5 A8, A12, A15
6 A8, A11, A15
7 A8, A10, A15
8 A8, A9, A15
9 A8, A13,A14
10 A8, A12, A14
11 A8, A11, A14
12 A8, A10, A14
13 A8, A9, A14
14 A7, A13,A15
15 A7, A12, A15
16 A7, A11, A15
17 A7, A10, A15
18 A7, A9, A15
19 A7, A13,A14
20 A7, A12, A14
21 A7, A11, A14
22 A7, A10, A14
23 A7, A9, A14
24 A6, A12, A15
25 A6, A11, A15
26 A6, A10, A15
27 A6, A9, A15
28 A6, A13,A14
29 A6, A12, A14
30 A6, A11, A14
31 A6, A10, A14
32 A6, A9, A14
33 A5, A13,A15
34 A5, A12, A15
35 A5, A11, A15
36 A5, A10, A15
37 A5, A9, A15
38 A5, A13,A14
39 A5, A12, A14
40 A5, A11, A14
41 A5, A10, A14
42 A5, A9, A14
Function Code F0001 Function Name CalculateInterest
Created By Duong Tien Dung Executed By Tester B
Lines of code Lack of test cases
Test requirement Check the bank interest calculation function. The input amount is the amount you want to borrow, the output amount has been calculated with interest.
Passed Failed Untested N/A/B Total T
0 0 0 0 4 2

UTCID01

UTCID02

UTCID03

UTCID04

UTCID05

UTCID06

UTCID07

UTCID08

UTCID09

UTCID10

UTCID11

UTCID12
Condition Precondition
Input loanAmount,
Vay trên 6 tháng , SốTiền Empty ,Rank A Empty O
0 tháng ,500 triệu ,Rank B 500 triệu O
Điểm >10000 , Sốtiền >= 500 triệu , Kỳ hạn > 6 tháng 600 triệu, 7 tháng,lãi chuẩn 1.0 ,điểm 11000 O
Điểm >10000 , Sốtiền >= 500 triệu , Kỳ hạn < 6 tháng 600 triệu, 2 tháng,lãi chuẩn 1.0 ,điểm 10010 O
Điểm <1000 , Sốtiền <10 triệu , Kỳ hạn < 6 tháng điểm 999, 5 triệu,5 tháng lãi chuẩn 1.0 O
Điểm >=1000 và điểm 3000, 200 triệu,7 tháng lãi chuẩn 1.0
<5000 , Sốtiền >100
triệu v
à nhỏ 200 triệu , Kỳ
hạn > 6 tháng
O
Điểm >=1000 và điểm 3000, 800 triệu,5 tháng lãi chuẩn 1.0
<5000 , Sốtiền >500
triệu v
à nhỏ 200 triệu , Kỳ
hạn < 6 tháng
O

02ae-BM/PM/HDCV/FSOFT v2/1 Internal use 8/


Confirm Return
Output 0.9 O
Output 0.99 O
Output 2.31 O
Output 1.44 O
O

Exception

Log message
SốTiền không hợp lệ O
Tháng vay không hợp lệ O
Result Type(N : Normal, A : Abnormal, B : Boundary) B B A A A A
Passed/Failed
Executed Date
Defect ID

02ae-BM/PM/HDCV/FSOFT v2/1 Internal use 9/


has been calculated with interest.
Total Test Cases
UTCID13

UTCID14

UTCID15

UTCID16

UTCID17

UTCID18

UTCID19

UTCID20

UTCID21

02ae-BM/PM/HDCV/FSOFT v2/1 Internal use 10/


02ae-BM/PM/HDCV/FSOFT v2/1 Internal use 11/

You might also like