Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 728
Matthew Fontana Avatar asked Jul 11 '16 12:07

Matthew Fontana


People also ask

What do we mean by unit?

Definition of unit (Entry 1 of 2) 1a : the first and least natural number : one. b : a single quantity regarded as a whole in calculation. 2 : a determinate quantity (as of length, time, heat, or value) adopted as a standard of measurement: such as. a : an amount of work used in education in calculating student credits.

What is an example of a unit?

The definition of a unit is a fixed standard amount or a single person, group, thing or number. An example of a unit is a single apartment in an apartment building.

What is called unit in physics?

In Physics, the term unit refers to the quantity of a constant magnitude, used to measure the magnitudes of other quantities of an identical type. The magnitude of a physical quantity is given by the formulae: P h y s i c a l q u a n t i t y = ( n u m e r i c a l v a l u e ) × ( u n i t ) .

What is a unit number?

Unit number means the number, letter, or combination of numbers and letters designating the unit in the declaration and in the record of survey map.


1 Answers

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.

like image 61
Laurent Doguin Avatar answered Sep 25 '22 14:09

Laurent Doguin