Continuous Integration, TDD &
Living Documentation with
Odoo
Colin Wren, Front end Dev & Dev Team Lead at Neova Health
@colinwren
colin@neovahealth.co.uk
Little about me
Work for Neova Health, based in London
Been working with Odoo for last 2 years
Using Odoo for Open-eObs, an electronic patient
observation platform
Odoo interests: Web Controllers, JavaScript and
Testing
Belgium is
awesome
“Obligatory Cat Picture”
“What is Continuous Integration?”
Continuous Integration
Merging development code frequently into the
codebase often to ensure it doesn’t break other
code in the codebase by running unit test and
integration test suites against newly merged code
Automated via a Continuous Integration Engine
such as Jenkins, Travis or Runbot which helps
alleviate the need to spend developer time to run
test suites
Ideal for generating Living Documentation
“What is Test Driven Development and
Behaviour Driven Development?”
Test/Behaviour Driven Development
Test Driven Development
Write tests first, implement later
Helps you to think about what the code needs to achieve and then implement
the functionality with that in mind
Behaviour Driven Development
Describe how features of the product work using business (or other) domain
language
Allows non-developers to write tests in their own domain language
Developers run tests using Given, When, Then to test the output of the
system when an event happens when the system is in a certain state
“What is Living Documentation?”
Living Documentation
A single document that client, business team &
development team use as a single point of scope
Acts as project definition, test suite and client
documentation
Is an evolving document which helps to catch breaking
scope changes or code changes over time
Helps business team understand impact of scope changes
on code base and vice versa
Tests what a feature does not how it does it
Living Documentation for Developers
Once scope for a feature is added it’s available for
client, business and development
This should prevent continual scope changes and
creep
As the document evolves the side effects of scope
changes to established features are easily evidenced
Test integration into documentation helps to show
how much of features have been implemented as
well history of tests
Living Documentation for Business
Use Living Documentation to negotiate scope with
clients and show them how changes will affect
product
Integration with test suite gives instant feedback on
what has been implemented and what hasn’t
Documentation is written as BDD tests are written
“How can this be applied to Odoo?”
Living Documentation with Odoo
Disclaimer: At time of writing pull request is still pending
Use Behave and ERPPeek to run tests (OERPScenario)
Business team push BDD feature files to repo
Development team push steps to same repo or different
one used as submodule in git
CI Engine listens to these repos and repos for product and
run Behave test suites to generate Living Documentation
and upload to webserver
“Demo - Creating a task”
Example Gherkin
Example Step Definition
Example Config File
Running Behave
http://gimpneek.github.io/odoo_living_documentation
_demo/living_doc/
HTML Output
“The Secret Sauce Source”
It’s a Behave Reporter
Behave exposes hooks for reporting plugins
As the tests run I collect information on features,
scenarios, steps & tags
After the tests have run I use this information to
match information in the config file and write the
webpages using Jinja2
“Find out more”
https://github.com/Gimpneek/odoo_living_documentatio
n_demo
http://specificationbyexample.com/

Continuous Integration, TDD & Living Documentation - Odoo Experience 2015

  • 1.
    Continuous Integration, TDD& Living Documentation with Odoo Colin Wren, Front end Dev & Dev Team Lead at Neova Health @colinwren colin@neovahealth.co.uk
  • 2.
    Little about me Workfor Neova Health, based in London Been working with Odoo for last 2 years Using Odoo for Open-eObs, an electronic patient observation platform Odoo interests: Web Controllers, JavaScript and Testing
  • 3.
  • 4.
  • 6.
    “What is ContinuousIntegration?”
  • 7.
    Continuous Integration Merging developmentcode frequently into the codebase often to ensure it doesn’t break other code in the codebase by running unit test and integration test suites against newly merged code Automated via a Continuous Integration Engine such as Jenkins, Travis or Runbot which helps alleviate the need to spend developer time to run test suites Ideal for generating Living Documentation
  • 8.
    “What is TestDriven Development and Behaviour Driven Development?”
  • 9.
    Test/Behaviour Driven Development TestDriven Development Write tests first, implement later Helps you to think about what the code needs to achieve and then implement the functionality with that in mind Behaviour Driven Development Describe how features of the product work using business (or other) domain language Allows non-developers to write tests in their own domain language Developers run tests using Given, When, Then to test the output of the system when an event happens when the system is in a certain state
  • 10.
    “What is LivingDocumentation?”
  • 11.
    Living Documentation A singledocument that client, business team & development team use as a single point of scope Acts as project definition, test suite and client documentation Is an evolving document which helps to catch breaking scope changes or code changes over time Helps business team understand impact of scope changes on code base and vice versa Tests what a feature does not how it does it
  • 12.
    Living Documentation forDevelopers Once scope for a feature is added it’s available for client, business and development This should prevent continual scope changes and creep As the document evolves the side effects of scope changes to established features are easily evidenced Test integration into documentation helps to show how much of features have been implemented as well history of tests
  • 13.
    Living Documentation forBusiness Use Living Documentation to negotiate scope with clients and show them how changes will affect product Integration with test suite gives instant feedback on what has been implemented and what hasn’t Documentation is written as BDD tests are written
  • 14.
    “How can thisbe applied to Odoo?”
  • 15.
    Living Documentation withOdoo Disclaimer: At time of writing pull request is still pending Use Behave and ERPPeek to run tests (OERPScenario) Business team push BDD feature files to repo Development team push steps to same repo or different one used as submodule in git CI Engine listens to these repos and repos for product and run Behave test suites to generate Living Documentation and upload to webserver
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
    It’s a BehaveReporter Behave exposes hooks for reporting plugins As the tests run I collect information on features, scenarios, steps & tags After the tests have run I use this information to match information in the config file and write the webpages using Jinja2
  • 24.