G

gone

Presentation & example source of test driven development in BASH

Name Last Update
bin Loading commit data...
lib Loading commit data...
test Loading commit data...
README.org Loading commit data...
tdd-bash-ci-jenkins.png Loading commit data...

Test Driven Development in BASH

Why unit tests?

confirm

that you’ve actually fixed the bug

add

new features without breaking old

re-factor

with confidence

promotes

modular, de-coupled code

TDD makes

you think about the user

How a shell script starts

just

a few lines

and add some

variables

hang on

perhaps it takes a parameter

wait a minute

could it make eggs too?

of course

I want logging

and make sure

it runs as the correct user

Code structure

  • bin
  • lib
  • test

example - The add-two command

bin/add-two
lib/add-two-lib.sh
test/add-two-test.sh

xunit

write

your own

what’s out there

shunit2

  • assertEquals
  • assertFalse
  • assertNotEquals
  • assertNotNull
  • assertNotSame
  • assertNull
  • assertSame
  • assertTrue
  • fail
  • failNotEquals
  • failNotSame
  • failSame

Seeing is believing

CI on Jenkis

tdd-bash-ci-jenkins.png