SlideShare a Scribd company logo
1 of 94
TDD With Apache
                   Cassandra
Nate Mccall
@zznate
Hi.
We are talking about
two things...
1. Test Driven
Development
(TDD)
2. Apache Cassandra
...and how difficult it
is to put them
together
TDD
Unit testing
       (Integration Testing)
Unit Testing: F.I.R.S.T.
F ast
I solated
R epeatable
S elf-validating
T imely
Integration Testing
Run less often
Fewer of them
Cassandra
(not an acronym)
Distributed, high
performance
database
Two problems with
that...
1. “Distributed”
2. “Database”
Specifically
Configurations and
behavior tied to
environment
Heavy weight
resource
requirements
Failures difficult to
simulate
Applying TDD
But first: a dirty
secret to share...
I’m Doing it wrong
3 minutes for one
module
The Culprit:
EmbeddedCassandraHelper
Easy to setup
Known state per test
Client setup is easy
Slowwwww
Lots of fixture code
Hacking cassandra
 lifecycle
mvn install -DskipTests
mvn install -DskipTests

Fail.
How can I solve this?
“Refactoring tests”
Pro tip:
propose it as a
conference topic :)
So some time has
been weaseled...
What other tools are
available?
cassandra-maven-plugin
cassandra-unit
2nd dirty secret...
I’ve contributed to both
projects :(
Cassandra Unit
Easy data loading
   (no fixtures)
Multiple formats
Client setup provided
Cassandra instance in
  process
Slow on large data sets
External instance support
(not a pro for my use case)
Cassandra Maven Plugin
Cassandra(s) in forked
JVM(s)
Setup/teardown (still) in
maven lifecycle
Multi-node support FTW!
No easy means of loading
  bulk data
Code level fixtures
Manual client setup
Back to original issue
What to focus on first
1. Separate unit tests
from integration tests
Maven test plugins
Maven test plugins:
surefire
failsafe
Maven test plugins:
failfire
suresafe
Maven test plugins:
surefail
firesafe?
Failsafe:
For integration tests.
Keeps going even if there
 are failures
Failsafe:
Fails to make it easy to
find your mistake
Configuring
exclusions
While i’m there...
There’s got to be
more to do
Remember the Goals:
Avoid fixture code
No per-developer configs
Not in process
Is it just choosing
between different
tools?
You got your fixtures
in my plugin!
Cassandra-unit
      +
cassandra-maven-plugin
      =
    WIN
Benefits:
Maven lifecycle
No fixtures
RunListeners
@Rule for special case-ing
Maven configuration:
	 failsafe
Maven configuration:
	 Cassandra
RunListener code
Parallel *allthethings*
I can has cluster!
$ sudo ifconfig lo0 alias 127.0.0.2 up
$ sudo ifconfig lo0 alias 127.0.0.3 up
$ sudo ifconfig lo0 alias 127.0.0.4 up
$ mvn cassandra:start-cluster 
cassandra:run
Next Steps...
Next Steps...
(am i really this psyched about
testing?)
Instrumentation...
Gradle
(or: How I sat next to Tim
Berglund at lunch)
Gradle
... found my next proposal :)
aws-java-sdk.jar
     +
cassandra launcher
     =
AWESOME
... yep, this one too.
Continue to contribute
Continue
to
Contribute
Questions?

More Related Content

What's hot

Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsDror Bereznitsky
 
AVA - a futuristic test runner
AVA - a futuristic test runnerAVA - a futuristic test runner
AVA - a futuristic test runnerandreaslubbe
 
Just in Time Resourcing
Just in Time ResourcingJust in Time Resourcing
Just in Time ResourcingESUG
 
Speeding up your testflow
Speeding up your testflowSpeeding up your testflow
Speeding up your testflowMircea Mare
 
Incident Resolution as Code
Incident Resolution as CodeIncident Resolution as Code
Incident Resolution as CodeJulien Pivotto
 
Whatthestack using Tempest for testing your OpenStack deployment
Whatthestack using Tempest for testing your OpenStack deploymentWhatthestack using Tempest for testing your OpenStack deployment
Whatthestack using Tempest for testing your OpenStack deploymentChristian Schwede
 
Thread priority in java
Thread priority in javaThread priority in java
Thread priority in javaRakesh Mittal
 

What's hot (7)

Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
 
AVA - a futuristic test runner
AVA - a futuristic test runnerAVA - a futuristic test runner
AVA - a futuristic test runner
 
Just in Time Resourcing
Just in Time ResourcingJust in Time Resourcing
Just in Time Resourcing
 
Speeding up your testflow
Speeding up your testflowSpeeding up your testflow
Speeding up your testflow
 
Incident Resolution as Code
Incident Resolution as CodeIncident Resolution as Code
Incident Resolution as Code
 
Whatthestack using Tempest for testing your OpenStack deployment
Whatthestack using Tempest for testing your OpenStack deploymentWhatthestack using Tempest for testing your OpenStack deployment
Whatthestack using Tempest for testing your OpenStack deployment
 
Thread priority in java
Thread priority in javaThread priority in java
Thread priority in java
 

Viewers also liked

Successful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraSuccessful Software Development with Apache Cassandra
Successful Software Development with Apache Cassandrazznate
 
Apachecon cassandra transport
Apachecon cassandra transportApachecon cassandra transport
Apachecon cassandra transportzznate
 
Strata west 2012_java_cassandra
Strata west 2012_java_cassandraStrata west 2012_java_cassandra
Strata west 2012_java_cassandrazznate
 
Intravert atx meetup_condensed
Intravert atx meetup_condensedIntravert atx meetup_condensed
Intravert atx meetup_condensedzznate
 
Ben Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra ProjectBen Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra ProjectMorningstar Tech Talks
 
Planificación modelo TPACK
Planificación modelo TPACKPlanificación modelo TPACK
Planificación modelo TPACKlucecita1
 
Jeanyveswelter
JeanyveswelterJeanyveswelter
JeanyveswelterHammond
 
Cynthia A Ross Resume
Cynthia A Ross ResumeCynthia A Ross Resume
Cynthia A Ross ResumeCynRoss
 
先用再学 - 借助 XNA 快速开发游戏原型
先用再学  - 借助 XNA 快速开发游戏原型先用再学  - 借助 XNA 快速开发游戏原型
先用再学 - 借助 XNA 快速开发游戏原型onlyfeng
 
Parkison Portfolio
Parkison PortfolioParkison Portfolio
Parkison PortfolioDan_Parkison
 
Planificación modelo TPACK
Planificación modelo TPACKPlanificación modelo TPACK
Planificación modelo TPACKlucecita1
 
Cover It Live Training Presentation
Cover It Live Training PresentationCover It Live Training Presentation
Cover It Live Training PresentationBritney Wright
 
Meetup cassandra sfo_jdbc
Meetup cassandra sfo_jdbcMeetup cassandra sfo_jdbc
Meetup cassandra sfo_jdbczznate
 
Nyc summit intro_to_cassandra
Nyc summit intro_to_cassandraNyc summit intro_to_cassandra
Nyc summit intro_to_cassandrazznate
 
An Introduction to the Vert.x framework
An Introduction to the Vert.x frameworkAn Introduction to the Vert.x framework
An Introduction to the Vert.x frameworkzznate
 
Hector v2: The Second Version of the Popular High-Level Java Client for Apach...
Hector v2: The Second Version of the Popular High-Level Java Client for Apach...Hector v2: The Second Version of the Popular High-Level Java Client for Apach...
Hector v2: The Second Version of the Popular High-Level Java Client for Apach...zznate
 
Advanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMXAdvanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMXzznate
 
Introduction to apache_cassandra_for_develope
Introduction to apache_cassandra_for_developeIntroduction to apache_cassandra_for_develope
Introduction to apache_cassandra_for_developezznate
 
Introduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgIntroduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgzznate
 

Viewers also liked (20)

Successful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraSuccessful Software Development with Apache Cassandra
Successful Software Development with Apache Cassandra
 
Apachecon cassandra transport
Apachecon cassandra transportApachecon cassandra transport
Apachecon cassandra transport
 
Strata west 2012_java_cassandra
Strata west 2012_java_cassandraStrata west 2012_java_cassandra
Strata west 2012_java_cassandra
 
Intravert atx meetup_condensed
Intravert atx meetup_condensedIntravert atx meetup_condensed
Intravert atx meetup_condensed
 
Ben Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra ProjectBen Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra Project
 
Planificación modelo TPACK
Planificación modelo TPACKPlanificación modelo TPACK
Planificación modelo TPACK
 
Jeanyveswelter
JeanyveswelterJeanyveswelter
Jeanyveswelter
 
Cynthia A Ross Resume
Cynthia A Ross ResumeCynthia A Ross Resume
Cynthia A Ross Resume
 
先用再学 - 借助 XNA 快速开发游戏原型
先用再学  - 借助 XNA 快速开发游戏原型先用再学  - 借助 XNA 快速开发游戏原型
先用再学 - 借助 XNA 快速开发游戏原型
 
Parkison Portfolio
Parkison PortfolioParkison Portfolio
Parkison Portfolio
 
Planificación modelo TPACK
Planificación modelo TPACKPlanificación modelo TPACK
Planificación modelo TPACK
 
Maubaocao luanvan
Maubaocao luanvanMaubaocao luanvan
Maubaocao luanvan
 
Cover It Live Training Presentation
Cover It Live Training PresentationCover It Live Training Presentation
Cover It Live Training Presentation
 
Meetup cassandra sfo_jdbc
Meetup cassandra sfo_jdbcMeetup cassandra sfo_jdbc
Meetup cassandra sfo_jdbc
 
Nyc summit intro_to_cassandra
Nyc summit intro_to_cassandraNyc summit intro_to_cassandra
Nyc summit intro_to_cassandra
 
An Introduction to the Vert.x framework
An Introduction to the Vert.x frameworkAn Introduction to the Vert.x framework
An Introduction to the Vert.x framework
 
Hector v2: The Second Version of the Popular High-Level Java Client for Apach...
Hector v2: The Second Version of the Popular High-Level Java Client for Apach...Hector v2: The Second Version of the Popular High-Level Java Client for Apach...
Hector v2: The Second Version of the Popular High-Level Java Client for Apach...
 
Advanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMXAdvanced Apache Cassandra Operations with JMX
Advanced Apache Cassandra Operations with JMX
 
Introduction to apache_cassandra_for_develope
Introduction to apache_cassandra_for_developeIntroduction to apache_cassandra_for_develope
Introduction to apache_cassandra_for_develope
 
Introduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgIntroduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhg
 

Similar to Oscon 2012 tdd_cassandra

Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsJelastic Multi-Cloud PaaS
 
MAVEN - Short documentation
MAVEN - Short documentationMAVEN - Short documentation
MAVEN - Short documentationHolasz Kati
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 featuresAngel Ruiz
 
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With JepsenDataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With JepsenDataStax Academy
 
Testing Cassandra Guarantees under Diverse Failure Modes with Jepsen
Testing Cassandra Guarantees under Diverse Failure Modes with JepsenTesting Cassandra Guarantees under Diverse Failure Modes with Jepsen
Testing Cassandra Guarantees under Diverse Failure Modes with Jepsenjkni
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in DjangoKevin Harvey
 
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...Eric Smalling
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Jelastic Multi-Cloud PaaS
 
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...Cωνσtantίnoς Giannoulis
 
Building and running cloud native cassandra
Building and running cloud native cassandraBuilding and running cloud native cassandra
Building and running cloud native cassandraVinay Kumar Chella
 
John Adams Puppet Camp 2010
John Adams Puppet Camp 2010John Adams Puppet Camp 2010
John Adams Puppet Camp 2010Puppet
 
Dev Environments: The Next Generation
Dev Environments: The Next GenerationDev Environments: The Next Generation
Dev Environments: The Next GenerationTravis Thieman
 
Introduction To Maven2
Introduction To Maven2Introduction To Maven2
Introduction To Maven2Shuji Watanabe
 
Zero to tested
Zero to testedZero to tested
Zero to testedMagenTys
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Introboyw165
 
Rspec Tips
Rspec TipsRspec Tips
Rspec Tipslionpeal
 
Security as Code: DOES15
Security as Code: DOES15Security as Code: DOES15
Security as Code: DOES15Ed Bellis
 
SELJE_Database_Unit_Testing_Slides.pdf
SELJE_Database_Unit_Testing_Slides.pdfSELJE_Database_Unit_Testing_Slides.pdf
SELJE_Database_Unit_Testing_Slides.pdfEric Selje
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 

Similar to Oscon 2012 tdd_cassandra (20)

Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
 
MAVEN - Short documentation
MAVEN - Short documentationMAVEN - Short documentation
MAVEN - Short documentation
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With JepsenDataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
 
Testing Cassandra Guarantees under Diverse Failure Modes with Jepsen
Testing Cassandra Guarantees under Diverse Failure Modes with JepsenTesting Cassandra Guarantees under Diverse Failure Modes with Jepsen
Testing Cassandra Guarantees under Diverse Failure Modes with Jepsen
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
 
JEEconf 2017
JEEconf 2017JEEconf 2017
JEEconf 2017
 
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
 
Building and running cloud native cassandra
Building and running cloud native cassandraBuilding and running cloud native cassandra
Building and running cloud native cassandra
 
John Adams Puppet Camp 2010
John Adams Puppet Camp 2010John Adams Puppet Camp 2010
John Adams Puppet Camp 2010
 
Dev Environments: The Next Generation
Dev Environments: The Next GenerationDev Environments: The Next Generation
Dev Environments: The Next Generation
 
Introduction To Maven2
Introduction To Maven2Introduction To Maven2
Introduction To Maven2
 
Zero to tested
Zero to testedZero to tested
Zero to tested
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
 
Rspec Tips
Rspec TipsRspec Tips
Rspec Tips
 
Security as Code: DOES15
Security as Code: DOES15Security as Code: DOES15
Security as Code: DOES15
 
SELJE_Database_Unit_Testing_Slides.pdf
SELJE_Database_Unit_Testing_Slides.pdfSELJE_Database_Unit_Testing_Slides.pdf
SELJE_Database_Unit_Testing_Slides.pdf
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 

More from zznate

Hardening cassandra q2_2016
Hardening cassandra q2_2016Hardening cassandra q2_2016
Hardening cassandra q2_2016zznate
 
Seattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoiaSeattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoiazznate
 
Software Development with Apache Cassandra
Software Development with Apache CassandraSoftware Development with Apache Cassandra
Software Development with Apache Cassandrazznate
 
Hardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiaHardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiazznate
 
Stampede con 2014 cassandra in the real world
Stampede con 2014   cassandra in the real worldStampede con 2014   cassandra in the real world
Stampede con 2014 cassandra in the real worldzznate
 
Meetup cassandra for_java_cql
Meetup cassandra for_java_cqlMeetup cassandra for_java_cql
Meetup cassandra for_java_cqlzznate
 
Introduciton to Apache Cassandra for Java Developers (JavaOne)
Introduciton to Apache Cassandra for Java Developers (JavaOne)Introduciton to Apache Cassandra for Java Developers (JavaOne)
Introduciton to Apache Cassandra for Java Developers (JavaOne)zznate
 

More from zznate (7)

Hardening cassandra q2_2016
Hardening cassandra q2_2016Hardening cassandra q2_2016
Hardening cassandra q2_2016
 
Seattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoiaSeattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoia
 
Software Development with Apache Cassandra
Software Development with Apache CassandraSoftware Development with Apache Cassandra
Software Development with Apache Cassandra
 
Hardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiaHardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoia
 
Stampede con 2014 cassandra in the real world
Stampede con 2014   cassandra in the real worldStampede con 2014   cassandra in the real world
Stampede con 2014 cassandra in the real world
 
Meetup cassandra for_java_cql
Meetup cassandra for_java_cqlMeetup cassandra for_java_cql
Meetup cassandra for_java_cql
 
Introduciton to Apache Cassandra for Java Developers (JavaOne)
Introduciton to Apache Cassandra for Java Developers (JavaOne)Introduciton to Apache Cassandra for Java Developers (JavaOne)
Introduciton to Apache Cassandra for Java Developers (JavaOne)
 

Recently uploaded

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"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
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
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
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
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
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"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
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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.
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
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!
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
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
 

Oscon 2012 tdd_cassandra

Editor's Notes

  1. \n
  2. I’m Nate McCall, I’m platform development lead for the usergrid product at Apigee\n
  3. I’m here to talk about just two things really...\n
  4. \n
  5. \n
  6. \n
  7. What is it? Well, by itself it can (and does) take up it’s own talk. But for a gross generalization, well start here.\n
  8. When we talk test driven devlopment, we are really talking about unit testing code. We’ll talk about integration testing too, since that’s really what we care about for our case, but we’ll treat them as separate for now\n
  9. Again, we don’t have much time, so I’m not going to go into this except to emphasize some of the core rules of unit testing. Another way to think about this is that unit testing is a method by which the smallest testable part of an application is validated. \n
  10. Basically we want tests to be: fast, Isolated, Repeatable , Self-Validated (in that it asserts a condition ) and Timely (which really means we write them first so they stay in sync with the code).\n
  11. For integration testing, we mean interfacing with external systems or processes really, to validate that components integrate correctly. pretty straight forward.\n
  12. Generally there are fewer of them and, ideally, we run them less often because they are far more expensive\n
  13. \n
  14. \n
  15. \n
  16. For us, and are requirements here, there are 2 problems with that\n
  17. Inherently makes it difficutlt to test locally. One of the things i really want to avoid is having developers needing to manage their own internal or external clusters of cassandra\n
  18. It’s a service. Thus it’s an integration test. \n
  19. To specific, here are some details.\n
  20. Every operation sends whats called a ConsistencyLevel - essentially the level of sfety of an op\n
  21. \n
  22. \n
  23. Writing for the key “P” then the primary node is down. The remaining replicas capture the a hint which will be “replayed” to the down node when it comes back. In a smaller cluster where a quorum is not possible, these operations would return an exception to the caller. Obviously this become difficult to test for\n\n\n
  24. So we’re here to talk about applying test driven development to apache cassandra. I’m going to do this in a way that’s a little different\n
  25. \n
  26. I’m doing it wrong. \n
  27. Here’s some output from a run of ‘mvn test’ on one module of the Usergrid codebase. Seems Typical. Tests ran, the passed, etc. But if we look a little closer...\n
  28. We see some serious ugly.\n
  29. I’ll be frank, that sucks.\n
  30. This \n
  31. \n
  32. \n
  33. \n
  34. The worst result of all of this is that you end up in this situation in order just to get things completed. \n
  35. If you do this, you will miss bugs. You will tie up cycles hunting down ‘blames’ on continous integration failures. The worst part about this is that it discourages test driven development in the first place. I’ve done this and it’s turned around to bite me.\n
  36. So we’re in this situation - how do we get out of it? Taking this to the suits and trying to get time for it is extremely difficult.\n
  37. Say that at your next priority meeting\n
  38. This is a shockingly easy way to disquise a ton of refactoring work in “preparing for a conference”\n
  39. \n
  40. The first thing I needed to do was get a handle again on the test framework landscape without causing too much trauma to the code. \n
  41. There’s really two way to approach this other than EmbeddedCassandraHelper. These two have been around for a year and are relatively stable and track recent cassandra releases.\n
  42. \n
  43. I should know better. I really should. \n
  44. So let’s take a look at cassandra unit\n
  45. The benefits are pretty straight forward\n
  46. A couple of cons though. External instances is not going to work with one of my main requirements\n
  47. Now cassandra maven plugin. Precisely what it says on the tin really, it’s a maven plugin designed to control cassandra instances. \n
  48. Essentially, you can use maven to fork one or more cassandra instances in their own jvms. If you’ve never soon JVM forking in the wild, cassandra-maven-plugin is a decent example of using the commons-exec utility from the Apache Commons project\n
  49. Thats great, but there’s some things missing\n
  50. We need to speed up the test cycle so we dont throw the skipTest flag and miss bugs.\n
  51. There is some low hanging fruit to address here that could speed things up for utility and mock-based test cases. \n
  52. Basically things that are not integration tests. \nBy doing this, we can isolate those different requirements, inherently cutting time out of the test process.\n
  53. There are two primary plugins used for test integration with maven. One is designed for unit testing, the other for integration testing.\n
  54. If you get these confused your not alone. Who knows which is which?\n
  55. \n
  56. the names are not terribly descriptive. The documentation does not help much.\n
  57. Even better: here is the surefire page. Note the URL, as this next slide is not very different.\n
  58. Here is the failsafe page. Note the typos. They did manage one of out 3 find/replaces though. Note: I plan on submitting a patch to the site docs this evening to fix this. \n
  59. Basically. The failsafe plugin is for integration testing.\n
  60. Because failsafe is designed to continue after failures, here’s an easy way to remember that failsafe is for integration testing. \n
  61. \n
  62. Spend some time renaming to facilitate the Unit/integration test separation\n
  63. Once you do this, there are some additional tweaks to really boost performance on test designed along FIRST guidelines\n
  64. \n
  65. The easy stuff’s out of the way, and we’ve shave some time off - particularly for the utility code. What else can we do?\n
  66. Let’s look at our goals again... \n
  67. \n
  68. No. We can combine them.\n
  69. \n
  70. T\n
  71. \n
  72. Will see an example of this in a minute, but we need to attach a listener to the the build process to get this to fire off correct.\n
  73. Here we are binding failsafe to the integration and verify phase\n
  74. This configures our naming scheme - opposite of the surefire configuration - to run only the unit tests. We also have a regex on the bottom to exclude our RunListener from being invoked as a test case.\n
  75. \n
  76. Really straight forward. All configurations are handled by default for the simple cases, we only specify start and stop in order to bind to the integration and verify phases above.\n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n