[openstack-dev] [nova] unit tests method

Jay Pipes jaypipes at gmail.com
Wed Apr 16 13:11:33 UTC 2014


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




More information about the OpenStack-dev mailing list