There are so many testing frameworks available to us that we sometimes overlook a completely valid, and sometimes preferable option: writing our own.
The drivers team at MongoDB focused over the last year on conforming to common APIs and algorithms but we needed a way to validate our consistency. We therefore ended up building our own testing DSL, REST service, and individual test frameworks.
Using these common tests and the Ruby driver's test suite as examples, this talk will demonstrate when existing test frameworks aren't the best choice and show how you can build your own.
7. Organizations can experience 1 interface.
Specifications guide design
and provide documentation.
Rewrites with collective knowledge.
MongoDB Drivers
Revamp
15. 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.
16. Test requirements
• Unit tests.
• Integration tests.
• Defined as “data”.
• Language-agnostic.
• Reproducible scenarios.
17. Unit test - YAML
single/direct_connection_standalone.yml
18. Unit test - Test object
spec/support/server_discovery_and_monitoring.rb
19. Unit test - spec
spec/mongo/server_discovery_and_monitoring_spec.rb
23. 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.
24. 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..
!
32. 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.