Testing Couchbase

There is a scenario which i am trying to do using couchbase. I have been using couchbase 1.5 years.But now i want to write end to end test aka api test. Now i need to create a test database.When we use mongo db with node js we can dynamically set the test db and when we run "npm run test " it dynamically hit the test db but how can we create same test catalog in couchbase using node js.Thanks.

Hi @arafat15-1830,

This question needs a little more detail to provide a better answer. Are you expecting a bucket to be created for tests? Do you want it to be created for tests and then destroyed each time? Do you want an entire Couchbase instance to be created/destroyed? Finally, if you are trying to do something node specific, I’d recommend asking in the Node specific forum here.

yes i am expecting a 'catalog` to be created for tests.

There isn’t something called a ‘catalog’ in Couchbase. But a bucket is similar to a catalog in the realm of relational databases. The Node SDK for Couchbase offers some methods to create, remove, flush buckets. You can also use N1QL to do bulk updates/deletes, depending on the amount of data that your tests need. Another tool that you might want to check out is FakeIt, which is a tool to automatically generate JSON data