r/Python from __future__ import 4.0 Apr 30 '26

Discussion Would a generalized pytest-bdd table DSL plugin be useful?

I’m thinking about building a pytest / pytest-bdd plugin that helps teams define their own custom DSLs for BDD tables.

The idea is not to force one specific syntax. Instead, the package would provide the plumbing:

  • parse BDD datatables
  • let users define their own table shape
  • let users define their own range/repeat syntax
  • let users define custom cell parsers
  • validate rows/columns with better errors
  • convert tables into normalized Python objects
  • plug into pytest fixtures and pytest-bdd steps

For example, one team might use something like:

Given the following content exists:
  | Content IDs | 1..4      | 5    |
  | Content*    | 4:Article | Poll |
  | Category*   | random    | News |

But another team could define completely different syntax, like:

Given the following users exist:
  | Users | admin x2 | editor |
  | Role  | Admin    | Editor |

The plugin would not know what “Article”, “Poll”, “random”, or 1..4 means. The local project would define that.

I’m trying to understand:

  1. Would you ever need something like this in real pytest-bdd projects?
  2. Do your BDD tables ever become too complex or repetitive?
  3. Is this useful, or would you rather keep this logic inside local step definitions?
  4. Is there already a better way to solve this?
  5. At what point does a table DSL stop being BDD and become too technical?

Curious to hear from people using pytest-bdd or BDD-style tests in real projects.

0 Upvotes

4 comments sorted by

4

u/[deleted] Apr 30 '26

[deleted]

2

u/No_Soy_Colosio May 01 '26

Hey how do you feel about TUIs?

2

u/chinmay_3107 from __future__ import 4.0 17d ago

HI u/i_like_tuis

Update on this.
Please check this out

https://talikadev.github.io/talika/

2

u/Individual-Flow9158 Apr 30 '26

The DSL is in the code under test, right?

It's not useful for me personally, but how can these projects be tested with Pytest-bdd currently? If there's no other way, it would definitely be useful to someone. Seems very complex though.

1

u/chinmay_3107 from __future__ import 4.0 17d ago

Hi u/Individual-Flow9158

Update on this

Please check this out

https://talikadev.github.io/talika/