Professional Documents
Culture Documents
Template_Unit Test Case (Autosaved)
Template_Unit Test Case (Autosaved)
Template_Unit Test Case (Autosaved)
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
- 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.
Record of change
Effective Date Version Change Item *A,D,M Change description
minhdhn
minhdhn
18/3/2024
Reference
21%
Passed N
Failed A
Untested B
Passed N
Failed A
Untested B
79%
4
Requirement
No Class Name Function Name Sheet Name Description
Name
1 ProductDBContext getAllProduct Function1 View all products
2 ProductDBContext getTotalProduct Function2 View Quantity of all products in database
3 ProductDBContext getProductById Function3 Get the product by it's id
4 ProductDBContext insertProduct Function4 insert product into the system
5 ProductDBContext deleteProduct Function5 delete product out of the system
6 ProductDBContext updateProduct Function6 Update product in the system
7 AccountDBContext insertAccount Function7 Insert account into the system
8 AccountDBContext updateAccount Function8 Update account in the system
9 AccountDBContext updatePassword Function9 Update account'password in the system
10 AccountDBContext checkAccountExist Function10 Check if the account exist
11 AccountDBContext getAccountById Function11 View account by id
12 CategoryDBContext getCategoryById Function12 Get Category By Id
UTCID01
UTCID02
UTCID03
UTCID04
Condition Precondition
product exist O
product not exist O
Confirm Return
null O
product O
Log message
"success" O
"there no product" O
Result Type(N : Normal, A : Abnormal, B : Boundary) A N N N
Passed/Failed P P P P
Executed Date 0 0 0 0
Defect ID 2 2 2 2
/ / / /
2 2 2 2
6 6 6 6
UTCID01
UTCID02
UTCID03
UTCID04
Condition Precondition
Can connect with server
Input
"1" O
"0" O
null O
"-1" O
Confirm Return
1 O
0 O
null O
Exception
Log message
"success" O
"Error" O O
"there no product in list" O
Result Type(N : Normal, A : Abnormal, B : Boundary) N N N N
Passed/Failed P P P P
Executed Date 0 0 0 0
2 2 2 2
/ / / /
2 2 2 2
6 6 7 7
UTCID01
UTCID02
UTCID03
ConditionPrecondition
id Exist O
id not Exist O O
Input1
"1" O
"100" O
"-1" O
Confirm Return
product O
null O O
Exception
Log message
"success" O
"there no product" O
junit.framework.AssertionFailedEr O
ror
Result Type(N : Normal, A : Abnormal, B : Boundary) N N N
Passed/Failed P P P
Executed Date 0 0 0
Defect ID 2 2 2
/ / /
2 2 2
6 6 6
UTCID01
UTCID02
UTCID03
UTCID04
UTCID05
UTCID06
Condition Precondition
Name
"Test Product" O O
"32894798" O O
!@##$%%^" O O
Price
1000000 O O O
-11111 O O
1 O
Title
"Iphone" O
"03129370" O O O
"%$&%^%&" O O
image
test_image_url.jpg O O
3.48957E+11 O O O
^(*&*()_(_()* O
Description
98437043 O O
*(&)&)*&)* O O
hjghjghygjhgj O O
Confirm
Return
Product O
null O O O O O
Exception
Log message
"success" O
"Error" O O O O O
Result Type(N : Normal, A : Abnormal, B : Bound N N N N N N
Passed/Failed P P P P P P
Executed Date 0 0 0 0 0 0
2 2 2 2 2 2
/ / / / / /
2 2 2 2 2 2
6 6 7 7 7 7
Defect ID
getProductById
21
UTCID08
UTCID09
O
O
O
O
O O
O
O
O
O O
O
O
O
O
O O
O
O O
N N N
P P P
0 0 0
2 2 2
/ / /
2 2 2
7 7 7
Function Code #NAME? Function Name
Created By <Developer Name> Executed By
Lines of code 300 Lack of test cases
Test requirement <Brief description about requirements which are tested in this function>
Passed Failed Untested
5 1 0
UTCID01
UTCID02
UTCID03
UTCID04
UTCID05
UTCID06
Condition Precondition
id Exist O O O
Id Not Exist O O O
Input
"1" O
"0" O
"-1" O
dsjfjhdj O
&*^&^& O
null O
Confirm
Return
1 O O O
FALSE O O O
Exception
Log message
"Delete success" O
"Error" O O O O
"there no product in list" O
Result Type(N : Normal, A : Abnormal, B : Bou N N N N N B
Passed/Failed P P P P P F
Executed Date 0 0 0 0 0 0
2 2 2 2 3 3
/ / / / / /
2 2 2 2 0 0
6 6 7 8 1 2
Defect ID D
F
I
D
0
0
2
getTotalProduct
24
UTCID01
UTCID02
UTCID03
UTCID04
UTCID05
UTCID06
Condition Precondition
id
"1" O O
"lskadj" O O
"$%^&*" O O
name
"samsun" O O O O
"" O O
price
100000 O O O
-1 O O O
title
"it good" O O O
null O O O
Description
Made in vietnam O O
6.57648E+11 O O
%&&%&*%* O O
Confirm
Return
1 O O O
FALSE O O O
Exception
Log message
" Update success" O O
"Error" O O O O
Result Type(N : Normal, A : Abnormal, B : Bound N N N N N B
Passed/Failed P P P P P F
Executed Date 0 0 0 0 0 0
2 2 2 2 3 3
/ / / / / /
2 2 2 2 0 0
6 6 7 8 1 2
Defect ID D
F
I
D
0
0
2
getTotalProduct
21
UTCID08
UTCID09
O
O
O
O
O O
O
O O
O O O
O O
O
O
O O
O O O
B B B
F F F
0 0 0
3 3 3
/ / /
0 0 0
2 2 2
D D D
F F F
I I I
D D D
0 0 0
0 0 0
2 2 2
Function Code Function6 Function Name
Created By ToanHM Executed By
Lines of code 24 Lack of test cases
Test requirement
Passed Failed Untested
8 6 0
UTCID01
UTCID02
UTCID03
UTCID04
UTCID05
UTCID06
Condition Precondition
username
"minh" O O
"@@!$@!%#%" O O
"1111111" O O
password
"123" O
"@@!$@!%#%" O O O
"ádssadadfdsf1" O O
email
minh@gmail.com O O O
sjdkahkajsd O O O
Confirm Return
1 O O O
FALSE O O O
Exception
java.lang.RuntimeException: Uncompilable
O
code - incompatible types: int cannot be
Log message
Insert account successful! O O O
Cannot insert account! O O O
Result Type(N : Normal, A : Abnormal, B : Boundar N A A A A A
Passed/Failed P F P P F P
Executed Date 0 0 0 0 0 0
2 2 2 2 2 2
/ / / / / /
2 2 2 2 2 2
6 6 6 6 6 6
Defect ID D D
F F
0 0
0 0
1 1
8 9
insertAccount
ToanHM
-1.328
UTCID08
UTCID08
O
O
O
O O O
O O
O
O O
O
O O
O
A A A
F P P
0 0 0
2 2 2
/ / /
2 2 2
6 6 6
D
F
0
0
2
0
Function Code #NAME? Function Name
Created By <Developer Name> Executed By
Lines of code 300 Lack of test cases
Test requirement <Brief description about requirements which are tested in this function>
Passed Failed Untested
7 0 0
UTCID01
UTCID02
UTCID03
UTCID03
UTCID03
UTCID03
Condition Precondition
Can connect with server
username
"minh" O
"" O
"inh" O O O O
email
min@gmail.com O O O O
aslkdjsakldjfklahf O O
Phone
985880642 O O
5463465536456 O O
gfdgsfdgfsg O
*(&(*)&)* O
Confirm
Return
1 O O
FALSE O O O O
Exception
Log message
"success" O
"Error" O O O O
"there no product in list" O
Result Type(N : Normal, A : Abnormal, B : Boundary) N N N N N N
Passed/Failed P P P P P P
Executed Date 0 0 0 0 0 0
2 2 2 2 2 2
/ / / / / /
2 2 2 2 2 2
6 6 7 7 7 7
Defect ID
getTotalProduct
23
N
P
0
2
/
2
7
Function Code #NAME? Function Name
Created By <Developer Name> Executed By
Lines of code 300 Lack of test cases
Test requirement <Brief description about requirements which are tested in this function>
Passed Failed Untested
2 0 0
UTCID01
UTCID02
Condition Precondition
Can connect with server
username
null O
"minh" O
new password
"minh123" O
null O
Confirm
Return
1 O
FALSE O
Exception
Log message
"Update success" O
"Error" O
Result Type(N : Normal, A : Abnormal, B : Bou N N
Passed/Failed P P
Executed Date 0 0
2 2
/ /
2 2
6 6
Defect ID
getTotalProduct
28
UTCID01
UTCID02
UTCID03
UTCID04
UTCID05
Condition Precondition
Can connect with server
username
"minh" O
null O
9608709 O
lfkghj O
()*&(* O
Confirm
Return
1 O
FALSE O O O O
Exception
Log message
"success" O
"Error" O O O O
Result Type(N : Normal, A : Abnormal, B : Bou N N N N N
Passed/Failed P P P P P
Executed Date 0 0 0 0 0
2 2 2 2 2
/ / / / /
2 2 2 2 2
6 6 6 6 6
Defect ID
getTotalProduct
25
UTCID01
UTCID02
Condition Precondition
id Exist O
id not Exist O
ID
"0" O
"1" O
Confirm
Return
Account O
null O
Exception
Log message
"success" O
"Error"
28
UTCID01
UTCID02
Condition Precondition
id Exist O
id not Exist O
id
"1" O
"0" O
Confirm
Return
category O
null O
Exception
Log message
"success" O
"Error"
28
UTCID01
UTCID02
UTCID02
UTCID02
UTCID02
UTCID02
UTCID07
UTCID08
UTCID09
UTCID10
UTCID11
UTCID12
UTCID13
UTCID14
UTCID15
Condition Precondition
a
-2 O
-1 O
0 O O O
1 O O
b
0 O O
-2 O O O
2 O
c
0 O
1 O O O
3 O
5 O
Confirm Return
list
null O O O
Log message
"please input a>= -1" O