test driven development with activepython
TRANSCRIPT
Jeff Rouse, Director of Product Management, ActiveStateTom Radcliffe, Director of Engineering, ActiveState
Test Driven Development with ActivePython
#APY2017
Today’s SpeakersJeff RouseDirector of Product Management ActiveState
Tom RadcliffeDirector of EngineeringActiveState
#APY2017
Agenda> What is Test Driven Development (TDD)?> How to successfully implement TDD> Why is ActivePython well suited to TDD?> How can enterprises benefit from TDD?> Q/A
#APY2017
What is TDD?
#APY2017
Tests Before Code> Don’t write a line of new code unless you
first have a failing automated test> Eliminate duplication
Red: test failsGreen: test passes but code is a messRefactor: clean up that mess!
#APY2017
TTD Workflow> Requirements [What]> Specifications [How]> “Design:”> Automated test for a specification> Code to pass> Refactor> Iterate
=> Small steps, organic design#APY2017
“Eliminate Duplication”
Every piece of information in an application should be represented exactly once.
#APY2017
Pros of TDD
#APY2017
> Brings dev closer to the user> Requirement questions found faster> Makes you trust your code> Make changes with confidence
> Fix bugs once> Easier to handle errors/bugs initially> Reduces bugs throughout the system
Cons of TDD> Larger code base> Stiffness (harder to change)> Test maintenance takes time> Easy to go too far (100% code
coverage?!)> Mocks, dependency injection,
complexity…> Not a replacement for integration tests #APY2017
More TDD Goodness> Know the finish line!> Increases team ownership - trust!> Tests supplement the docs> Makes onboarding new devs easier> Greater confidence in changes allows a
quicker release cadence (CD!)> More time spent delivering value
#APY2017
> Test Driven Development was the most popular methodology in our 2016 Open Source Languages Survey
> 867 respondents
> 49% using TDD
#APY2017
How to successfully implement TDD
#APY2017
Attitude + Automation> Must have committed attitude> Integrate testing with routine workflow> Automate everything> Metaprogramming
“Virtue is not an act, it is a habit” -- Aristotle on software
development best practices#APY2017
Things to Look Out For> Embedded assumptions> Overly narrow/concrete tests> Needs of testing taking over design> Layered algorithms vs inversion of
control> Sometimes the only way to understand
the problem is to write the code#APY2017
ActivePython & TDD> Careful with those types!> Strong language support for tests> Active communities around several
testing packages supporting a variety of testing needs & goals
#APY2017
Unittest> Part of Python standard library since
Python 2.1> Still under active development
#APY2017
Pytest> Most full featured and popular of third
party packages> Can run unittest and nose tests> Our recommended testing package> Great support for fixtures> Plugins for other frameworks (ex. Django,
Twisted, Pyflakes)#APY2017
Pyflakes> Code quality checks w/ your testing> Analyzes your source for errors> Low false positive rate> Does not check for style> Good speed> Can run from pytest
#APY2017
Coverage> Monitors test execution in real time> Combined with tests tells you what code
is never tested
#APY2017
Other Testing Packages> nose/nose2: test-runner> pyresttest: testing REST APIs> selenium: Web browser testing> doctest: std. library, tests via code
comments
#APY2017
Future of TDD> Metaprogramming> Improved language support> Functional programming> More automation/intelligence
#APY2017
ActivePoll:Do you currently or plan to employ TDD using Python?
#APY2017
Why is ActivePython well suited to TDD?
#APY2017
Included Testing Modules> Pytest> Coverage> Pyflakes(+Unittest)
Plus many of the most popular Python developer packages.
#APY2017
Enterprise ActivePython Benefits> More reliable delivery> Integrated OpenSSL +updates> More maintainable code> Commercial support/SLAs> Compliance, indemnification> Custom packages> Language upgrades!
#APY2017
Developer ActivePython Benefits> Turn-key installation> Cross-platform support> Extra “batteries included”> All major language versions> All major platforms> Code recipes> Thorough documentation
#APY2017
ActivePython Custom Packages Promo!
Purchase ActivePython Enterprise Edition in February 2017 and receive custom packages for
free.
Email us for more [email protected]
ActiveState News> ActivePython 2.7.13 & 3.5.2 released> Komodo IDE + ActivePython...together at
last!> Another ActivePython release later in Q1!> ActiveGo - also this quarter> ActiveRuby - releasing Q2> ActiveNode & ActiveLua arriving later in
2017#APY2017
Upcoming Events> Pycon 2017 - May 17-25 in Portland, OR> OSCON 2017 - May 8-11 in Austin, TX> Look for another ActivePython webinar in
Q2
New Language Distributions> Sign up for more
information:> www.activestate.com/Ruby> www.activestate.com/Go> www.activestate.com/Node> www.activestate.com/Lua
#APY2017
Q/ADownload ActivePython!activestate.com/activepython/downloads
Contact us if you have questions:[email protected]@[email protected]
© Copyright 2017
#APY2017