I am Python programmer, so I'd like to use Tavern for API testing.
It means writing a program (API test) in YAML.
Problem is, when I edit YAML input, it often breaks with error BadSchemaError. Tavern has pykwalify embedded, but error messages are not very helpful.
Often I get error message like this:
=================================================== test session starts =================================================== platform linux2 -- Python 2.7.5, pytest-4.5.0, py-1.8.0, pluggy-0.12.0 rootdir: /home/*****/tavern plugins: tavern-0.26.3 collected 0 items / 1 errors ========================================================= ERRORS ========================================================== _________________________________________ ERROR collecting test_echo.tavern.yaml __________________________________________ /usr/lib/python2.7/site-packages/tavern/testutils/pytesthook/file.py:306: in collect raise_from(exceptions.BadSchemaError, e) /usr/lib/python2.7/site-packages/future/utils/__init__.py:456: in raise_from raise e E BadSchemaError !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ================================================= 1 error in 0.13 seconds ======
Is there a better way to validate Tavern YAML syntax? Are some params to pykwalify/tavern/whatever to make error messages more helpful?
I found Tavern examples and cookbook which gives me some idea about the syntax, but writing my own YAML is hit and miss, and more miss than hit.
Edit: according to pykwalify docs, I could run pykwalify in CLI like:
pykwalify -d data.yaml -s schema.yaml
but where is located the YAML schema for tavern?