Date
1 - 7 of 7
Unit testing with JanusGraph
Suny <sahithiy...@...>
Thanks. I startup JG instance in my local and use this code to connect to it GryoMapper.Builder builder = GryoMapper.build(). cluster = Cluster.build().serializer(new GryoMessageSerializerV1d0(buil client = cluster.connect(); where serverUrl is localhost:8081. This instance has cassandra configured as backend. Now if i want to run a unit test against in-memory db, Should i run another instance of JG on different port and connect to it from application ? On Thursday, September 7, 2017 at 1:59:46 PM UTC-4, Vladyslav Kosulin wrote:
|
|
Vladyslav Kosulin <vkos...@...>
Suny, in the original post you wrote about "in-memory database for unit testing and cassandra for the real application data on same janusgraph instance". I assumed you mean same JG instance for both testing and production which I would strongly object about. But even speaking about separation of JG instances for in-memory unit testing and for (acceptance/regression) testing with real backend - yes, I would keep them separate. JG itself is very cheap to run, and such setup will allow you to have testing environment as closely matching production as possible while using another env for development including changes to JG config and upgrades. On Thursday, September 7, 2017 at 11:24:54 AM UTC-4, Suny wrote:
|
|
Suny <sahithiy...@...>
Thanks for you response. So I should use 2 instances of JG - One with in-memory backed to perform unit testing and other with cassandra to run functional use cases ? On Thursday, September 7, 2017 at 10:56:44 AM UTC-4, Vladyslav Kosulin wrote:
|
|
Robert Dale <rob...@...>
The in-memory database was built for testing - http://docs.janusgraph.org/latest/inmemorystorage.html#_ideal_use_case_2 If it's only the data access layer (e.g. gremlin queries) being tested, I would still call that unit testing. Robert Dale On Thu, Sep 7, 2017 at 10:56 AM, Vladyslav Kosulin <vkos...@...> wrote:
|
|
Vladyslav Kosulin <vkos...@...>
Oh, and I would always use separate JG instance for testing if it is possible. |
|
Vladyslav Kosulin <vkos...@...>
For unit testing you should use mocks otherwise this is not unit testing. For functional testing I use TinkerGraph as much faster and less resource hungry backend. Janus in-memory should be fine, also, but I have not tried it. I would use cassandra backend only for regression and acceptance testing. But my app is dealing with multiple backends and my domain model is based on interfaces and all my business logic is backend agnostic. On Thursday, September 7, 2017 at 10:22:37 AM UTC-4, Suny wrote:
|
|
Suny <sahithiy...@...>
Hi, I am using janusgraph with cassandra as backend for my application. If i want to write a unit test to verify saving/retrieving of data, is mocking the only way ? Can i use in-memory database for unit testing and cassandra for the real application data on same janusgraph instance ? Or do i need separate JG instances ? Thanks |
|