[openstack-dev] [nova] unit tests method

Ben Nemec openstack at nemebean.com
Wed Apr 16 16:05:34 UTC 2014


On 04/16/2014 08:11 AM, Jay Pipes wrote:
> On Wed, 2014-04-16 at 14:55 +0800, Chen CH Ji wrote:
>> Hi
>>                  There are 3 types of unit test existing now (stub, mox
>> and mock)
>>                  Several code reviewers suggest to use mock instead of
>> using the other 2 and I am following it, but I want to know where can
>> I find the suggestion and guide line?
>
> Hi Kevin!
>
> So, there are only two unit testing methods -- mock and mox. stubs are
> part of the mox-style way of doing things.
>
> My general rules of thumb when doing reviews in Nova are these:
>
> 1) For new unit tests, use mock
> 2) Don't mix mock and mox in a single test method
> 3) When modifying existing unit tests, unless rewriting the test method
> almost entirely, stick with whatever is used already (mock or mox)
>
> Best,
> -jay

These points are also documented here: 
https://wiki.openstack.org/wiki/ReviewChecklist (see point 4 under the 
Common Review Checklist)

-Ben




More information about the OpenStack-dev mailing list