- Test-Driven Machine Learning
- Justin Bozonier
- 391字
- 2021-07-30 10:20:00
Behavior-driven development
BDD is the addition of business concerns to the technical concerns more typical of TDD. This came about as people became more experienced with TDD. They started noticing some patterns in the challenges that they were facing. One especially influential person, Dan North, proposed some specific language and structure to ease some of these issues. The following are some of the issues he noticed:
- People had a hard time understanding what they should test next.
- Deciding what to name a test could be difficult.
- How much to test in a single test always seemed arbitrary.
Now that we have some context, we can define what exactly BDD is. Simply put, it's about writing our tests in such a way that they will tell us the kind of behavior change they affect. A good litmus test might be asking oneself if the test you are writing would be worth explaining to a business stakeholder. How this solves the previous problem may not be completely obvious, but it may help to illustrate what this looks like in practice. It follows a structure of "Given, When, Then". Committing to this style completely can require specific frameworks or a lot of testing ceremony. As a result, I loosely follow this in my tests, as you will see soon. Here's a concrete example of a test description written in this style: "Given an empty dataset when the classifier is trained, it should throw an invalid operation exception".
This sentence probably seems like a small enough unit of work to tackle, but notice that it's also a piece of work that any business user who is familiar with the domain that you're working in, would understand and have an opinion on.
You can read more about Dan North's point of view in this article on his website at http://dannorth.net/introducing-bdd/.
The BDD adherents tend to use specialized tools to make the language and test result reports be as accessible to business stakeholders as possible. In my experience and from my discussions with others, this extra elegance is typically used so little that it doesn't seem worthwhile. The approach you will learn in this book will take a simplified first approach to make it as easy as possible for someone with zero background to get up to speed.
With this in mind, let's work through an example.
- OpenStack Cloud Computing Cookbook(Third Edition)
- CKA/CKAD應試教程:從Docker到Kubernetes完全攻略
- PySide GUI Application Development(Second Edition)
- Python數據挖掘與機器學習實戰
- Oracle從入門到精通(第5版)
- Android底層接口與驅動開發技術詳解
- Learning OpenStack Networking(Neutron)
- Working with Odoo
- Web Development with MongoDB and Node(Third Edition)
- OpenResty完全開發指南:構建百萬級別并發的Web應用
- 創意UI:Photoshop玩轉APP設計
- 單片機原理及應用技術
- Flink技術內幕:架構設計與實現原理
- 深入解析Java編譯器:源碼剖析與實例詳解
- 數據庫基礎與應用實驗教程:Visual FoxPro 6.0