[kforge-dev] test case naming
john.bywater at appropriatesoftware.net
Wed Oct 17 13:23:12 UTC 2007
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
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.
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.
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.
More information about the kforge-dev