nestorsalceda / mamba

The definitive testing tool for Python. Born under the banner of Behavior Driven Development (BDD).
http://nestorsalceda.github.io/mamba
MIT License
522 stars 64 forks source link

Parameterized specs #106

Open andrewminer opened 6 years ago

andrewminer commented 6 years ago

In other BDD frameworks (e.g., mocha), one is able wrap the declaration of individual tests inside a loop so that each pass through the loop adds another set of tests. One example I've used is to walk through a whole set of classes ensuring they each obey some invariant of their common parent class. Another example is a library I've written which can have multiple implementations, but which should offer the same interface no matter what implementation it's using.

for Subclass in [SubclassAlpha, SubclassBravo, SubclassCharlie]:
    with description(f"using {subclass.__name__}:"):
        # add tests which create an instance of Subclass and test it
nestorsalceda commented 6 years ago

It's a good feature to think about.

Let me consider some implementation details.

Thanks!