EuroPython 2016

Test-driven code search and the art of writing implementation-agnostic tests

Speaker(s) Alessandro Amici

This is the hands-on counterpart of the regular talk “Test-driven code search and reuse coming to Python with pytest-nodev”, it is suggested to attend it first.

We will practice writing implementation-agnostic tests and using the test-driven reuse (TDR) development strategy, a natural extension of test-driven development (TDD), with pytest-nodev an Open Source test-driven search engine for Python code.

TDR aims to address the limits of usual keyword-based search by focusing on code behaviour and semantics instead. Developing a new feature in TDR starts with the developer writing the tests that will validate candidate implementations of the desired functionality. Before writing any functional code the tests are run against all functions and classes of all available projects. Any code passing the tests is presented to the developer as a candidate implementation for the feature.

Applications will include:

  • test-driven code search of auxiliary functions and classes
    • full code reuse by adding dependencies
    • full code reuse by forking code samples
    • partial code reuse by integrating features and identifying problem corner cases
  • test-suite validation, identification of weak tests
  • using implementation-agnostic tests to make regular test-suites more resilient to code refactoring.

in on Monday 18 July at 14:15 See schedule


  1. Gravatar
    Can you share a timeline, training contents and a draft of the slides?

    — Roberto Polli,
  2. Gravatar
    Tentative timeline:

    - 30min - hands-on introduction to test-driven code search with pytest-nodev

    - 30min - hands-on introduction to writing implementation-agnostic tests with nodev.specs

    - 45min - test-driven reuse best practices. How to search and how to best reuse code you find.

    - 45min - test-suite validation and learn how to use implementation-agnostic tests as your regular test

    - 30min - exercises: let's apply the technique to your use cases
    — Alessandro Amici,
  3. Gravatar
    Thx++. Hint: merge it in the abstract ;)

    — Roberto Polli,

New comment