We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionWhat is a good open source project which uses jun开发者_如何学JAVAit tests in its source code? I want to see how its done and learn about it.
Any serious project (including open source) has unit tests. For what I've seen spring and hibernate have a lot of them.
This is a very good lecture about Object-oriented design for testability. It is not for complete beginners, but it gives very good insights.
The most widely used Test coverage tool is: eclemma
Update
Regarding "real world" understanding of jUnit. I would recommend use TDD and implement something very simple.
For example: Set (Java collections)
and implement the test for the methods like: equals(), contains(), empty() etc
.
The best way to learn something is by doing. Read this article, they have taken an example of Xerces XML parser
I wrote sections for Geoserver which only got accepted into the open-source tree once the additions were covered by tests. While testing my framework I came across some of the shortcomings in the Testing itself and extended it to allow for more abstract testing. The source for Geoserver can be accessed via SVN and the Eclipse Run-As Junit Test profile gives nice pass/fail stats.
You could also try and participate TopCoder developer competitions (this is not an ad). Every project there is required to have number of tests. And the volume of code covered by tests should not be below 85%.
I can recommend you to look at Hibernate project source code. Unit tests are very good there. Good example to follow.
精彩评论