最好的Java单元测试框架和工具集合

摘要:最好的Java单元测试框架和工具集合

1. JUnit – Java unit testing framework

最好的Java单元测试框架和工具集合

JUnit is a one of the famous Java testing framework written by Erich Gamma and Kent Beck. It is a regression testing framework. Junit helps developer to write test cases so-called white box testing, because the programmer knows the code they can easily write test cases using jUnit. Using class inheritance developer can easily automate the testing.

2. Cactus

最好的Java单元测试框架和工具集合

Cactus is a simple test framework based on JUnit framework for unit testing with server-side Java code.The Cactus framework’s main goal is to use unit testing server-side Java Servlet objects such as HttpServletRequest, HttpServletResponse, HttpSession.

3. StrutsTestCase

StrutsTestCase is the extension of the Junit TestCase class provides code based on the Struts framework tests. StrutsTestCase provides both Mock objects and Cactus methods used to actually run the Struts ActionServlet, you can run the servlet engine to test. StrutsTestCase uses the ActionServlet controller to test your code You can test the Action object’s implementation, test mappings and forwards declarations. StrutsTestCase does not start the servlet container to test your Struts application but it mock the object, different from the EasyMock. EasyMock provides the API for creating Mock objects, while StrutsTest is dedicated to testing the Mock Object.

4. JFCUnit

最好的Java单元测试框架和工具集合
JFCUnit enables you to write test cases for the offset Java applications. It is obtained from the code used to open the window and work at component level. It provide unit test for thread programming.

5. TestNG

最好的Java单元测试框架和工具集合

TestNG is based on building a testing framework JUnit and NUnit, TestNG adds many new features that make it more powerful and easier to use, such as:

  • Support for JSR 175 annotations (JDK 1.4 JavaDoc comments are also supported)
  • Flexible Test configuration
  • Support for runtime and logging by default JDK functions
  • Powerful execution model (no more TestSuite)
  • Support for an independent test method.

6. jMock

最好的Java单元测试框架和工具集合
JMock is a framework based on TDD, test Java code using mock objects. JMock has the following features: easy to expand, lets you quickly and easily define mock objects, allows you precisely specify the interactions between your objects.

7. Grinder

最好的Java单元测试框架和工具集合

Grinder is an open source Java load-testing framework. it distributed through many load injector.

  • Support for performing test scripts Jython scripting engine
  • HTTP tests can be managed through the HTTP proxy.

8. Jetif

最好的Java单元测试框架和工具集合

Jetif is a regression testing framework with a pure Java implementation. It’s unit tests and functional tests for Java programs provides a simple and scalable code, you can test for personal development or enterprise-level development. It is easy to use, powerful, and has a number of important features for enterprise-level test. Jetif from JUnit, inspired by JTestCase and TestNG, there are a few basic concepts taken directly from the JUnit, assertion mechanism Test Listener concept, therefore transferring from JUnit to Jetif is very easy.

9. Unitils

最好的Java单元测试框架和工具集合
Unitils is Java open source class Pack designed to make unit test easier and maintainable. Unitils builds on DBUnit and EasyMock project and integrated with JUnit and TestNG. Support for database testing, using mock objects and offers integration with Spring and Hibernate. Unitils is designed with a highly configurable and loosely-coupled way to add these services to the unit test.

10. p-unit

最好的Java单元测试框架和工具集合
P-unit is an open source performance testing framework different from JUnit, JUnit is test the correctness of the code while p-unit not only test code but also check the performance of the test. p-unit records the memory consumption by test case and can generate PDF or image format report of the test. In addition, p-unit also support parameterized tests, multi-threaded testing, and performance comparisons between different Java virtual machine.

11. XMLUnit

最好的Java单元测试框架和工具集合

XMLUnit provide two JUnit extension classes XMLAssert and XMLTestCase, and set of classes that support jUnit. These classes can be used to compare the differences between two XML, display XML using XSLT, and validate XML. You can evaluated XPath expression value in the XML, traverse a node in XML Lee DOM etc.

12. Ejb3Unit

最好的Java单元测试框架和工具集合

Ejb3Unit is used outside the container for EJB3 entity (Entity) and session (Session). Ejb3Unit is a JUnit extension for all JEE or EJB3 projects and create automated standalone JUnit tests. EJb3Unit use a built-in database of memory by default, but you can also specify your own database.

13. FEST-Swing

最好的Java单元测试框架和工具集合

FEST-Swing is a Java Swing GUI application functionality tests, it is an open source class library with user interaction (mouse and keyboard input). Supports most of the Swing components in the JDK. Provides simple, powerful API for creating and maintaining GUI functional tests. Supports HTML embed screenshots of failed GUI tests in the test report. It can be used with JUnit or TestNG.

14. Ripplet

最好的Java单元测试框架和工具集合

Ripplet is a powerful, highly reliable, flexible load/stress testing tool. its features include: support for graphic design and can have a clear summary of the load test description. Can effectively control the practical performance load including logic and data flow. Peak makes it easy to diagnose performance bottlenecks. Quickly and accurately assess the actual system under pressure. Allows developers to develop implementation in a live production environment for testing product and produces test reports.

15. Feed4JUnit

最好的Java单元测试框架和工具集合

Feed4JUnit can write JUnit parameterized test and provides predefined or random dummy data for these tests. It can create nice CSV or excel file for report. Use Feed4JUnit to easily perform a smoke test with random checksum data to improve code coverage. In addition, Feed4JUnit can be used to easily define the equivalence class testing.

16. Jubula functional testing tools

最好的Java单元测试框架和工具集合

Jubula provides a testing framework for Swing, SWT/RCP/GEF and HTML application for automated functional testing of graphical tools. It is suitable for those who want automate the test. It does not require any coding. support based on Client – Server architecture for distributed test. Items stored in a multi-user database.

17. JsTestDriver

最好的Java单元测试框架和工具集合

JsTestDriver is a JavaScript unit testing tool for easy integration with continuous build systems and be able to run the test on multiple browsers to easily implement test driven development style development.

18. Citrus Testframework

最好的Java单元测试框架和工具集合

Citrus is a testing framework for Java development, Enterprise SOA applications based on messages for automated integration testing. Use case testing for Terminal to Terminal, this tool can mimic peripheral systems and agreements various conveyor (for example, JMS, SOAP WebServices, http, TCP/IP, etc.). Citrus provides strong verification mechanisms for XML message content and allows you to build complex testing logic such as: send and receive messages, data validation, automatic retries, variable definitions, dynamic news content, error simulations.

19.JBehave

最好的Java单元测试框架和工具集合

JBehave is a behavior-driven development (BDD:Behaviour-Driven Development) framework. Behavior driven development (BDD) is a test-driven development (TDD) and the evolution of the acceptance of test-driven design is to make these practices more accessible and intuitive.

Some property description of this framework:

  • Support for Maven and Ant integration
  • Support IDE integration, support in order to run Junit tests
  • Support internationalization, can be written in a different language system
  • Supports a variety of configurations, Spring configuration, Java Annotation-based configuration, code embedded configuration

20. JCrawler – load testing framework

最好的Java单元测试框架和工具集合

JCrawler is an open source Web application stress test tool. By its name, you can tell this is a tool like a Web crawler written in Java. As long as you give several of its URL, it can start to climb over, it in a special way to create your Web application load. This tool can be used to test your site search engine-load.

扩展阅读

开发者眼中最好的 22 款 GUI 测试工具
最好的 Java 单元测试框架和工具
通过使用Byte Buddy,便捷地创建Java Agent
真实世界的 JavaScript MVC 框架
分享海量 iOS 及 Mac 开源项目和学习资料

为您推荐

前端篇: 前端演进史
8个对程序员来说有用的jQuery小贴士和技巧
每个程序员都会的 35 个 jQuery 小技巧
10个最佳的HTML5代码段,以简化您的开发任务
Web移动开发框架 jQuery Mobile 1.0 RC2 发布

更多

单元测试
软件编程