← Back to team overview

openstack team mailing list archive

Re: which is the level of unit test cases should be covered

 

On 22 January 2013 16:37, Xiazhihui (Hashui, IT) <xiazhihui09@xxxxxxxxxx> wrote:
> Hi friends,
>
>
>
>          I want to upload a volume driver, right now I’m writing unit test
> case code ( it’s also need to be uploaded).
>
>
>
>          And I do not know the requirements of the unit test code. Which is
> the level of unit test cases in my unit test code should be covered:
> Function Coverage, Condition coverage, Decision Coverage, Statement Coverage
> or others? Or should I write what I think needs?

Pragmatically speaking, code should be tested such that if either:
 - some precondition it has is changed (either elsewhere in the same
code base or in the behaviour of some other code base) that we find
out
 - if someone changes the code itself and breaks an existing use case,
we find out.

Exactly what that means may be different for different routines :).

My general rule is to start with testing each entry and exit path and
any domain or range corner cases.

-Rob
-- 
Robert Collins <rbtcollins@xxxxxx>
Distinguished Technologist
HP Cloud Services


Follow ups

References