[kforge-dev] test case naming
rufus.pollock at okfn.org
Wed Oct 17 18:23:50 UTC 2007
John Bywater wrote:
> This is an issue I have raised in face to face meetings a number of
> times. I can't remember raising this in public before, so I will
John: I am quite happy for the tests to be converged to a standard
naming convention though I have to say I don't think it is a very major
issue! (More of a painting the bikeshed type issue even taking account
of the consistency principle).
I hope you noticed this was demonstrated yesterday in that I followed
the (uncommented) todo comment and changed the names in that file to
have the Test prefix:
I think you may not have noticed this since today you added the comment
back in (it is now redundant):
Anyway the main point is:
a) I've always agreed that it was fine to go for the prefixing. So we
both agree hurrah!
b) I think we've also both agreed when it came up before that it was a
very secondary matter compared to other things we needed to do
(particularly given that having Test postfixes didn't break anything)
c) I am very happy to name all new tests in accordance with this
convention and for you to rename as you see fit. (In fact on all my
recent work on other projects I have used the Test prefix convention
because this is required by py.test!)
d) Where the Test postfix was left in it was either because it was
already there or it was being copied from somewhere else that had
already (and I/you didn't notice).
> There are (approximately) three times more test cases named "Test +
> TestedClassName" than there are "TestedClassName + Test".
> In the KForge source, I count 147 classes with the name 'Test'. Of
> these, only 34 are postfixed 'Test'. So that's 34 test cases that need
> to be changed to be conformal with the 113 test cases that are named
> with Test as a prefix.
> Having called several times for convergence in this regard, I'm
> irritated that this divergence has continued, and astonished that it
> has continued to this extent.
I'm sorry this has irritated you to such an extent!
> My arguments for the change are:
> 1. The consistency of the code is its most important aspect. I started
> writing the KForge Python unit tests, and as I started writing these
> unit tests with Test as a postfix. I certainly expected and have since
> requested this convention to continue as the norm.
And I'd been writing tests already with the 'Test' postfix already and
probably continued to write some for quite some time. Some of this
difference has continued. It can easily be corrected ...
> 2. The reason for prefixing rather than postfixing is simple emphasis:
> the most important thing about a test case class -- what requires more
> emphasis than anything else -- is that the class is a test case, and
> not a class-under-test. This emphasis needs reflecting in the class
> name. In the English language, words earlier in a sentence receive
> more emphasis. Therefore the best place for the word 'Test' is at the
> start name, and certainly before the name of the class-under-test.
> Considering whether the name is a verb or a noun is entirely spurious
> to this consideration.
> Therefore, and as a matter of priority, I kindly request KForge
> developers who have so far overlooked this /de facto/ KForge style
> convention to review their KForge test case naming practice, to adjust
> it in conformance with the majority prefixing style, and to remedy the
> divergence to the coding style norms that have been introduced by
> editing any test cases they may have written with postfixes to be
> conformal with the majority usage.
I'm very happy for you to rename wherever you wish to and any new test
cases I write will have a Test prefix.
More information about the kforge-dev