8个实用的 Java 测试工具和框架

jopen 9年前

Testing tools for Java

Here are my top ‘8 tools to help you with Java testing (& Frameworks)’.

1. Arquillian

Arquillian is a highly innovative and extendible testing platform for JVM that allows developers to easily create automated integration, functional and acceptance tests for Java. Arquillian allows you to run test in the run-time so you don’t have to manage the run-time from the test (or the build). Arquillian can be used to manage the life cycle of the container (or containers),bundling test cases, dependent classes and resources. It is also capable of deploying archive into containers and execute tests in the containers and capture results and create reports.

Arquillian integrates with familiar testing frameworks such as JUnit 4, TestNG 5 and allows tests to be launched using existing IDE, and because of its modular design it is capable of running Ant and Maven test plugins. You can find out more on their website.

2. JTest

JTest also known as ‘Parasoft JTest’ is an automated Java software testing and static analysis software made by Parasoft. JTest includes functionality for Unit test-case generation and execution, static code analysis, data flow static analysis, and metrics analysis, regression testing, run-time error detection.

There are also features that allow you to peer code review process automation and run-time error detection for e.g.: Race conditions, exceptions, resource and memory leaks, security attack vulnerabilities. You can find out more on their website.

3. The Grinder

‘The Grinder’ is a Java load testing framework that was designed to make sure it was easy to run and distributed test’s using many load injector machines. The Grinder can Load test on anything that has a Java API. This includes HTTP web servers, SOAP and REST web services, and application servers and including custom protocols and the test scripts are written in the powerful Jython and Clojure languages. The GUI console for The Grinder allows you to have multiple load injectors to be monitored and controlled and Automatic management of client connections and cookies, SSL, Proxy aware and Connection throttling. You can find more in depth information on The Grinders features here.

It is freely available under a BSD-style open-source license. You can find out more on their website.

4. TestNG

TestNG is a testing framework designed for the Java programming language and inspired by JUnit and NUnit. TestNG was primarily designed to cover a wider range of test categories such as unit, functional, end-to-end, integration, etc. It also introduced some new functionality that make it more powerful and easier to use, such as: Annotations, Running tests in big thread pools with various policies available, code testing in a multi thread safe, flexible test configurations, data-driven testing support for parameters, and more.

TestNG is supported by a variety of tools and plug-ins such as Eclipse, IDEA, Maven, etc and You can find out more on their website.

5. JUnit

JUnit is a unit testing framework designed for the Java programming language. JUnit has played an important role in the development of test-driven development frameworks. It is one of a family of unit testing frameworks which is collectively known as the xUnit that originated with SUnit.

JUnit is linked as a JAR at compile-time and can be used to write repeatable tests

You can find out more about JUnit on their website.

6. JWalk

JWalk is designed as a unit testing toolkit for the Java programming language. It has been designed to support a testing paradigm called Lazy Systematic Unit Testing. The JWalkTester tool performs any tests of any compiled Java class, supplied by a programmer. It is capable of testing conformance to a lazy specification, by static and dynamic analysis, and from hints by the programmer behind the code.

You can find out more about JWalk on their website.

7. Mockito

Mockito is designed as a open source testing framework for Java which is available under a MIT License. Mockito allows programmers to create and test double objects (mock objects) in automated unit tests for the purpose of Test-driven Development (TDD) or Behavior Driven Development (BDD).

You can find out more about Mockito on their website.

8. Powermock

PowerMock is a Java Framework for unit testing of source code and It runs as an extension of other Mocking frameworks like Mockito or EasyMock but comes with more powerful capabilities. PowerMock utilizes a custom classloader and bytecode manipulator to enable mocking of static methods, removal of static initializes, constructors, final classes and methods and private methods. It as been primarily designed to extend the existing API’s with a small number of methods and annotations to enable the extra features.

It is available under an open source Apache License 2.0 and is available in Powermock Google Code site.

Hopefully you’ve found this guide on Java Testing tools and Framworks useful.