SlideShare uma empresa Scribd logo
1 de 26
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

Mais conteúdo relacionado

Mais procurados

Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...
Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...
Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...DataStax
 
How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...
How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...
How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...DataWorks Summit
 
"What database can tell about application issues? What application can tell a...
"What database can tell about application issues? What application can tell a..."What database can tell about application issues? What application can tell a...
"What database can tell about application issues? What application can tell a...Fwdays
 
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...Sencha
 
Big data testing (1)
Big data testing (1)Big data testing (1)
Big data testing (1)vodqancr
 
Architectural Best Practices to Master + Pitfalls to Avoid (P)
Architectural Best Practices to Master + Pitfalls to Avoid (P) Architectural Best Practices to Master + Pitfalls to Avoid (P)
Architectural Best Practices to Master + Pitfalls to Avoid (P) Elasticsearch
 
Migrating Data and Databases to Azure
Migrating Data and Databases to AzureMigrating Data and Databases to Azure
Migrating Data and Databases to AzureKaren Lopez
 
Provisioning Datadog with Terraform
Provisioning Datadog with TerraformProvisioning Datadog with Terraform
Provisioning Datadog with TerraformMatt Spurlin
 
Presto: Fast SQL on Everything
Presto: Fast SQL on EverythingPresto: Fast SQL on Everything
Presto: Fast SQL on EverythingDavid Phillips
 
Gobbin config-meetup-june-2016
Gobbin config-meetup-june-2016Gobbin config-meetup-june-2016
Gobbin config-meetup-june-2016Vasanth Rajamani
 
NoSQL - No Security? - The BSides Edition
NoSQL - No Security? - The BSides EditionNoSQL - No Security? - The BSides Edition
NoSQL - No Security? - The BSides EditionGavin Holt
 
Redshift Introduction
Redshift IntroductionRedshift Introduction
Redshift IntroductionDataKitchen
 
GraphTour - Albelli: Running Neo4j on a large scale image platform
GraphTour - Albelli: Running Neo4j on a large scale image platformGraphTour - Albelli: Running Neo4j on a large scale image platform
GraphTour - Albelli: Running Neo4j on a large scale image platformNeo4j
 
Testing Distributed Query Engine as a Service
Testing Distributed Query Engine as a ServiceTesting Distributed Query Engine as a Service
Testing Distributed Query Engine as a Servicetakezoe
 
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
DataEngConf SF16 - Methods for Content Relevance at LinkedInDataEngConf SF16 - Methods for Content Relevance at LinkedIn
DataEngConf SF16 - Methods for Content Relevance at LinkedInHakka Labs
 
Semantic Image Logging Using Approximate Statistics & MLflow
Semantic Image Logging Using Approximate Statistics & MLflowSemantic Image Logging Using Approximate Statistics & MLflow
Semantic Image Logging Using Approximate Statistics & MLflowDatabricks
 
213 event processingtalk-deviewkorea.key
213 event processingtalk-deviewkorea.key213 event processingtalk-deviewkorea.key
213 event processingtalk-deviewkorea.keyNAVER D2
 
Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...
Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...
Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...Databricks
 
SQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveSQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveIBM Cloud Data Services
 
GraphTour - Closing Keynote
GraphTour - Closing KeynoteGraphTour - Closing Keynote
GraphTour - Closing KeynoteNeo4j
 

Mais procurados (20)

Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...
Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...
Cold Storage That Isn't Glacial (Joshua Hollander, Protectwise) | Cassandra S...
 
How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...
How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...
How to Use Innovative Data Handling and Processing Techniques to Drive Alpha ...
 
"What database can tell about application issues? What application can tell a...
"What database can tell about application issues? What application can tell a..."What database can tell about application issues? What application can tell a...
"What database can tell about application issues? What application can tell a...
 
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
 
Big data testing (1)
Big data testing (1)Big data testing (1)
Big data testing (1)
 
Architectural Best Practices to Master + Pitfalls to Avoid (P)
Architectural Best Practices to Master + Pitfalls to Avoid (P) Architectural Best Practices to Master + Pitfalls to Avoid (P)
Architectural Best Practices to Master + Pitfalls to Avoid (P)
 
Migrating Data and Databases to Azure
Migrating Data and Databases to AzureMigrating Data and Databases to Azure
Migrating Data and Databases to Azure
 
Provisioning Datadog with Terraform
Provisioning Datadog with TerraformProvisioning Datadog with Terraform
Provisioning Datadog with Terraform
 
Presto: Fast SQL on Everything
Presto: Fast SQL on EverythingPresto: Fast SQL on Everything
Presto: Fast SQL on Everything
 
Gobbin config-meetup-june-2016
Gobbin config-meetup-june-2016Gobbin config-meetup-june-2016
Gobbin config-meetup-june-2016
 
NoSQL - No Security? - The BSides Edition
NoSQL - No Security? - The BSides EditionNoSQL - No Security? - The BSides Edition
NoSQL - No Security? - The BSides Edition
 
Redshift Introduction
Redshift IntroductionRedshift Introduction
Redshift Introduction
 
GraphTour - Albelli: Running Neo4j on a large scale image platform
GraphTour - Albelli: Running Neo4j on a large scale image platformGraphTour - Albelli: Running Neo4j on a large scale image platform
GraphTour - Albelli: Running Neo4j on a large scale image platform
 
Testing Distributed Query Engine as a Service
Testing Distributed Query Engine as a ServiceTesting Distributed Query Engine as a Service
Testing Distributed Query Engine as a Service
 
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
DataEngConf SF16 - Methods for Content Relevance at LinkedInDataEngConf SF16 - Methods for Content Relevance at LinkedIn
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
 
Semantic Image Logging Using Approximate Statistics & MLflow
Semantic Image Logging Using Approximate Statistics & MLflowSemantic Image Logging Using Approximate Statistics & MLflow
Semantic Image Logging Using Approximate Statistics & MLflow
 
213 event processingtalk-deviewkorea.key
213 event processingtalk-deviewkorea.key213 event processingtalk-deviewkorea.key
213 event processingtalk-deviewkorea.key
 
Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...
Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...
Encryption and Masking for Sensitive Apache Spark Analytics Addressing CCPA a...
 
SQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveSQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The Move
 
GraphTour - Closing Keynote
GraphTour - Closing KeynoteGraphTour - Closing Keynote
GraphTour - Closing Keynote
 

Destaque

Nosql databases for the .net developer
Nosql databases for the .net developerNosql databases for the .net developer
Nosql databases for the .net developerJesus Rodriguez
 
NOSQL Database: Apache Cassandra
NOSQL Database: Apache CassandraNOSQL Database: Apache Cassandra
NOSQL Database: Apache CassandraFolio3 Software
 
A practical introduction to Oracle NoSQL Database - OOW2014
A practical introduction to Oracle NoSQL Database - OOW2014A practical introduction to Oracle NoSQL Database - OOW2014
A practical introduction to Oracle NoSQL Database - OOW2014Anuj Sahni
 
Big Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI ProsBig Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI ProsAndrew Brust
 
An Intro to NoSQL Databases
An Intro to NoSQL DatabasesAn Intro to NoSQL Databases
An Intro to NoSQL DatabasesRajith Pemabandu
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
NoSQL-Database-Concepts
NoSQL-Database-ConceptsNoSQL-Database-Concepts
NoSQL-Database-ConceptsBhaskar Gunda
 
Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...
Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...
Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...Maciek Jozwiak
 
NoSQL databases and managing big data
NoSQL databases and managing big dataNoSQL databases and managing big data
NoSQL databases and managing big dataSteven Francia
 
Nombres grammaire
Nombres grammaireNombres grammaire
Nombres grammaireLOLAPARIS
 
Como funciona bedep malware
Como funciona bedep malwareComo funciona bedep malware
Como funciona bedep malwareDavid Thomas
 
SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...
SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...
SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...Bint
 
ECR Sweden Forum ‘09. ECRs Packaging Guide
ECR Sweden Forum ‘09. ECRs Packaging GuideECR Sweden Forum ‘09. ECRs Packaging Guide
ECR Sweden Forum ‘09. ECRs Packaging GuideECR Community
 

Destaque (20)

NoSql Databases
NoSql DatabasesNoSql Databases
NoSql Databases
 
Nosql databases for the .net developer
Nosql databases for the .net developerNosql databases for the .net developer
Nosql databases for the .net developer
 
NOSQL Database: Apache Cassandra
NOSQL Database: Apache CassandraNOSQL Database: Apache Cassandra
NOSQL Database: Apache Cassandra
 
A practical introduction to Oracle NoSQL Database - OOW2014
A practical introduction to Oracle NoSQL Database - OOW2014A practical introduction to Oracle NoSQL Database - OOW2014
A practical introduction to Oracle NoSQL Database - OOW2014
 
Multi model-databases
Multi model-databasesMulti model-databases
Multi model-databases
 
Big Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI ProsBig Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI Pros
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
 
An Intro to NoSQL Databases
An Intro to NoSQL DatabasesAn Intro to NoSQL Databases
An Intro to NoSQL Databases
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
NoSQL-Database-Concepts
NoSQL-Database-ConceptsNoSQL-Database-Concepts
NoSQL-Database-Concepts
 
Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...
Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...
Google Spanner - Synchronously-Replicated, Globally-Distributed, Multi-Versio...
 
NoSQL databases and managing big data
NoSQL databases and managing big dataNoSQL databases and managing big data
NoSQL databases and managing big data
 
Spanner
SpannerSpanner
Spanner
 
Critical Issues Matrix - TIP Committee LMRC 22jun15
Critical Issues Matrix - TIP Committee LMRC 22jun15Critical Issues Matrix - TIP Committee LMRC 22jun15
Critical Issues Matrix - TIP Committee LMRC 22jun15
 
Nombres grammaire
Nombres grammaireNombres grammaire
Nombres grammaire
 
Carlos y Maria
Carlos y MariaCarlos y Maria
Carlos y Maria
 
Como funciona bedep malware
Como funciona bedep malwareComo funciona bedep malware
Como funciona bedep malware
 
SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...
SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...
SEOGuardian - Report posizionamento nei motori di ricerca - Lenti a contatto ...
 
Parclick presentation
Parclick presentationParclick presentation
Parclick presentation
 
ECR Sweden Forum ‘09. ECRs Packaging Guide
ECR Sweden Forum ‘09. ECRs Packaging GuideECR Sweden Forum ‘09. ECRs Packaging Guide
ECR Sweden Forum ‘09. ECRs Packaging Guide
 

Semelhante a Test Automation for NoSQL Databases

Take Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersTake Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersNaresha K
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Roberto Franchini
 
Integration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBIntegration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBMichal Bigos
 
Android Unit Test
Android Unit TestAndroid Unit Test
Android Unit TestPhuoc Bui
 
Monitoring your technology stack with New Relic
Monitoring your technology stack with New RelicMonitoring your technology stack with New Relic
Monitoring your technology stack with New RelicRonald Bradford
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsSebastian Springer
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAmazon Web Services
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBChun-Kai Wang
 
Native REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gNative REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gMarcelo Ochoa
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Andy Bunce
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
 
Decomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservicesDecomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservicesDennis Doomen
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Tobias Trelle
 

Semelhante a Test Automation for NoSQL Databases (20)

Take Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersTake Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainers
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
Integration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBIntegration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDB
 
Android Unit Test
Android Unit TestAndroid Unit Test
Android Unit Test
 
Monitoring your technology stack with New Relic
Monitoring your technology stack with New RelicMonitoring your technology stack with New Relic
Monitoring your technology stack with New Relic
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for Government
 
Jenkins' shared libraries in action
Jenkins' shared libraries in actionJenkins' shared libraries in action
Jenkins' shared libraries in action
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
BDD in iOS with Cedar
BDD in iOS with CedarBDD in iOS with Cedar
BDD in iOS with Cedar
 
Native REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gNative REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11g
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Data access
Data accessData access
Data access
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
Decomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservicesDecomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservices
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.
 

Mais de Tobias Trelle

TDD mit JUnit und Mockito
TDD mit JUnit und MockitoTDD mit JUnit und Mockito
TDD mit JUnit und MockitoTobias Trelle
 
NoSQL - Einführung in Graphen-Datenbanken mit Neo4j
NoSQL - Einführung in Graphen-Datenbanken mit Neo4jNoSQL - Einführung in Graphen-Datenbanken mit Neo4j
NoSQL - Einführung in Graphen-Datenbanken mit Neo4jTobias Trelle
 
Einführung in NoSQL-Datenbanken
Einführung in NoSQL-DatenbankenEinführung in NoSQL-Datenbanken
Einführung in NoSQL-DatenbankenTobias Trelle
 
MongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwaltenMongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwaltenTobias Trelle
 
Morphia, Spring Data & Co
Morphia, Spring Data & CoMorphia, Spring Data & Co
Morphia, Spring Data & CoTobias Trelle
 
Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Tobias Trelle
 
An introduction to MongoDB and Ruby
An introduction to MongoDB and RubyAn introduction to MongoDB and Ruby
An introduction to MongoDB and RubyTobias Trelle
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBTobias Trelle
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBTobias Trelle
 
OOP 2013: Praktische Einführung in MongoDB
OOP 2013: Praktische Einführung in MongoDBOOP 2013: Praktische Einführung in MongoDB
OOP 2013: Praktische Einführung in MongoDBTobias Trelle
 
MongoDB Munich 2012: Spring Data MongoDB
MongoDB Munich 2012: Spring Data MongoDBMongoDB Munich 2012: Spring Data MongoDB
MongoDB Munich 2012: Spring Data MongoDBTobias Trelle
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live HackingTobias Trelle
 

Mais de Tobias Trelle (13)

TDD mit JUnit und Mockito
TDD mit JUnit und MockitoTDD mit JUnit und Mockito
TDD mit JUnit und Mockito
 
NoSQL - Einführung in Graphen-Datenbanken mit Neo4j
NoSQL - Einführung in Graphen-Datenbanken mit Neo4jNoSQL - Einführung in Graphen-Datenbanken mit Neo4j
NoSQL - Einführung in Graphen-Datenbanken mit Neo4j
 
Einführung in NoSQL-Datenbanken
Einführung in NoSQL-DatenbankenEinführung in NoSQL-Datenbanken
Einführung in NoSQL-Datenbanken
 
MongoDB Einführung
MongoDB EinführungMongoDB Einführung
MongoDB Einführung
 
MongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwaltenMongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwalten
 
Morphia, Spring Data & Co
Morphia, Spring Data & CoMorphia, Spring Data & Co
Morphia, Spring Data & Co
 
Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Spring Data, Jongo & Co.
Spring Data, Jongo & Co.
 
An introduction to MongoDB and Ruby
An introduction to MongoDB and RubyAn introduction to MongoDB and Ruby
An introduction to MongoDB and Ruby
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
OOP 2013: Praktische Einführung in MongoDB
OOP 2013: Praktische Einführung in MongoDBOOP 2013: Praktische Einführung in MongoDB
OOP 2013: Praktische Einführung in MongoDB
 
MongoDB Munich 2012: Spring Data MongoDB
MongoDB Munich 2012: Spring Data MongoDBMongoDB Munich 2012: Spring Data MongoDB
MongoDB Munich 2012: Spring Data MongoDB
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
 

Último

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

Test Automation for NoSQL Databases

  • 1. codecentric AG 1 NoSQL Unit & Travis CI Test Automation for NoSQL Databases Tobias.Trelle@codecentric.de @tobiastrelle
  • 2. 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)
  • 3. codecentric AG 3 Agenda Unit Testing NoSQL Unit  Travis CI
  • 4. codecentric AG 4 Unit Testing Your Persistence Layer UI Layer Database Business Layer Persistence Layer DAO / Repository Production
  • 5. 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
  • 6. codecentric AG 6 Unit Testing Your Persistence Layer Unit tests should …  be fast  run in isolation  load test data  compare data
  • 7. codecentric AG 7 NoSQL Unit Github - https://github.com/lordofthejars/nosql-unit
  • 8. codecentric AG 8 NoSQL Unit > Overview Benefits  Database Lifecycle Management  Connection Management  Load Test Data  Compare Data
  • 9. codecentric AG 9 NoSQL Unit > Overview How does it work?  JUnit Extension  JUnit Rules  Annotations
  • 10. codecentric AG 10 NoSQL Unit > Database Management Options DatabaseNoSQL Unit Embedded JVM Local Machine Database Database Remote Machine Managed Remote
  • 11. 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 
  • 12. 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
  • 13. 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
  • 14. codecentric AG 14 NoSQL Unit > Redis Example > keyvalue.json { "data": [ {"simple": [ { "key":"hello", "value":"redis"} ] } ] }
  • 15. 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
  • 16. codecentric AG 16 NoSQL Unit > MongoDB Example > orders.json { "orders": [ { "type": 4711, "desc": "1st order" }, { "type": 42, "desc": "2nd order" } ] }
  • 17. codecentric AG 17 NoSQL Unit > MongoDB > Advanced Features NoSQL Unit MongoDB supports  Replica Sets  Sharded Environments  Sharded Env. + Replica Sets …in managed mode.
  • 18. codecentric AG 18 Travis CI http://www.travis-ci.org
  • 19. 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  …
  • 20. 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
  • 24. 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
  • 25. 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
  • 26. 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