Test Automation for NoSQL Databases
Upcoming SlideShare
Loading in...5
×
 

Test Automation for NoSQL Databases

on

  • 1,463 views

NoSQL Unit & Travis CI - Test automation for NoSQL databases

NoSQL Unit & Travis CI - Test automation for NoSQL databases

Statistics

Views

Total Views
1,463
Views on SlideShare
663
Embed Views
800

Actions

Likes
3
Downloads
11
Comments
0

21 Embeds 800

https://blog.codecentric.de 636
http://java.dzone.com 64
http://feedly.com 32
http://feeds.feedburner.com 10
http://www.newsblur.com 10
http://architects.dzone.com 8
http://dschool.co 8
http://www.slideee.com 6
http://summary 5
http://newsblur.com 4
http://www.feedspot.com 3
http://digg.com 2
https://www.inoreader.com 2
https://newsblur.com 2
https://www.newsblur.com 2
http://twimblr.appspot.com 1
https://www.rebelmouse.com 1
https://feedly.com 1
http://www.inoreader.com 1
http://www.dzone.com 1
http://feedproxy.google.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Test Automation for NoSQL Databases Test Automation for NoSQL Databases Presentation Transcript

  • codecentric AG 1 NoSQL Unit & Travis CI Test Automation for NoSQL Databases Tobias.Trelle@codecentric.de @tobiastrelle
  • codecentric AG 2 Tobias Trelle Senior IT Consultant @ codecentric AG Organizer of MongoDB User Group Düsseldorf Author of „MongoDB – Ein praktischer Einstieg“ (dpunkt-Verlag)
  • codecentric AG 3 Agenda Unit Testing NoSQL Unit  Travis CI
  • codecentric AG 4 Unit Testing Your Persistence Layer UI Layer Database Business Layer Persistence Layer DAO / Repository Production
  • codecentric AG 5 Unit Testing Your Persistence Layer UI Layer Database Business Layer Persistence Layer DAO / Repository Production UI Layer Embedded Database Business Layer Persistence Layer DAO / Repository Unit Test Unit Test In Process
  • codecentric AG 6 Unit Testing Your Persistence Layer Unit tests should …  be fast  run in isolation  load test data  compare data
  • codecentric AG 7 NoSQL Unit Github - https://github.com/lordofthejars/nosql-unit
  • codecentric AG 8 NoSQL Unit > Overview Benefits  Database Lifecycle Management  Connection Management  Load Test Data  Compare Data
  • codecentric AG 9 NoSQL Unit > Overview How does it work?  JUnit Extension  JUnit Rules  Annotations
  • codecentric AG 10 NoSQL Unit > Database Management Options DatabaseNoSQL Unit Embedded JVM Local Machine Database Database Remote Machine Managed Remote
  • codecentric AG 11 NoSQL Unit > Supported Databases Database Type Impl Language Embedded Managed / Remote Cassandra Column Java   CouchDB Document Erlang ---  Elasticsearch Document Java   HBase Column Java   Infinispan In Memory Java   MongoDB Document C++ fongo Mock  Neo4j Graph Java   Redis Key/Value C/C++ NoSQL Unit Mock 
  • codecentric AG 12 NoSQL Unit > Lifecycle NoSQL Unit Database Test Case Loop over tests Launch (optional) Connect to Load Test Data (optional) Compare Data Sets (optional) Shutdown (optional) Run Test Interact with
  • codecentric AG 13 NoSQL Unit > Redis Example public class EmbeddedRedisTest { @ClassRule public static EmbeddedRedis embeddedRedis = newEmbeddedRedisRule().build(); @Rule public RedisRule redisRule = newRedisRule().defaultEmbeddedRedis(); /** Unit under test. */ private KeyValueRepository repository; @Test @UsingDataSet( loadStrategy = LoadStrategyEnum.DELETE_ALL ) @ShouldMatchDataSet( location="keyvalue.json" ) public void should_insert_string() { // given KeyValueRepository repo = new KeyValueRepository( getJedisInstance() ); // when repo.setValue("hello", "redis"); // then: should match data } } Create embedded instance once for all tests Get connection once per test Prepare data Compare given and expected data after test
  • codecentric AG 14 NoSQL Unit > Redis Example > keyvalue.json { "data": [ {"simple": [ { "key":"hello", "value":"redis"} ] } ] }
  • codecentric AG 15 NoSQL Unit > MongoDB Example public class RemoteMongoDBTest { @Rule // use already running "remote" instance public MongoDbRule mongoRule = new MongoDbRule( mongoDb().databaseName("test").host("localhost").port(27017) .build() ); /** Unit under test. */ private OrderRepository repository; @Test @UsingDataSet(locations = "orders.json", loadStrategy = LoadStrategyEnum.CLEAN_INSERT) public void should_find_all_orders() { // given repository = createOrderRepository(); // when List<DBObject> orders = repository.findAll(); // then assertThat(orders, notNullValue()); assertThat(orders.size(), is(2)); } Load test data from JSON file
  • codecentric AG 16 NoSQL Unit > MongoDB Example > orders.json { "orders": [ { "type": 4711, "desc": "1st order" }, { "type": 42, "desc": "2nd order" } ] }
  • codecentric AG 17 NoSQL Unit > MongoDB > Advanced Features NoSQL Unit MongoDB supports  Replica Sets  Sharded Environments  Sharded Env. + Replica Sets …in managed mode.
  • codecentric AG 18 Travis CI http://www.travis-ci.org
  • codecentric AG 19 Travis CI > Overview Free Continuous Integration Platform: Lanuguages:  C/C++  Closure  Erlang  Go  Groovy  Java  JavaScript / Node.js  Objective-C  Ruby  Scala  … Services:  MySQL  PostgreSQL  MongoDB  CouchDB  Redis  Riak  RabbitMQ  Memcached  Cassandra  Neo4j  …
  • codecentric AG 20 Travis CI > Lifecycle Travis CI Database GitHubTests start services shutdown services clone / checkout build & run use .travis.yml: language: java services: - mongodb - redis
  • codecentric AG 21 Travis CI > Demo
  • codecentric AG 22 Travis CI > Demo
  • codecentric AG 23 Travis CI > Demo
  • codecentric AG 24 Online Resources NoSQL Unit https://github.com/lordofthejars/nosql-unit Travis CI https://travis-ci.org/ NoSQL Unit Examples https://github.com/ttrelle/nosqlunit-examples
  • codecentric AG 25 MongoDB User Group Düsseldorf https://www.xing.com/net/mongodb-dus/ http://www.meetup.com/Dusseldorf-MongoDB-User-Group/ @MongoDUS Meetup #10: MongoDB at LUMsearch.com (by Christian Douven) 03.07.2014, 19:00
  • codecentric AG 26 QUESTIONS? Tobias Trelle codecentric AG Merscheider Str. 1 42699 Solingen tel +49 (0) 212.233628.47 fax +49 (0) 212.233628.79 mail Tobias.Trelle@codecentric.de twitter @tobiastrelle www.codecentric.de blog.codecentric.de/en/author/tobias-trelle www.xing.com/net/mongodb-dus