Sync test suites from a file
You can keep the test cases of a test suite in a JSON or
YAML file next to your agent code. You then change test cases in the same pull request as the code, and
suite.sync makes the suite match the file before each run.
Write the file
The file has an items list, with the same item format as suite.insert. It can also set the
suite-level assertions and execution policy:
YAML files need pyyaml:
Sync the suite
Call suite.sync with the path to the file, for example at the start of your test run:
You can also pass a list of items, with global_assertions and global_execution_policy as arguments:
How changes are matched
sync matches the test cases of the suite and the file on their data:
- A test case with the same
datakeeps its id, so its experiment history continues. Its assertions, description and execution policy are updated if they changed. - A test case with new or changed
datais added as a new test case. - A test case that is no longer in the file is deleted.
All changes go into one new suite version, and no version is created when nothing changed. So you can call
sync before every run.