Cf objective2014 testing-testingeverywhere

21
TESTING TESTING EVERYWHERE KEV MCCABE 14 TH MAY 2014 CF OBJECTIVE 2014 http://nud.gr/QIZntJ

description

 

Transcript of Cf objective2014 testing-testingeverywhere

Page 1: Cf objective2014   testing-testingeverywhere

TESTING TESTING EVERYWHEREKEV MCCABE

14TH MAY 2014

CF OBJECTIVE 2014

http://nud.gr/QIZntJ

Page 2: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

INTRODUCTION

Page 3: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

SLIDES LINK

http://nud.gr/QIZntJ

Page 4: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

TESTING PYRAMID

Exploratory

Acceptance*

Integration*

Unit Tests*

* Automated Tests

Page 5: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

INVERTED TESTING PYRAMID

Exploratory

Acceptance*

Integration*

Unit Tests*

* Automated Tests

Page 6: Cf objective2014   testing-testingeverywhere

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

Page 7: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

YOUR APPLICATION STACK

HTML

JavaScript

CFML

Database

Page 8: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

AUTOMATION

CFML Code

• Beans• Services• Handlers

JavaScript

• Plain Javascript• jQuery• AngularJS etc

Database

UI

Page 9: Cf objective2014   testing-testingeverywhere

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

Page 10: Cf objective2014   testing-testingeverywhere

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

Page 11: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

JAVASCRIPT

Yes you can test your JavaScript

Test Plain JavaScript

jQuery calls

AngularJS applications

Page 12: Cf objective2014   testing-testingeverywhere

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

Page 13: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

TESTING TYPES

TDD

POUT

BDD

Automated

Exploratory

Page 14: Cf objective2014   testing-testingeverywhere

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

Page 15: Cf objective2014   testing-testingeverywhere

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

Page 16: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

Page 17: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

Page 18: Cf objective2014   testing-testingeverywhere

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

Page 19: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

THANK YOU & QUESTIONS?

Page 20: Cf objective2014   testing-testingeverywhere

http://nud.gr/QIZntJ

SLIDES LINK

http://nud.gr/QIZntJ

Page 21: Cf objective2014   testing-testingeverywhere

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