开发者

What is the standard for testing in Java?

What apps would you use? Are there auto testing suites like autotest for ruby? What do you use and why? To be honest, I don't even know how to write tests, when, or why. I'd like to learn though, I know that it will make me a better developer.

Our team uses Netbeans, not eclipse, although I'm goin开发者_如何学Pythong to still google eclipse responses to see if they are implemented as a Netbeans solution as well.


There are 2 most popular frameworks for unit tests: JUnit and TestNG. Both are annotation based. To create test you have to create class and mark each method that performs test using annotation @Test.

JUnit is older and have more extensions (DBUnit, Cactus etc). TestNG has much more annotations. Very important feature of TestNG is ability to create test groups using annotations.

Yet another group of tools you will probably need is mocking tools (EasyMock, EasyMock etc.)


There are a bunch of testing frameworks that are popular. JUnit is pretty good and comes by default with Eclipse. It provides an API for defining tests and doing assertions, as well as a Testrunner to execute the tests. EasyMock and Mockito work well with JUnit to provide mocking functionality so you can test components in isolation.

For continuous integration, there is Jenkins, which is free.

There are others as well.


I would use junit and possibly a mocking library like jmock.

Most of the automatic "tests" which can be done use the compiler or a code analysis tool like FindBugs.


In addition to what has already been said (JUnit, EasyMock, ...) you may also have a look at Fitnesse: it may be a good tool for full integration and acceptance tests!


Don't forget TestNG. It's the "next generation" beyond JUnit. It handles threaded tests better.

SOAP UI is the right tool for testing SOAP web services.

JMeter or Grinder for load testing.


As JUnit and Mockito was already mentioned, You can look into Infinitest or JUnit Max for autotesting.

http://infinitest.github.com/

http://junitmax.com/


If you are looking for something that implements continuous testing I can recommend two free products:

For a developer during work in Eclipse/IntelliJ IDE:

http://infinitest.github.com/

Infinitest is an Eclipse/IntelliJ plugin that runs your test continuously in the background while you are developing your code.

For a team:

http://hudson-ci.org/ or http://jenkins-ci.org/

are great continuous integration servers that can do builds and run tests continuously.


Been writing junits for over 7 years now and I highly recommend spock for all your testing needs: unit and integration testing, mocking, end-to-end testing, data driven testing etc

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜