[英]Testing spring boot application with embedded mongo
My application has Spring boot Spring data Mongo db. 我的应用程序具有Spring boot Spring数据Mongo db。
I am trying to do unit test case for dao layer using embedded mongo.while searching in internet, I came across two annotations *@springboottest *@testsbmongo.. 我正在尝试使用嵌入式mongo为dao层做单元测试用例。在互联网上搜索时,我遇到了两个注释* @ springboottest * @ testsbmongo ..
I am confused with this annotations usage.my question is 1.what is the difference between these annotations 2. i am getting connection refused error when I am using @testdbmongo 3.how to use this embedded mongo for test when my original mongo server is running 我对此注释的用法感到困惑。我的问题是1.这些注释之间的区别是什么2.我在使用@testdbmongo时遇到连接被拒绝的错误3.如何在我的原始mongo服务器被使用时使用此嵌入式mongo进行测试赛跑
You can also use Fongo . 您也可以使用Fongo 。 Its an in-memory mongoDB similar to h2 database , which we use for RDBMS dao layer test. 它是类似于h2数据库的内存mongoDB,我们将其用于RDBMS dao层测试。
<dependency>
<groupId>com.github.fakemongo</groupId>
<artifactId>fongo</artifactId>
<scope>test</scope>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.