[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] JGit unit tests could be more readable.

On 2011-05-20 02.53, Ketan Padegaonkar wrote:
> Hi,
>
> 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.
>
> Thoughts?

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.

-- robin