[Openstack] which is the level of unit test cases should be covered
Robert Collins
robertc at robertcollins.net
Tue Jan 22 03:58:13 UTC 2013
On 22 January 2013 16:37, Xiazhihui (Hashui, IT) <xiazhihui09 at huawei.com> 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 at hp.com>
Distinguished Technologist
HP Cloud Services
More information about the Openstack
mailing list