SlideShare a Scribd company logo
1 of 57
Download to read offline
DIY
(Do-it-yourself)
Testing
Ruby Engineer on the
drivers team.
Based in Berlin.
Maintain the gems:
bson
mongo
mongoid
bson_ext
mongo_kerberos
@EmStolfo
MongoDB Drivers
C
C++
C#
Java
Node.js
Perl
PHP
Python
Ruby
Scala
MongoDB Drivers
Interface to the server.
10 official drivers available.
Many started as OS projects.
History
No specifications.
Divergent codebases
and features.
MongoDB Drivers
Reality
Server “interface” was not consistent.
MongoDB Drivers
Reality
Organizations can experience 1 interface.
Specifications guide design
and provide documentation.
Rewrites with collective knowledge.
MongoDB Drivers
Revamp
Server “interface” is a single product.
MongoDB Drivers
Revamp
Specifications
Equally valuable to the drivers team
as to the community.
Server Discovery and
Monitoring Spec
Logic required to make an application
using MongoDB highly available.
How to validate
compliance?
Requirements for
validating compliance
• Unit tests.
• Integration tests.
• Tests define as “data”.
• Language-agnostic.
• Reproducible scenarios.
DIY Testing
Our custom tests: Unit / Integration
Build your own test framework.
define
Format - YAML
Tests
Scenarios
Our approach:
“DIY” testing
benefits
Format:YAML
• Describes data.
• Can translate to actions.
• Most languages can use a YAML parsing
library.
• Driver authors write a reusable harness.
• Changes in the spec can be
communicated via additional YAML tests
or changes to existing ones.
Test requirements
• Unit tests.
• Integration tests.
• Defined as “data”.
• Language-agnostic.
• Reproducible scenarios.
Unit test - YAML
single/direct_connection_standalone.yml
Unit test - Test object
spec/support/server_discovery_and_monitoring.rb
Unit test - spec
spec/mongo/server_discovery_and_monitoring_spec.rb
Unit test - YAML
rs/discover_primary.yml
Test requirements
• Unit tests.
• Integration tests.
• Defined as “data”.
• Language-agnostic.
• Reproducible scenarios.
Mongo Orchestration
Mongo
Orchestration
Define clusters using JSON.
Manipulate clusters via RESTful API.
Mongo Orchestration
HTTP server providing REST interface to manage
multiple MongoDB processes on the same machine.
Implemented in python.
What about Automation!?
• Is intended for testing.
• Starts processes on one machine.
• Allows fault injection.
• Does not have a UI.
• Has no protection against downtime.
• Has one agent, so no resiliency.
• Does not handle operation tasks.
Mongo Orchestration..
!
Create different cluster topologies.
Single
Mongo Orchestration
Replica Set
Sharded Cluster
Setup
Single server
config options
Replica Set
config options
Sharded Cluster
config options
Define different installations
in a config file
mongo-orchestration.config
Set up a Replica Set
http://bit.ly/mo-usage
Benefits of MO
• Reproducible test scenarios.
• Abstracts differing configuration
options across MongoDB versions.
• Uniform interface regardless of OS.
• Ability to define different locations
of MongoDB installations for multi-
version testing.
Multi-version testing
Multi-topology testing
SSL
Authentication
Used internally
Drivers integration tests
No need for cluster managers
test/tools/mongo_config.rb
(cluster manager in 1.x ruby driver)
Jenkins testing
Integration tests
Integration tests
Test driver behavior.
Input: cluster state
Output: driver behavior
Mongo Orchestration
Test harness
(Ruby driver example)
PR #584 [WIP] Integration tests using Mongo Orchestration
YAML integration test
rs/connection/primary-not-available.yml (I)
YAML integration test
rs/connection/primary-not-available.yml (II)
Harness structure
1. Resource (MO cluster)
2. Specification (parsed YAML)
3. Test (can be run)
PR #584 [WIP] Integration tests using Mongo Orchestration
Resource
spec/support/mongo_orchestration/resource.rb
Specification
spec/support/mongo_orchestration/spec.rb
Test
spec/support/mongo_orchestration/operation/client_operation.rb
Restarted primary integration test
rs/connection/primary-restarted.yml (I)
Restarted primary integration test
rs/connection/primary-restarted.yml (II)
Restarted primary integration test
rs/connection/primary-restarted.yml (III)
How to build your own
testing framework
Ask yourself
1. Unit or integration tests?
2. Need to be language-agnostic?
3. Directly related to specs or
documentation?
Test framework entities
Resource
Wrapper around
the external component.
Test framework entities
Specification
The parsed YAML.
Test framework entities
State manipulator
Processor of phases to get
to a certain state.
Test framework entities
Tests
Can be executed.
Result is ‘pass’ or ‘fail’.
Make the test runner
as generic as possible.
Install Mongo Orchestration
Resources
http://bit.ly/ruby-kaigi-diy-testing
@EmStolfo

More Related Content

What's hot

Docker and Selenoid - Make Autotests Great Again
Docker and Selenoid - Make Autotests Great Again Docker and Selenoid - Make Autotests Great Again
Docker and Selenoid - Make Autotests Great Again
COMAQA.BY
 

What's hot (20)

Docker and Selenoid - Make Autotests Great Again
Docker and Selenoid - Make Autotests Great Again Docker and Selenoid - Make Autotests Great Again
Docker and Selenoid - Make Autotests Great Again
 
Сергей Калинец "Стероиды для Дотнетчика"
Сергей Калинец "Стероиды для Дотнетчика"Сергей Калинец "Стероиды для Дотнетчика"
Сергей Калинец "Стероиды для Дотнетчика"
 
Jenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsJenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with Jenkins
 
Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!
 
Skinny Framework 1.0.0
Skinny Framework 1.0.0Skinny Framework 1.0.0
Skinny Framework 1.0.0
 
Testing in GO
Testing in GOTesting in GO
Testing in GO
 
Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)
 
TypeScript Jump Start
TypeScript Jump StartTypeScript Jump Start
TypeScript Jump Start
 
JBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testingJBoss Wise: breaking barriers to WS testing
JBoss Wise: breaking barriers to WS testing
 
Виталий Редько "React + Redux: performance & scalability"
Виталий Редько "React + Redux: performance & scalability"Виталий Редько "React + Redux: performance & scalability"
Виталий Редько "React + Redux: performance & scalability"
 
Jenkinsfileのlintで救える命がある
Jenkinsfileのlintで救える命があるJenkinsfileのlintで救える命がある
Jenkinsfileのlintで救える命がある
 
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
 
Dockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber ExampleDockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber Example
 
Behave manners for ui testing pycon2019
Behave manners for ui testing pycon2019Behave manners for ui testing pycon2019
Behave manners for ui testing pycon2019
 
Java Script Template Engine 비교하기
Java Script Template Engine 비교하기Java Script Template Engine 비교하기
Java Script Template Engine 비교하기
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssembly
 
Web assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyWeb assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail Sorokovsky
 
Pipeline as code using Jenkins -Ministry of Testing
Pipeline as code using Jenkins -Ministry of TestingPipeline as code using Jenkins -Ministry of Testing
Pipeline as code using Jenkins -Ministry of Testing
 

Similar to RubyKaigi 2015-DIY-Testing

Mongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-finalMongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-final
MongoDB
 
More than Programming!
More than Programming!More than Programming!
More than Programming!
Sophy Eung
 
MongoDB at Gilt Groupe
MongoDB at Gilt GroupeMongoDB at Gilt Groupe
MongoDB at Gilt Groupe
MongoDB
 

Similar to RubyKaigi 2015-DIY-Testing (20)

Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
 
Mongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-finalMongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-final
 
Angular js best practice
Angular js best practiceAngular js best practice
Angular js best practice
 
Continuous integration for open source distros v 3.0
Continuous integration for open source distros v 3.0Continuous integration for open source distros v 3.0
Continuous integration for open source distros v 3.0
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
Mongo db - How we use Go and MongoDB by Sam Helman
Mongo db - How we use Go and MongoDB by Sam HelmanMongo db - How we use Go and MongoDB by Sam Helman
Mongo db - How we use Go and MongoDB by Sam Helman
 
Device fragmentation vs clean code
Device fragmentation vs clean codeDevice fragmentation vs clean code
Device fragmentation vs clean code
 
More than Programming!
More than Programming!More than Programming!
More than Programming!
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Real World Java Compatibility
Real World Java CompatibilityReal World Java Compatibility
Real World Java Compatibility
 
A tale in automation (Puppet to Ansible)
A tale in automation (Puppet to Ansible)A tale in automation (Puppet to Ansible)
A tale in automation (Puppet to Ansible)
 
MongoDB at Gilt Groupe
MongoDB at Gilt GroupeMongoDB at Gilt Groupe
MongoDB at Gilt Groupe
 
Angular patterns
Angular patternsAngular patterns
Angular patterns
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
Better Integration Tests for Kafka Applications with Testcontainers with Oleg...
Better Integration Tests for Kafka Applications with Testcontainers with Oleg...Better Integration Tests for Kafka Applications with Testcontainers with Oleg...
Better Integration Tests for Kafka Applications with Testcontainers with Oleg...
 
Cypress Testing.pptx
Cypress Testing.pptxCypress Testing.pptx
Cypress Testing.pptx
 
Rails is Easy*
Rails is Easy*Rails is Easy*
Rails is Easy*
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

RubyKaigi 2015-DIY-Testing