dejavu
dejavu

Reputation: 3254

Unit testing activejdbc code without live database

Any suggestion on how to test activejdbc code without live database? I am unable to follow TDD because at every place it needs a live sql database and I can't mock it. Is having a live sql database for unit testing correct?

Upvotes: 0

Views: 290

Answers (1)

ipolevoy
ipolevoy

Reputation: 5518

ActiveJDBC reads its metadata from the database on the first access. This means that it requires a database. Typically, you would use a different database for testing than the one you use to run the app. Since ActiveJDBC supports multiple databases you can use H2 In-memory database for your tests.

In any case, what is the purpose of testing ORM classes without a database?

Upvotes: 1

Related Questions