简体   繁体   中英

Unit & Integration Testing with Couchbase

I recently setup a new project that is using Spring-Data-Couchbase and I am completely stumped on how I should approach unit and integration testing here.

Typically with JPA I can mock out my Repository somehow (assuming this is similar for couchbase with Spring) and this is okay for unit testing, but normally for JPA I wire up an in memory database and have a full integration testing suite. Is there any way to do this with couchbase?

Also if you don't mind mentioning any tips here as this is my first major NoSQL project :) Thanks!

Couchbase does not run in-memory unfortunately. For unit testing you would have to mock Couchbase's API. There is a CouchbaseMock project to facilitate that: https://github.com/couchbase/CouchbaseMock

There is also the possibility to use a runner prior to launching your test. There is probably a maven plugin that would allow you to run Couchbase or a Couchbase Docker image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM