Upgrade to Pro — share decks privately, control downloads, hide ads and more …

a quick look at webtest & pytest

a quick look at webtest & pytest

a short overview of webtest and pytest with real world examples of unit, integration and system tests

Jakub Jarosz

December 10, 2014
Tweet

More Decks by Jakub Jarosz

Other Decks in Programming

Transcript

  1. webtest & pytest a quick look at Python Ireland Meetup

    - December 2014 Jakub Jarosz @qba73
  2. webtest • test webapp without HTTP srv • full stack

    functional / integration testing • does not replace unit tests!
  3. pytest - fixture scope • session • package • module

    • class • function Global fixtures Module fixtures
  4. pytest - using markers global fixture pytest marker py.test tests/

    -v -m “e2e” py.test tests/ -v -m “not e2e”
  5. pytest - parametrized fixtures • pytest automatically generates tests with

    given parameters. • It is a perfect solution for data driven tests with the same business logic.
  6. pytest - hooks project - myapp - tests - conftest.py

    - test_module1.py - test_module2.py • pytest_sessionstart() • pytest_sessionfinish() • pytest_runtestsetup() • pytest_runtest_teardown() • pytest_addoption()