TESTING TESTING EVERYWHEREKEV MCCABE
14TH MAY 2014
CF OBJECTIVE 2014
http://nud.gr/QIZntJ
http://nud.gr/QIZntJ
INTRODUCTION
http://nud.gr/QIZntJ
SLIDES LINK
http://nud.gr/QIZntJ
http://nud.gr/QIZntJ
TESTING PYRAMID
Exploratory
Acceptance*
Integration*
Unit Tests*
* Automated Tests
http://nud.gr/QIZntJ
INVERTED TESTING PYRAMID
Exploratory
Acceptance*
Integration*
Unit Tests*
* Automated Tests
http://nud.gr/QIZntJ
AUTOMATED TESTS
Comment from my Unit Testing Session @ CF Summit:
This one I liked the least. Seems like overkill to write 10 times more code just to test one tiny piece of the
application. I can understand how it would be helpful for large teams where the work is split
among multiple developers, but for a small team and a rapid dev cycle, this just seems like unnecessary
overhead. I wasn't convinced of the real-world applicability.
If this was you I hope I can convince you
http://nud.gr/QIZntJ
YOUR APPLICATION STACK
HTML
JavaScript
CFML
Database
http://nud.gr/QIZntJ
AUTOMATION
CFML Code
• Beans• Services• Handlers
JavaScript
• Plain Javascript• jQuery• AngularJS etc
Database
UI
http://nud.gr/QIZntJ
DATABASE TESTING
To be honest – not found a good one
So test using TestBox
This is actually good!
You need a DB Instance just for this.
So you can tear it down and refresh as needed
http://nud.gr/QIZntJ
CFML
Testing of Beans
• Make sure they hold the data you intended• Have any special functions?
Services
• SRP• Right calls
Handlers
• If using a MVC framework make sure it’s doing what you wanted
http://nud.gr/QIZntJ
JAVASCRIPT
Yes you can test your JavaScript
Test Plain JavaScript
jQuery calls
AngularJS applications
http://nud.gr/QIZntJ
FULL INTEGRATION TESTS
Testing in different browsers
Create a Framework
Make it interesting for the business
• They will really care about this level!• Once you show them it working
http://nud.gr/QIZntJ
TESTING TYPES
TDD
POUT
BDD
Automated
Exploratory
http://nud.gr/QIZntJ
TDDWhy do we do TDD? We do TDD for one overriding reason and several less important reasons. The less important reasons are:
• We spend less time debugging.
• The tests act as accurate, precise, and unambiguous documentation at the lowest level of the system.
• Writing tests first requires decoupling that other testing strategies do not; and we believe that such decoupling is beneficial.
Those are ancillary benefits of TDD; and they are debatable. There is, however, one benefit that, given certain conditions are met, cannot be debated:Robert “Uncle Bob” Martin http://blog.8thlight.com/uncle-bob/2014/04/25/MonogamousTDD.html
http://nud.gr/QIZntJ
TDD
If you have a test suite that you trust so much that you are willing to deploy the system based solely on those tests passing; and if that test suite can be executed in seconds, or minutes, then you can quickly and easily clean the code without fear.
Robert “Uncle Bob” Martin http://blog.8thlight.com/uncle-bob/2014/04/25/MonogamousTDD.html
http://nud.gr/QIZntJ
http://nud.gr/QIZntJ
http://nud.gr/QIZntJ
OTHER SESSIONS @ CF OBJECTIVEThursday @ 10:15am Stop Making Excuses And Start Testing Your JavaScript! - Ryan Anklam
Thursday @ 11:30am BDD - Change the way you code - Luis Majano
Thursday @ 4:15pm Updating/Hotfixing ColdFusion 10, 9 and 8: Tips and Traps - Charlie Arehart
Friday @ 11:30am Leveling-Up at Javascript: Organization, Performance & Testing - Raymond Camden
Friday @ 1:45pm Real World Selenium Testing - Mary Jo Sminkey
http://nud.gr/QIZntJ
THANK YOU & QUESTIONS?
http://nud.gr/QIZntJ
SLIDES LINK
http://nud.gr/QIZntJ
http://nud.gr/QIZntJ
ABOUT ME
Software Craftsmanship Mentor @ General Electric
• ColdFusion since 1996 (v2)
• London CFML & Web Community Leader
• Scrum Master
• Kanban Practitioner
• Agile Coach
T: @bigmadkev
W: BigMadKev.com
Top Related