W H AT I TA L K A B O U T • factory_boy - is a fixtures replacement based tool • behave - uses tests written in a natural language style, backed up by Python code
A U D I T P L U S • Built using django. • First developed in May 2014 as a MVP. • Fully tested from the start. • Positive feedback lead to it becoming a full product.
W H AT I S W R O N G W I T H F I X T U R E S ? • Easy to create. ‘manage.py dumpdata’. • Hard to read. • Hard to update. • Signal gets lost in the noise over time.
W H Y WA S A U D I T F E E L I N G T H E PA I N ? • Institutional knowledge required to write tests. • Fixture file was getting too big and a pain to edit. • Tests were getting slow to run. • Tests were getting too much of a pain to write.
FA C T O RY _ B O Y • Can return default information. • Can override parameters if needed. • ‘Helper fields’ to aid in creating dynamic data. • This leads to a very potent testing framework.
– D A N N O R T H “BDD is a second-generation, outside–in, pull- based, multiple-stakeholder, multiple-scale, high- automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.”
– B E N N O R I C E “Behaviour testing allows you to test your application as a whole in such a way that all stakeholders can define and understand what is being tested.”
B D D ? • All stake holders (people that define, write and own the requirements) can understand what is being tested. • Much bigger avenue of agreement during the process. • Encourages thinking about the application in a natural, consistent language.
A L L O W E V E RY B O D Y T O W R I T E T E S T S • This is the ‘happy path’. • I have yet to see it happen. • I don’t think its necessarily a good thing to allow this.
R E Q U I R E M E N T S • Don’t define your tests from your requirements. • Then don’t define your application from your requirements. • You ‘just’ define your application from the tests. • And then tests ARE the requirements!
G O O D A N D T H E B A D • As a concept I think BDD is good if in concert with other practises. • Everyone writing tests is a pipe dream. • The tooling is awful but if you keep your tests stupid it makes it easier.