Re:Start test names with “should” (2020)
by kkoncevicius on Sunday February 12, 2023 @07:27AM
(#34762323)
I usually do the same but arrived at this by using a mental prefix of "test that". As in:
"this test tests that" input has length 256
Since the prefix would be equal for all the tests only the last part becomes the name.
Re:Start test names with “should” (2020)
by hprotagonist on Sunday February 12, 2023 @08:37AM
(#34762706)
oh i like “test that”.
assert?
I realized that all my tests in fact “Shall test that X holds.”, tautologically.
Now I consider that style boilerplate, and just write “X shall hold.”
yes. depending on who I'm talking to about this sort of thing I refer them to https://www.ietf.org/rfc/rfc2119.txt to demonstrate the importance.
I'm doing exactly the same. Another added benefit of that is that you save some length in the test name, which can be quite helpful in certain scenarios.
Re:Start test names with “should” (2020)
by raydiatian on Sunday February 12, 2023 @08:07AM
(#34762533)
“Shall” is another term I’ve seen used in larger orgs where teams literally craft test requirements as a gigantic database. “Shall” is for things that must be satisfied, “should” is for softer requirements and is rarely used.
Re:Start test names with “should” (2020)
by wongarsu on Sunday February 12, 2023 @08:37AM
(#34762709)
Absolutely. From RFC2119:
> MUST This word, or the terms "REQUIRED" or "SHALL", mean that the definition is an absolute requirement of the specification.
>SHOULD This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
Re:Start test names with “should” (2020)
by npsomaratna on Sunday February 12, 2023 @08:50AM
(#34762803)
Thank you for posting this. At first, I thought your reply was an attempt at sarcasm—but on searching, I found the relevant RFC. Just shows that even after 30+ years of programming, there is so much that I don't know.
Re:Start test names with “should” (2020)
by karmelapple on Sunday February 12, 2023 @09:03AM
(#34762876)
This is a common standard in aerospace requirements documents.
Join the world of needing to make the FAA happy and your vocabulary will change to incorporate shall, will, must, and others in a more discerning manner.
Re:Start test names with “should” (2020)
by blowski on Sunday February 12, 2023 @08:56AM
(#34762828)
The British Highway Code uses similar terminology. Breaking a “must” rule is a punishable offence, where “should” rules are just for advice.
Re:Start test names with “should” (2020)
by silveroriole on Sunday February 12, 2023 @09:10AM
(#34762907)
Absolutely. I tell people this constantly. If you write a test that says “it should have length 256”, that’s an assertion on the design intention, not on the actual functioning of the code. “It should have length 256” == true as soon as the product guy says it should. “It has length 256” == true when I’ve written the code to make it have length 256.
“Should” to me is too weak.
No, it’s not just “should”. It does. And if it doesn’t then either the implementation is broken, or the test is bad.
“Should” has connotations for me of something that we want but which we don’t require.
Therefore, I don’t use the word “should” in my test names.
Instead of “should have length 256”, I say “has length 256”.