Data-driven tests with jUnit

后端 未结 10 618
囚心锁ツ
囚心锁ツ 2020-12-05 00:33

What do you use for writing data-driven tests in jUnit?

(My definition of) a data-driven test is a test that reads data from some external source (file, database, ..

10条回答
  •  醉酒成梦
    2020-12-05 01:08

    Some tests will lend themselves to being interface driven.

    If the database/file reads are retrieved by an interface call then simply get your unit test to implement the interface and the unit test class can return whatever data you want.

提交回复
热议问题