[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [jgit-dev] JGit unit tests could be more readable.
- From: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
- Date: Sat, 21 May 2011 11:59:08 +0200
- Delivered-to: email@example.com
- User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:22.214.171.124) Gecko/20110414 Thunderbird/3.1.10
On 2011-05-20 02.53, Ketan Padegaonkar wrote:
> As a recent contributor, I've found the JGit unit tests highly useful
> as a safety-net when making changes. Thanks for the great work!
> However I've found that a lot of the tests don't talk to me. Most of
> the test names I've come across are of the form "testDoSomething".
> They don't tell me what is expected when doSomething happens. Surely
> there are assertions, but that raises another question that I then
> need to understand what every assertion means, which sucks away my
> time to have to understand the entire test which may not necessarily
> interest me, and have to do the same with some other test.
> May I suggest that going ahead the tests be written in the form
> "testDoingSomethingShouldHaveThisSideEffect" or
> "testDoingSomethingShouldRaiseError". This ensures that reading the
> testname clearly conveys what is expected of the test.
As one of the sinners, I agree. Finding good names can be tricky,
so good ol' javadocs is also useful to try to explain the basic strategy
behind a test. Besides the javadoc index looks good if you want to
present an overview of what tests you have.