<br><br><div class="gmail_quote">On Mon, Jan 21, 2013 at 8:58 PM, Robert Collins <span dir="ltr"><<a href="mailto:robertc@robertcollins.net" target="_blank">robertc@robertcollins.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On 22 January 2013 16:37, Xiazhihui (Hashui, IT) <<a href="mailto:xiazhihui09@huawei.com">xiazhihui09@huawei.com</a>> wrote:<br>
> Hi friends,<br>
><br>
><br>
><br>
>          I want to upload a volume driver, right now I’m writing unit test<br>
> case code ( it’s also need to be uploaded).<br>
><br>
><br>
><br>
>          And I do not know the requirements of the unit test code. Which is<br>
> the level of unit test cases in my unit test code should be covered:<br>
> Function Coverage, Condition coverage, Decision Coverage, Statement Coverage<br>
> or others? Or should I write what I think needs?<br>
<br>
</div></div>Pragmatically speaking, code should be tested such that if either:<br>
 - some precondition it has is changed (either elsewhere in the same<br>
code base or in the behaviour of some other code base) that we find<br>
out<br>
 - if someone changes the code itself and breaks an existing use case,<br>
we find out.<br>
<br>
Exactly what that means may be different for different routines :).<br>
<br>
My general rule is to start with testing each entry and exit path and<br>
any domain or range corner cases.<br>
<br>
-Rob<br>
<span class="HOEnZb"><font color="#888888">--<br>
Robert Collins <<a href="mailto:rbtcollins@hp.com">rbtcollins@hp.com</a>><br>
Distinguished Technologist<br>
HP Cloud Services<br>
<br>
_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
</font></span></blockquote></div>You can use some of the other back-end driver tests as a starting point or reference, and submit a review and go from there.  Also feel free to grab somebody on IRC in #openstack-cinder and maybe we can help answer more detailed questions you have there.<div>

<br></div><div>Thanks,</div><div>John</div>