081 Assert Control Over Your Legacy Applications (TestBox Quick Start) with Ed Bartram

25/06/2018 47 min
081 Assert Control Over Your Legacy Applications (TestBox Quick Start) with Ed Bartram

Listen "081 Assert Control Over Your Legacy Applications (TestBox Quick Start) with Ed Bartram"

Episode Synopsis

Ed Bartam talks about "Assert Control Over Your Legacy Applications (TestBox Quick Start)" in this episode of ColdFusion Alive Podcast, with host Michaela Light. Show notes Why unit test? A unit is a method, function or small group of same Why do it? Refactoring is safer improving quality and reliability of their application Faster finding bugs when you change code Better deployment during your build process What is integration testing Testing logic vs testing external dependencies Functional tests with Selenium What TestBox? A test creation framework and scripting language Set up - before test suite is run Tear down - after test suite is run Before unit test is run After unit test is run Automated vs manual testing Good automated testing characteristics Repeatable Can be run at push of a button One test A suite of tests All unit tests Works with CI (eg Jenkins or Ant) so tests are run during your build process automatically Consistent test results independent of the environment (eg database) Full coverage of all code in the unit Independent of other tests - can be run in random order - no dependencies between tests Easy to detect if an error occurs and report on it so you can Test setup and tear down of dependencies TestBox does all the above Need to move code to methods or functions TestBox tips and best practices What tests to write How to name them Test_[method name]_[When to test]_[Expected enresult] How to write them When to write them TestBox color coding Tests that pass - Green Test that fail - Yellow Test that errors out - Red Result actions CI backout the deployment Slack Email Ring a bell via a Raspberry Pi Who broke the build gets to wear a special hat for rest the day Free open source Doesn't require ColdBox Paid support is available CFML slack testing channel Replaces mxUnit Mocking and MockBox Spies and Stubs too Blackbox unwritten code Design patterns What is a legacy application? Michael Feather book working effectively with legacy code Test Driven Development (TDD) Write a little bit of your test before your code Then write a little bit of code to pass the test Repeat Know as "Red-Green testing" How to install TestBox quickly in your existing environment CommandBox one line install of TestBox Or download and manually install How do we improve our code coverage then? which prescribes writing tests and then writing code to make those tests pass. Start with current bugs you are working on fixing First pull out the queries into methods and writer tests for them Second pull out logic into methods and write logic Could move to MVC - but not required CFMs = views and controller CFCs = model Why CFers resist writing tests Takes too long to writer Too hard to write tests Too late to write tests for existing code 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 Michael Feather book "Working Effectively with Legacy Code" TestBox Selenium ColdBox CI Jenkins Ant CFML slack testing channel MockBox Test Driven Development Red-Green Development CommandBox MVC Uma Ghotikar - Intro to Unit Testing, BDD and Mocking using TestBox & MockBox - ITB 2018 Bio Ed has been a ColdFusion developer since 2000, first using version 4.5. He is currently co-manager of the Chicagoland CFUG and previously co-managed the Nebraska CFUG in Omaha. While he has not spoken at a conference before, he has given several presentations to both groups. Ed has been a regular attendee of many conferences over the years including Devcon, Max, bFusion, CFObjective, Into the Box, and CF Summit. When he's not slinging code he likes to camp, hike, and work on his 1973 VW Beetle.   Links Twitter Ed Bartam website  

More episodes of the podcast ColdFusion Alive