Uma Ghotikar talks about “Fundamentals of Unit Testing, BDD and Mocking (using TestBox and MockBox)” in this episode of ColdFusion Alive podcast with host Michaela Light.
Show notes
What is unit testing?
Test small piece of functionality
Low level, small scope, a method, a function, a clause
Why do unit testing
To validate every part of the app whether the UI is ready or not
Easier to know where the bug is located
Faster to run than general user tests, more thorough test coverage of all use cases, easy to automate
Can write tests before you code
So know where your code needs to raise an error
Guidelines to write unit tests
Fast for immediate feedback (milliseconds) during refactoring and coding
Avoid database, file system, http and API calls - mock them instead
Modular - so can reuse the test
Independent of other unit tests
Robust - work the same independent of time of day etc
Keep them up to date
Clear defined purpose - one piece of functionality
Clear pre-conditions, actions and expected outcomes
When you code make sure you can get the test to fail first before you write code to make it pass
Reactive programming
Most tests are of code in the Model part of MC
Why do you like xUnit and BDD styles of testing?
TDD focuses on testing your low level functions and methods
Tedious to write all these tests
BDD checks you satisfy your customer requirements at high level
User story and scenario
What is TestBox?
Open Source
The Given – When – Then syntax
BDD syntax and xUnit
The general structure for writing unit tests.
Set up, Tear down phrases
What is mocking?
Why do you like MockBox
Open source
What is BDD and why do you like it
High level
CI
How do TestBox and MockBox work together for BDD
Why are you proud to use CF?
WWIT to make CF more alive this year?
What are you looking forward to at Into The Box?
Mentioned in this episode
TDD = Test Driven Development
BDD = Behavior Driven Development
xUnit
TestBox
CFML slack test channel
MockBox
Session Description:
Topic:
Intro to Unit Testing, BDD and Mocking using TestBox & MockBox
This session will cover the basics such as what is unit testing, why to do unit testing and guidelines to write the unit tests. It will then cover xUnit and BDD styles of testing in TestBox, Given – When – Then syntax and the general structure for writing unit tests. We will then look into the mocking and demo examples of unit testing using TestBox & MockBox.
Listen to the Audio
Bio
Uma Ghotikar
Uma Ghotikar has more than 6 years of experience in web application development, database design and development. She has a technical educational background. She did Master of Science in Information Systems from George Mason University, USA and Bachelor of Engineering in Information Technology from University of Mumbai, India. She enjoys coding especially the back-end development and learning new technical skills.
Links
LinkedIn
Interview transcript
Michaela 0:00
Welcome back to the show. And today we're looking at the fundamentals of unit testing, be DD, which is behavior driven development and mocking and using test box and Dropbox, do that, and I'm here with Alma Gattaca. And if you don't know her, she is a cold fusion developer been doing it CFL on cold fusion for six years now. And she is giving a talk on this topic at into the box. So we will cover what is unit testing and why everyone listening should be doing it. And guidelines for writing great unit tests. And then also we'll look in detail at test box. And what it lets you do and how to structure unit tests using it will look at what marketing is and how to do that using mock box and why you want to do that. And we'll also look at behavior driven development or BDD and why you s...