Feed4Junit官方地址:
http://databene.org/feed4junit.html
?
Feed4Junit测试数据来自数据库:
Feed4JUnit 1.1.2 发布了,该版本支持数据来自数据库
???????????? 利用Feed4JUnit能够很方便用随机但校验过的数据执行冒烟测试来提高代码 代码覆盖率和发现由非常特殊的数据结构产生的Bug。此外还可以利用Feed4JUnit轻松定义等价类测试。
官方文档:
Retrieving test data from a database
Databases can be declared and configured with a?@Database?annotation. When applying the annotation to a class, the defined database is available to all test methods. When annotating a method, the database is available only in this method. A basic configuration can be performed by specifying the typical JDBC connection settings:?url,?driver,?user,password. The database declaration must specify an?id, by which the database can be referred to as @Source of a method. The?@Source?annotation must refer to the database?idand define a SQL query as?selector. The number of query result columns must match the number of method parameters:
@RunWith(Feeder.class) |
Alternatively to the explicit database connection configuration, you can place database environment configurations in your user directory and refer to them in the test:
@Database(id?= "db",?environment?= "f4jdb")? |
Read more about environment files in the?DB Sanity environment files?document