
I was looking for transaction support to rollback the changes while doing testing my app written in Spring+RESt+Mongo 2.4. But its not possible since we cant use transaction for mongodb.
不支持事务,但是您确实有一些替代方法可以在测试时回滚更改:
>在单元测试的设置或拆除过程中根据需要创建/重置数据
>在测试期间为初始数据集设定种子并以–syncdelay = 0开始mongod,这样就不会将新数据写入磁盘(嵌入式MongoDB建议将此作为“snapshot”方法)
While searching about integration testing I found few links about embedMongo for doing integration testing. You can also do integration testing by having dedicated mongo db instance running somewhere. What special feature that embed mongo provides?
Embedded MongoDB是标准MongoDB Server二进制文件的包装,旨在帮助进行单元测试.包装器的“特殊功能”仅是通过单元测试启动/停止MongoDB实例的功能.
另请参见以下注释:Embedded MongoDB when running integration tests.
I didn’t find great documentation for it, Is it under Apache license?
GitHub上的“Embedded MongoDB”源文件建议使用Apache 2.0许可证.
MongoDB服务器二进制文件将使用standard MongoDB Server community license(AGPL v3.0).
转载注明原文:春季-EmbedMongo用于集成测试 - 乐贴网