SkywardAI / chat-backend

Backend for the AI-copilot
https://skywardai.github.io/skywardai.io/
Apache License 2.0
3 stars 6 forks source link

[quanlity]: Add mock suit test framework #90

Open Aisuko opened 2 months ago

Aisuko commented 2 months ago

As the process of development, we add vector db and others. It is hard for us to do the real test cases in CI. So, we need to add mock API behaviour test cases rather than trying to start the real instance.

Aisuko commented 1 month ago

Hi @Micost @jinronga guys. We need a mock test framework for FastAPI. It can enhance the confidence when we maintain the repo. E.g: merge the PR. Please keep in mind. Thank you.

For this task, I think we can do some research first. And then share some simple examples with the folks. The community call document is a good place for everyone. https://docs.google.com/document/d/1gsNNkQ5hFLBttZ4pSf01VHpF5K89Usl1yscr1J0afcc/edit?usp=sharing

CarterFaceySmith commented 1 month ago

@Aisuko is this not encompassed in existing pytest testing framework? It seems maybe expanding that from the backend/tests subfolder may be a good idea, or do we need something more?

Micost commented 1 month ago

@Aisuko @CarterFaceySmith I add this issue into milestone 0.1.8 , I think pytest is a good choice . It covers the unit test and end-to-end test.

Aisuko commented 1 month ago

Hi guys. We already have some test cases with Pytest framework. However, these test cases are needed we have the whole components were deployed, like pgsql, vector db. We can't do that in the CI pipeline. It is un-efficiency(it will take 5-10 minutes every time, and we need to boost all the components).

What we want to do now is that we want to use mock API framework to mock the API behaviour. It is make sure that every APIs behaviour got checked before the PR got merged.

So, here is my thinking. Feel free to edit, remove or add the backend/tests folder.