'Behavior-Driven Development(BDD) Testing with Fast API python web framework

I want to write BDD test cases for the Fast API framework where I have written some REST API.

Though for normal test cases Fast API mentioned pytest package. Basic Code snippet for testing with pytest mentioned here also in their official documentation:- https://fastapi.tiangolo.com/tutorial/testing/#testing.

We have multiple testing frameworks For python BDD test cases. One such testing framework is Behave. But Behave as integration support for Flask and Django. I am struggling to figure out the testing framework that can best integrate with the FastAPI framework too.

I am new to FastAPI and any suggestions and help would be much appreciated.

Thanks in Advance.



Solution 1:[1]

Consider using pytest-bdd, it's a plugin for Pytest, since it's already integrated with pytest it works fine and naturally with FastAPI.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PedroDM