[英]Embedded Database for Junit Tests for non-spring application
I am looking for a embedded database which I can use in JUnit 4.12
tests. 我正在寻找可以在JUnit 4.12
测试中使用的嵌入式数据库。 Because of the current nature of our code base & time-lines it is not possible for us to mock the database calls. 由于我们的代码库和时间表的当前性质,因此我们无法模拟数据库调用。 We are concerned only about Mysql database. 我们只关心Mysql数据库。 So I am looking for some kind of Embedded database which I can initialize before our each test run & then clear it after the tests. 因此,我正在寻找某种嵌入式数据库,可以在每次测试运行之前对其进行初始化,然后在测试之后将其清除。 Some what similar to what wiremock does for http server. 一些类似于Wiremock对http服务器所做的事情 。
I have gone through this & it seems it is possible to achieve it via H2 embedded database. 我已经经历了这个 &似乎有可能通过H2嵌入式数据库来实现它。 Most of the links I have found in the web talks about using it with Spring. 我在网络上找到的大多数链接都谈到将其与Spring结合使用。
Can some one let me know 可以让我知道吗
I think you can use H2, but I prefer to use hsqldb for this purpose. 我认为您可以使用H2,但是我更愿意使用hsqldb来实现此目的。 I need some embedded db which can imitate some oracle-specific features in sql. 我需要一些嵌入式db,它可以模仿sql中某些oracle特定的功能。 From my best knowledge you can use any embedded java database for unit testing. 据我所知,您可以使用任何嵌入式Java数据库进行单元测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.