32
Test Driven Development and Puppet Jan & Johan

Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

Test Driven Developmentand

Puppet

Jan & Johan

Page 2: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

And We Are ? -> Johan

● Open Source Consultant @ open-future● Puppet addict ( and still learning ...)● Member Belgian Puppet User Group● A Sys-Admin ● A very poor developer (but working on it)

● Convinced that (automated) testing is important

● Email: [email protected]

Page 3: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

Why this talk ?

● We want to do it the 'good' way -> TDD● rspec-puppet.com – rspec for modules● ...● No docs found, any pointers ?● Looking at the puppet code to learn

Page 4: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

What is Test Driven Development

Source http://centricconsulting.com/agile-test-driven-development/

Page 5: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

Benefits of TDD

● Test case from the beginning● Tests are maintained during life cycle● Small moves – coding just to pass test● Encourage simple design● First step in test automation

Page 6: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

TDD does not

● Replace integration testing● Replace compliance testing● .......

Page 7: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

TDD for a sysadmin

● We have to learn developing● Huge mindshift ● Culture schift ● Rspec for modules is ok

– Writing modules is already adopted by sysadmin see Rspec-puppet.com => tutorial

● Rspec for type/providers– Still looking for docs

– Use the (puppet) source

Page 8: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing
Page 9: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

Filling the gap ...

● Initial attempt write Type using TDD● https://github.com/Open-Future-Belgium/pupp

et_rspec_demo● In need of help (i'm kind of stuck) ● Looking for input how to do it right● Hopefully it results in a good tutorial● ....

Page 10: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Type session

Page 11: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Type Session - spec

Page 12: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - test

Page 13: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - code

Page 14: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - test

Page 15: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - rspec

Page 16: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - test

Page 17: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - rspec

Page 18: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - Test

Page 19: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - Code

Page 20: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - test

Page 21: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - rspec

Page 22: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A simple TDD Session - test

Page 23: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD session - code

Page 24: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A simple TDD Session

● And we could go on ... forever

Page 25: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A simple TDD Session - rspec

Page 26: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - test

Page 27: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - code

Page 28: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

A Simple TDD Session - test

Page 29: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

Rspec books

Page 30: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing

More TDD

Page 31: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing
Page 32: Test Driven Development and Puppet Jan & Johan · 2014. 2. 26. · TDD for a sysadmin We have to learn developing Huge mindshift Culture schift Rspec for modules is ok – Writing