Session: Improving your automated testing with pytest

Schlagwörter:
, ,
Ort:
A05/A06
Dauer:
25. Juli 2014 10:00 - 13:00
Sprache:
Englisch
Zielgruppe:
Advanced

This is a hands-on course with lots of student activities. Bring your laptop with pytest pre-installed. The presentation parts are usually short and include real-life examples. Students will create or use own tests or real-life projects from the very beginning. Exercises are an important part of the training. Students are encouraged to bring their own problems to be discussed at the end of the course and, if there is interest, during the conference in an additional open space.

Many people learn testing through the JUnit/PYUnit paradigm. Lately, py.test's new fixture mechanisms have gained traction among many Pythonistas. This tutorial explores pytest and discusses key strategies how to benefit from using pytest for your existing unittest/nose based code bases.

  • (30 minutes) pytest feature walkthrough: automatic test discovery, assert statement, modular parametrizable fixtures, 50 plugins

  • (60 minutes) pytest fixture mechanism: dependency injection, declaring and using function/module/session scoped fixtures, using fixtures from fixture functions, parametrizing fixtures. Exercises.

  • (30 minutes): running nose/unittest/trial suites with pytest. Discussing advantages and limitations. Exercise with select existing real-life open source projects.

  • (30 minutes): Strategies for a) migrating to pytest b) using "autouse" fixtures in conjunction with XUnit-based setup/tearodwn methods. Exercise.

  • (30 minutes): open space for questions and interactively solving pytest/unittest integration problems on real-life problems as time permits.