pytest integration
When using python and pytest you can simply install the baserun
plugin and start testing immediately.
The plugin works by automatically collecting and aggregating all LLM and baserun logs during the course of a test and then uploading them to baserun to review and collaborate on with your team.
Setup
Automatically using Baserun in tests
You can automatically include the --baserun
option on every invocation of pytest
by creating or updating your pytest.ini
file with:
Running multiple tests
It’s often helpful to exercise the same test over multiple examples. To do this, we suggest using the parametrize decorator and for larger numbers of examples you can read from a file or other data structure.
Naming
Baserun lets you compare test results and debug each step side by side. We consider the name of the pytest function and its parameters as a unique identifier for the test. In the example above, two tests would be run and identified by (test_trip, "Paris", "Eiffel Tower")
and (test_trip, "Rome", "Colosseum")