You are on page 1of 30

Guideline to make and understand Unit

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 te
cases/KLOC' item in FunctionList sheet, which is required by customer or normal value. The number of lacked TC
- 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 '
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.
. 6,7,8,9 are normal values.
. 5, 10 are boundary values.
. -1, 11,... 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

- 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.

UNIT TEST CASE


Project Name
Project Code

<Project Name>
<Project Code>

Creator
Reviewer/Approver

Document Code

<Project Code>_XXX_vx.x

Issue Date
Version

Record of change
Effective Date
<Date when these changes
are effective>

02ae-BM/PM/HDCV/FSOFT v2/1

Version

Change Item

*A,D,M

Internal use

Change description

3/30

CASE

<Date when this test report is created>

Reference
<List of documents which are refered in this version.>

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

4/30

UNIT TEST CASE LIST


Project Name
Project Code
Normal number of Test cases/KLOC
Test Environment Setup Description

No

Requirement
Name

1
2
3

02ae-BM/PM/HDCV/FSOFT v2/1

<Project Name>
<Project Code>
100

<List enviroment requires in this system


1. Server
2. Database
3. Web Browser
Function
Class Name Function Name ...
Sheet Name
Code(Optional)
>
Class1
Function A
Function1
Function1
Class2
Function B
Function2
Function2
Class3
Function C
Function3
Function3

Internal use

Description

5/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

6/30

Pre-Condition

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

7/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

8/30

UNIT TEST REPORT


Project Name
Project Code
Document Code
Notes

No
1
2
3

<Project Name>
<Project Code>
<Project Code>_Test Report_vx.x

Creator
Reviewer/Approver
Issue Date

<Date when this test report is created>


<List modules included in this release> ex: Release 1 includes 2 modules: Module1 and Module2

Function code
Function1
Function2
Function3

Sub total

Passed
12
12
12

Failed
2
3
2

Untested
1
0
1

N
12
12
12

A
2
2
2

B
1
1
1

36

36

Test coverage
Test successful coverage
Normal case
Abnormal case
Boundary case

95.56
80.00
80.00
13.33
6.67

%
%
%
%
%

Tes t Type

Passe d Pe r ce nt

Untested
4%
Failed
16%

Failed
Passed
80%

02ae-BM/PM/HDCV/FSOFT v2/1

Passed

Untested

Internal use

B
300%

A
600%

A
B

N
3600%

9/30

16%

Failed
Passed
80%

02ae-BM/PM/HDCV/FSOFT v2/1

Untested

Internal use

600%
B

N
3600%

10/30

n this test report is created>


dule2

Total Test Cases


15
15
15

45

es t Type

N
3600%

N
A
B

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

11/30

N
3600%

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

12/30

Function Code

Function1

UT_lap1

Created By

ThangLX

Executed By

Lines of code

100

Test requirement

Lack of test cases

-5

<Brief description about requirements which are tested in this function>

Passed

Failed

Untested

12

N/A/B
12

UTCID05

UTCID06

UTCID07

UTCID08

UTCID09

UTCID04

UTCID03

UTCID02

UTCID01

Condition

Function A

Type(N : Normal, A : Abnormal, B : Boundary)

Passed/Failed

Executed Date

0
2
/
2
6

0
2
/
2
6

0
2
/
2
7

0
2
/
2
8

0
3
/
0
1

0
3
D/
F0
I2
D
0
0
2

0
3
D/
F0
I3
D
0
0
4

0
3
D/
F0
I4
D
0
0
5

0
3
D/
F0
I5
D
0
0
6

Precondition
Can connect with server

number1
0

O O

1
number2
0

Confirm

O O
O

O O O

Return
1

Exception
Log message
"success"
""
Result

Defect ID

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

13/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

14/30

Function A
-5

ion>
Total Test Cases
15

0
3
D/
F0
I6
D
0
0
7

0
3
D/
F0
I7
D
0
0
8

0
3
D/
F0
I8
D
0
0
9

UTCID15

UTCID12
N

UTCID14

UTCID11
N

UTCID13

UTCID10
N

0
3
D/
F1
I0
D
0
1
1

0
3
D/
F1
I1
D
0
1
2

0
3
D/
F0
I9
D
0
1
0

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

15/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

16/30

Function Code

Function2

Created By

<Developer Name>

Lines of code

Function B

Executed By

300

Test requirement

Lack of test cases

15

<Brief description about requirements which are tested in this function>

Passed

Failed

Untested

12

N/A/B
12

UTCID01

UTCID02

UTCID03

UTCID04

UTCID05

UTCID06

UTCID07

UTCID08

UTCID09

Condition

Function Name

Type(N : Normal, A : Abnormal, B : Boundary)

Passed/Failed

Executed Date

0
2
/
2
6

0
2
/
2
6

0
2
/
2
7

0
2
/
2
8

0
3
/
0
1

0
3
D/
F0
I2
D
0
0
2

0
3
D/
F0
I3
D
0
0
4

0
3
D/
F0
I4
D
0
0
5

0
3
D/
F0
I5
D
0
0
6

Precondition
Can connect with server

Input1
"1"
""
null
Input2
>=5 & <= 10
5
10

Confirm

Return
1
2
Exception
Log message
"success"
"input1 is null"

Result

Defect ID

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

17/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

18/30

Function B
15

ion>
Total Test Cases
15
UTCID10

UTCID11

UTCID12

UTCID13

UTCID14

UTCID15

0
3
D/
F0
I6
D
0
0
7

0
3
D/
F0
I7
D
0
0
8

0
3
D/
F0
I8
D
0
0
9

0
3
D/
F0
I9
D
0
1
0

0
3
D/
F1
I0
D
0
1
1

0
3
D/
F1
I1
D
0
1
2

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

19/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

20/30

Function Code

Function3

Function Name

Created By

<Developer Name>

Executed By

Lines of code
Test requirement

300

Function C

Lack of test cases

15

<Brief description about requirements which are tested in this function>


Untested

12

N/A/B
12

UTCID03

UTCID04

UTCID05

UTCID06

UTCID07

UTCID02

UTCID01

1
UTCID09

Failed

UTCID08

Passed

Condition Precondition
Can connect with server
x
-1

0
1

2
y

-1
<=10

>10

-1

z
<5

5
Confirm

Return

null

"A"

"B"

"C"
"D"

Exception
Log message

Type(N : Normal, A : Abnormal, B : Boundary)

Passed/Failed

Executed Date

0
2
/
2
6

0
2
/
2
6

" Please input >-1"


Result

Defect ID

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

0
2
/
2
7

0
2
/
2
8

0
3
/
0
1

0
3
D/
F0
I2
D
0
0
2

0
3
D/
F0
I3
D
0
0
4

0
3
D/
F0
I4
D
0
0
5

0
3
D/
F0
I5
D
0
0
6

21/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

22/30

Function C
15

ion>
Total Test Cases
15

0
3
D/
F0
I6
D
0
0
7

0
3
D/
F0
I7
D
0
0
8

0
3
D/
F0
I8
D
0
0
9

UTCID15

UTCID12
N

UTCID14

UTCID11
N

UTCID13

UTCID10
N

0
3
D/
F1
I0
D
0
1
1

0
3
D/
F1
I1
D
0
1
2

0
3
D/
F0
I9
D
0
1
0

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

23/30

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

24/30

Function Code

Function1

Function Name

Created By

<Developer Name>

Executed By

Lines of code

100

Test requirement

Lack of test cases

-5

<Brief description about requirements which are tested in this function>

15

15

Precondition

a
-2

-1
0
1
b
0
-2

2
c

0
1

O
O

Confirm

Total Test Ca

UTCID10

UTCID02

UTCID02

UTCID02

UTCID02

UTCID02

N/A/B

UTCID09

Untested

UTCID08

Failed

UTCID07

Passed

UTCID01

Condition

Function A

Return
list
null

size = 0

O
O

{-1/2}
{1,1}

{1,-3}
Exception
Log message
"please input a>= -1"
Result

Type(N : Normal, A : Abnormal, B : Boundary)

O
A

0
2
/
2
6

0
2
/
2
6

0
2
/
2
6

0
2
/
2
6

0
2
/
2
6

0
2
/
2
6

0
3
/
0
3

Passed/Failed
Executed Date
Defect ID

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

25/30

Function A
-5
Total Test Cases
15
UTCID15

UTCID14

UTCID13

UTCID12

UTCID11

02ae-BM/PM/HDCV/FSOFT v2/1

Internal use

26/30

Function Code

Function1

UT_lap1

Created By

ThangLX

Executed By

Lines of code

100

Test requirement

Lack of test cases

<Brief description about requirements which are tested in this function>

Passed

Failed

Untested

15
UTCID05

UTCID04

UTCID03

UTCID02

UTCID01

Condition

Precondition
Can connect with server

number1
-1
0
1
2
number2
-1
0
1

Return
1
Confirm

2
Exception

Log message
"success"
"input1 is null"

Result

Type(N : Normal, A : Abnormal, B : Bo

Passed/Failed

Executed Date

P
0
2
/
2
6

P
0
2
/
2
6

P
0
2
/
2
7

P
0
2
/
2
8

0
3
/
0
1

Defect ID

Function A
-5

n>
N/A/B
0

P
0
3
/
0
7

UTCID15

UTCID14

P
0
3
/
0
6

UTCID13

P
0
3
/
0
5

UTCID12

P
0
3
/
0
4

UTCID11

P
0
3
/
0
3

UTCID10

F
0
3
/
0
2

15

UTCID09

UTCID08

UTCID07

UTCID06
B

Total Test Cases

P
0
3
/
0
8

0
3
/
0
9

P
0
3
/
1
0

0
3
/
1
1

D
F
I
D
0
0
2

D
F
I
D
0
0
4

D
F
I
D
0
0
5

D
F
I
D
0
0
6

D
F
I
D
0
0
7

D
F
I
D
0
0
8

D
F
I
D
0
0
9

D
F
I
D
0
1
0

D
F
I
D
0
1
1

D
F
I
D
0
1
2

You might also like