pytest-dev / pytest-bdd

BDD library for the pytest runner
https://pytest-bdd.readthedocs.io/en/latest/
MIT License
1.31k stars 220 forks source link

Can @when, @given, @then etc. work with instance methods? #108

Closed sureshvv closed 9 years ago

sureshvv commented 9 years ago

Can we make a class implement a scenario? Then common steps can be in a base class.

Your docs don't explicitly say one way or the other.

bubenkoff commented 9 years ago

This was never tested, please try :) I suspect it needs some fixes to support class-based test suites But please be aware about what Guido said about classes: they are not namespaces! use modules for that.

bubenkoff commented 9 years ago

some insight of how the steps can be organized can be taken from http://developer.paylogic.com/articles/how-we-use-pytest-and-pytest-bdd-in-paylogic.html (see the bottom of the page)

bubenkoff commented 9 years ago

should we leave it open?

sureshvv commented 9 years ago

Modules seem to suffice for our use of pytest_bdd.