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

Viewed 475

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.

1 Answers

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

Related