EasyTest - 一个Java数据驱动测试框架
jopen
12年前
EasyTest 是一个JUnit扩展,它能够采用注释执行数据驱动测试。提供了许多JUnit做不到的功能。
以下EasyTest的一些亮点:
- EasyTest supports passing method parameters to the methods annotated with JUnit's @Test annotation. (Isn't that what we always wanted in the first place.)
- EasyTest supports passing input test data(in different formats like CSV, Excel, XML or Custom Loaders) to the Test class using annotations (for eg. @DataLoader)
- EasyTest supports passing input test data(in different formats like CSV, Excel, XML or Custom Loaders) to the Test method as well using annotations (@DataLoader).
- EasyTest has inbuilt support for Java PropertyEditors. This means that a user can reuse the classes to get concrete user defined objects as part of the test parameters. In case of standard primitive types(like int , long, String etc) you don't even have to register any property editors as they are supported by default.
- EasyTest also supports custom converters, in cases where PropertyEditor support is not enough.
- EasyTest supports custom loaders for parsing user defined input test data file in case our existing data loader support is not enough. So a user can provide its input test data in, lets say JSON format and then write its own loader to load the test data. This gives a lot of flexibility to the end users.
- EasyTest also supports returning output data from the test method and capturing it in the same file from which the input was provided.
- EasyTest supports a mechanism where you can intercept calls to your class under test and do things before or after the method has been tested. This is extremely useful in cases where for example you want to measure the time taken by your test method. EasyTest supports it by default and if you enable @Intercept annotation then it will write the performance measurements in a log file. Obviously, you can provide your own custom implementation of the interceptor and use that instead of the one provided by EasyTest.
- EasyTest supports generating test reports (using Jasper behind the scenes) for your test classes. Reports can be generated in PDF or other formats and can be put at any place in your file system.
- EasyTest supports Spring Integration Testing. Now you can write Data Driven Integration tests using EasyTest's support classes for Spring.