Test driven development (TDD) continues to grow in popularity as a development process that promotes diligence, oversight, and robust programming practices. In fact, in our recent Open Source Survey, nearly half of respondents stated that they used TDD as one of their core development processes. Whether for new or legacy projects, TDD is becoming increasingly critical to how large enterprises develop and maintain applications. This feedback coupled with requests from Python developers led to the inclusion of key TDD modules in our most recent release of ActivePython. (To learn more about the latest ActivePython releases, 2.7.12 & 3.5.2, check out this blog.)
In this webinar, Tom Radcliffe (ActiveState Director of Engineering) and Jeff Rouse (ActiveState Director of Product Management) discuss the emergence and importance of TDD, how it impacts Python developers, and what it means for enterprise programming. Some of the key topics they’ll cover include:
- What is TDD and how can it be implemented successfully
- Why is ActivePython well suited to TDD
- How can enterprises benefit from TDD
- And more!
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Test Driven Development with ActivePython
1. Jeff Rouse, Director of Product Management, ActiveState
Tom Radcliffe, Director of Engineering, ActiveState
Test Driven Development with
ActivePython
#APY2017
3. 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
5. Tests Before Code
> Don’t write a line of new code unless you first
have a failing automated test
> Eliminate duplication
Red: test fails
Green: test passes but code is a mess
Refactor: clean up that mess!
#APY2017
6. TTD Workflow
> Requirements [What]
> Specifications [How]
> “Design:”
> Automated test for a specification
> Code to pass
> Refactor
> Iterate
=> Small steps, organic design
#APY2017
8. 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
9. 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
10. 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
11. > Test Driven Development
was the most popular
methodology in our 2016
Open Source Languages
Survey
> 867 respondents
> 49% using TDD
#APY2017
13. 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
14. 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
15. 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
16. Unittest
> Part of Python standard library since Python 2.1
> Still under active development
#APY2017
17. 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
18. 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
19. Coverage
> Monitors test execution in real time
> Combined with tests tells you what code is
never tested
#APY2017
20. Other Testing Packages
> nose/nose2: test-runner
> pyresttest: testing REST APIs
> selenium: Web browser testing
> doctest: std. library, tests via code comments
#APY2017
21. Future of TDD
> Metaprogramming
> Improved language support
> Functional programming
> More automation/intelligence
#APY2017
24. Included Testing Modules
> Pytest
> Coverage
> Pyflakes
(+Unittest)
Plus many of the most popular Python developer
packages.
#APY2017
25. Enterprise ActivePython Benefits
> More reliable delivery
> Integrated OpenSSL +updates
> More maintainable code
> Commercial support/SLAs
> Compliance, indemnification
> Custom packages
> Language upgrades!
#APY2017
26. Developer ActivePython Benefits
> Turn-key installation
> Cross-platform support
> Extra “batteries included”
> All major language versions
> All major platforms
> Code recipes
> Thorough documentation
#APY2017
27. ActivePython Custom Packages
Promo!
Purchase ActivePython Enterprise Edition in February
2017 and receive custom packages for free.
Email us for more details
solutions@activestate.com
28. 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
29. 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
30. 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