test driven development with activepython

31
Jeff Rouse, Director of Product Management, ActiveState Tom Radcliffe, Director of Engineering, ActiveState Test Driven Development with ActivePython #APY2017

Upload: activestate

Post on 13-Apr-2017

148 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Test Driven Development with ActivePython

Jeff Rouse, Director of Product Management, ActiveStateTom Radcliffe, Director of Engineering, ActiveState

Test Driven Development with ActivePython

#APY2017

Page 2: Test Driven Development with ActivePython

Today’s SpeakersJeff RouseDirector of Product Management ActiveState

Tom RadcliffeDirector of EngineeringActiveState

#APY2017

Page 3: Test Driven Development with ActivePython

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

Page 4: Test Driven Development with ActivePython

What is TDD?

#APY2017

Page 5: Test Driven Development with ActivePython

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

Page 6: Test Driven Development with ActivePython

TTD Workflow> Requirements [What]> Specifications [How]> “Design:”> Automated test for a specification> Code to pass> Refactor> Iterate

=> Small steps, organic design#APY2017

Page 7: Test Driven Development with ActivePython

“Eliminate Duplication”

Every piece of information in an application should be represented exactly once.

#APY2017

Page 8: Test Driven Development with ActivePython

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

Page 9: Test Driven Development with ActivePython

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

Page 10: Test Driven Development with ActivePython

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

Page 11: Test Driven Development with ActivePython

> Test Driven Development was the most popular methodology in our 2016 Open Source Languages Survey

> 867 respondents

> 49% using TDD

#APY2017

Page 12: Test Driven Development with ActivePython

How to successfully implement TDD

#APY2017

Page 13: Test Driven Development with ActivePython

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

Page 14: Test Driven Development with ActivePython

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

Page 15: Test Driven Development with ActivePython

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

Page 16: Test Driven Development with ActivePython

Unittest> Part of Python standard library since

Python 2.1> Still under active development

#APY2017

Page 17: Test Driven Development with ActivePython

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

Page 18: Test Driven Development with ActivePython

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

Page 19: Test Driven Development with ActivePython

Coverage> Monitors test execution in real time> Combined with tests tells you what code

is never tested

#APY2017

Page 20: Test Driven Development with ActivePython

Other Testing Packages> nose/nose2: test-runner> pyresttest: testing REST APIs> selenium: Web browser testing> doctest: std. library, tests via code

comments

#APY2017

Page 21: Test Driven Development with ActivePython

Future of TDD> Metaprogramming> Improved language support> Functional programming> More automation/intelligence

#APY2017

Page 22: Test Driven Development with ActivePython

ActivePoll:Do you currently or plan to employ TDD using Python?

#APY2017

Page 23: Test Driven Development with ActivePython

Why is ActivePython well suited to TDD?

#APY2017

Page 24: Test Driven Development with ActivePython

Included Testing Modules> Pytest> Coverage> Pyflakes(+Unittest)

Plus many of the most popular Python developer packages.

#APY2017

Page 25: Test Driven Development with ActivePython

Enterprise ActivePython Benefits> More reliable delivery> Integrated OpenSSL +updates> More maintainable code> Commercial support/SLAs> Compliance, indemnification> Custom packages> Language upgrades!

#APY2017

Page 26: Test Driven Development with ActivePython

Developer ActivePython Benefits> Turn-key installation> Cross-platform support> Extra “batteries included”> All major language versions> All major platforms> Code recipes> Thorough documentation

#APY2017

Page 27: Test Driven Development with ActivePython

ActivePython Custom Packages Promo!

Purchase ActivePython Enterprise Edition in February 2017 and receive custom packages for

free.

Email us for more [email protected]

Page 28: Test Driven Development with ActivePython

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

Page 29: Test Driven Development with ActivePython

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

Page 30: Test Driven Development with ActivePython

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

Page 31: Test Driven Development with ActivePython

Q/ADownload ActivePython!activestate.com/activepython/downloads

Contact us if you have questions:[email protected]@[email protected]

© Copyright 2017

#APY2017