- Fast: no network/filesystem access
- Isolated: independent of other tests
- Repeatable: system has known state
- Self-Validated:
- Timely:
- modes:
- in-memory mode: unit testing
- managed mode: integration testing
- remote: manage connection by developer
- rules: maintain database in known state
- annotations
- @UsingDataSet: seed database with defined dataset
- strategy
- INSERT
- DELETE_ALL
- CLEAN_INSERT
- REFRESH
- @UsingDataSet(locations="my_data_set.json", loadStrategy=LoadStrategyEnum.REFRESH)
- strategy
- @ShouldMatchDataSet: verify database
- @ShouldMatchDataSet(location="my_expected_data_set.json")
- @UsingDataSet: seed database with defined dataset
-
Lifecycle Management Rules
- InMemoryMongoDb
- implementation with Fongo
- date: { "$date" : "2011-01-05T10:09:15.210Z" }
- objectid: {"$oid": "xxxx"}
- @ClassRule public static InMemoryMongoDb inMemoryMongoDb = newInMemoryMongoDbRule().build();
- ManagedMongoDb
- default installtion from MONGO_HOME
- target path target/mong-temp
- db parth {target path}/mongo-dbpath
- @ClassRule public static ManagedMongoDb managedMongoDb = newManagedMongoDbRule().build();
- InMemoryMongoDb
-
Replica setup
-
Sharding setup