Template UnitTest Case

download Template UnitTest Case

of 20

Transcript of Template UnitTest Case

  • 8/12/2019 Template UnitTest Case

    1/20

    Guideline to make and understand Unit T

    1. Overview- In the template, Unit test cases are based on functions. Each sheet presents test cases for one function.

    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.

    - If the number of Unit TC does not meet the requirement, creator should explain the reasons.

    - If the number of 'Normal number test cases/!"C' item in #unction!ist sheet is not recorded, the number in '!ac$ of test c

    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 %alues of inputs.

    - &alues of inputs it includes ( t)pes of %alues normal, boundar) and abnormal.

    . Normal %alues are %alues of inputs used mainl) and usuall) to ensure the function *or$s.

    . +oundar) %alues are limit %alues that contain upper and lo*er %alues.

    . bnormal %alues are non-expected %alues. nd normall) it processes exception cases.

    - #or examples

    Input %alue belons to 0 input 012. . 3,4,5,6 are normal %alues.

    . , 12 are boundar) %alues.

    . -1, 11,... are abnormal %alues.

    b. Confirmation:

    - Cover 8eneral information of the pro9ect and Unit Test cases

    - unction!ist The list of Classes and #unctions in the document.7 To control that the number of Unit TC meets customer's requirement or the norm, user should fill %alue for'Normal number of Test cases/!"C'.

    7 Clic$ on #unction lin$ to open the related Test cases of the function.Note::ou should create ne* #unction sheet before cretin the lin$

    - Test "eport pro%i%e the o%er%ie* results of #unctions Unit test Test co%erae, Test successful co%erae;

  • 8/12/2019 Template UnitTest Case

    2/20

    b. Confirmation:

    2.#. Other items:

    - #unction Code it is I? of the function and updated automaticall) accordin to #unction!ist sheet.

    - #unction Name it is name of the function and updated automaticall) accordin to #unction!ist sheet.

    - Created +) Name of creator.

    - Executed +) Name of person *ho executes the unit test

    - !ines of code Number of Code line of the function.

    - Test requirement +rief description about requirements *hich are tested in this function, it is not mandator).

    - Test case result the actual output results comparin *ith the Confirmation. $for >assed and for #ailed cases. It can '"' or 'N8' ;it depends on habit of the teams or customers=

  • 8/12/2019 Template UnitTest Case

    3/20

  • 8/12/2019 Template UnitTest Case

    4/20

  • 8/12/2019 Template UnitTest Case

    5/20

    2@ae-+A/>A/B?C&/#

  • 8/12/2019 Template UnitTest Case

    6/20

    2@ae-+A/>A/B?C&/#

  • 8/12/2019 Template UnitTest Case

    7/20

    Internal use 4/@2

    U%&T T'(T C)(' !&(T

    $ro*ect %ame

    $ro*ect Code

    %ormal number of Test cases+!OC ())

    Test 'nvironment (etup ,escription

    %o Class %ame unction %ame unction Code3Optional4 (heet %ame ,escription

    1 Class1 #unction #unction1

    @ Class@ #unction + #unction@

    ( Class( #unction C #unction(

  • 8/12/2019 Template UnitTest Case

    8/20

    Internal use 5/@2

    $re6Condition

  • 8/12/2019 Template UnitTest Case

    9/20

    Internal use 6/@2

    U%&T T'(T "'$O"T

    $ro*ect %ame Creator

    $ro*ect Code "eviewer+)pprover

    ,ocument Code _Test /e&ort_!! &ssue ,ate

  • 8/12/2019 Template UnitTest Case

    10/20

    Internal use 12/@2

    Passed

    80%

  • 8/12/2019 Template UnitTest Case

    11/20

    Internal use 11/@2

    t re&ort is created>

    Total Test Cases

    1

    1

    1

    D

    A

    13%

    B

    7%

    est ype

    N

    A

    B

  • 8/12/2019 Template UnitTest Case

    12/20

    Internal use 1@/@2

    N

    80%

  • 8/12/2019 Template UnitTest Case

    13/20

    Internal use 1(/@2

    unction Code 1unction( unction %ame #unction

    Created 7y '=ecuted 7y!ines of code ()) !ack of test cases -

    Test re5uirement

    $assed ailed Untested %+)+7 Total Test Cases

    1@ @ 1 1@ @ 1 1

    UTC&,:1

    UTC&,:2

    UTC&,:#

    UTC&,:>

    UTC&,:?

    UTC&,:;

    UTC&,:

    UTC&,1?

    Condition

    $recondition

    Can connect *ith ser%er

    &nput1

    1

    null

    &nput2

    F0 G 0 12

    12

    Confirm "eturn

    1

  • 8/12/2019 Template UnitTest Case

    14/20

    Internal use 1D/@2

    @

    '=ception

    !o messae

    success

    input1 is null

    "esult

    T)pe;N Normal, bnormal, + +oundar)= N N N N N + N N N N N N N

    >assed/#ailed > > > > > # # > > > > > > >

    Executed ?ate

    ?efect I?

    2@/@3

    2@/@3

    2@/@4

    2@/@5

    2(/21

    2(/2@

    2(/2(

    2(/2D

    2(/2

    2(/23

    2(/24

    2(/25

    2(/26

    2(/12

    2(/11

    ?#I?22

    @

    ?#I?22

    D

    ?#I?22

    ?#I?22

    3

    ?#I?22

    4

    ?#I?22

    5

    ?#I?22

    6

    ?#I?21

    2

    ?#I?21

    1

    ?#I?21

    @

  • 8/12/2019 Template UnitTest Case

    15/20

    Internal use 1/@2

    unction Code 1unction+ unction %ame 1unction .

    Created 7y '=ecuted 7y

    !ines of code ,)) !ack of test cases 1

    Test re5uirement

    $assed ailed Untested %+)+7 Total Test Cases

    1@ @ 1 1@ @ 1 1

    UTC&,:1

    UTC&,:2

    UTC&,:#

    UTC&,:>

    UTC&,:?

    UTC&,:;

    UTC&,:

    UTC&,1?

    Condition

    $recondition

    Can connect *ith ser%er

    &nput1

    1

    null

    &nput2

    F0 G 0 12

    12

    Confirm "eturn

  • 8/12/2019 Template UnitTest Case

    16/20

    Internal use 13/@2

    1

    @

    '=ception

    !o messae

    success

    input1 is null

    "esult

    T)pe;N Normal, bnormal, + +oundar)= N N N N N B A N N N N N A N N

    >assed/#ailed P P P P P F F P P P P P P P

    Executed ?ate

    ?efect I?

    2@/@3

    2@/@3

    2@/@4

    2@/@5

    2(/21

    2(/2@

    2(/2(

    2(/2D

    2(/2

    2(/23

    2(/24

    2(/25

    2(/26

    2(/12

    2(/11

    ?#I?2

    2@

    ?#I?2

    2D

    ?#I?2

    2

    ?#I?2

    23

    ?#I?2

    24

    ?#I?2

    25

    ?#I?2

    26

    ?#I?2

    12

    ?#I?2

    11

    ?#I?2

    1@

  • 8/12/2019 Template UnitTest Case

    17/20

    Internal use 14/@2

    unction Code 1unction, unction %ame 1unction C

    Created 7y '=ecuted 7y!ines of code ,)) !ack of test cases 1

    Test re5uirement

    $assed ailed Untested %+)+7 Total Test Cases

    1@ @ 1 1@ @ 1 1

    UTC&,:1

    UTC&,:2

    UTC&,:#

    UTC&,:>

    UTC&,:?

    UTC&,:;

    UTC&,:

    UTC&,1?

    Condition

    $recondition

    Can connect *ith ser%er

    &nput1

    1

    null

    &nput2

    F0 G 0 12

    12

    Confirm "eturn

    1

  • 8/12/2019 Template UnitTest Case

    18/20

    Internal use 15/@2

    @

    '=ception

    !o messae

    success

    input1 is null

    "esult

    T)pe;N Normal, bnormal, + +oundar)= N N N N N B A N N N N N A N N

    >assed/#ailed P P P P P F F P P P P P P P

    Executed ?ate

    ?efect I?

    2@/@3

    2@/@3

    2@/@4

    2@/@5

    2(/21

    2(/2@

    2(/2(

    2(/2D

    2(/2

    2(/23

    2(/24

    2(/25

    2(/26

    2(/12

    2(/11

    ?#I?22

    @

    ?#I?22

    D

    ?#I?22

    ?#I?22

    3

    ?#I?22

    4

    ?#I?22

    5

    ?#I?22

    6

    ?#I?21

    2

    ?#I?21

    1

    ?#I?21

    @

  • 8/12/2019 Template UnitTest Case

    19/20

    Internal use 16/@2

    unction Code 1unction( unction %ame #unction

    Created 7y '=ecuted 7y

    !ines of code ()) !ack of test cases -

    Test re5uirement

    $assed ailed Untested %+)+7 Total Test Cases

    2 2 1 1 1 1

    UTC&,:1

    UTC&,:2

    UTC&,:2

    UTC&,:2

    UTC&,:2

    UTC&,:2

    UTC&,:

    UTC&,1?

    Condition

    $recondition

    a

    -@ O

    -1 O

    2 O O O

    1 O O

    b

    2 O O

    -@ O O O

    @ O

    c

    2 O

    1 O O O

    ( O

    O

  • 8/12/2019 Template UnitTest Case

    20/20

    Internal use @2/@2

    Confirm "eturn

    list

    null O O O

    siHe 0 2 O

    -1/@J O

    1,1J O

    1,-(J O

    '=ception

    !o messae

    please input aF0 -1 O

    "esult

    T)pe;N Normal, bnormal, + +oundar)= A N N N N N B

    >assed/#ailed

    Executed ?ate

    ?efect I?

    2@/@3

    2@/@3

    2@/@3

    2@/@3

    2@/@3

    2@/@3

    2(/2(