Testing REST APIs easily in Python with pyhttptest

Testing REST APIs easily in Python with pyhttptest

Nowadays every one of us is facing REST APIs by either developing or consuming such a service. Also, we’re in the trendy era of microservices, where we splitting our business logic into small separate services independent from each one. Mostly these services follow RESTful principles and using the JSON format for communication, which became the most widely used format, because of its simplicity.

Tried running on MacOSX / Catalina and got the following:

Traceback (most recent call last):
File “/Users/xxx/miniconda3/bin/pyhttptest”, line 7, in
from pyhttptest.cli import main
File “/Users/xxx/miniconda3/lib/python3.6/site-packages/pyhttptest/cli.py”, line 3, in
from pyhttptest.wrappers import execute_test_scenarios
File “/Users/xxx/miniconda3/lib/python3.6/site-packages/pyhttptest/wrappers.py”, line 1, in
from pyhttptest import core
File “/Users/xxx/miniconda3/lib/python3.6/site-packages/pyhttptest/core.py”, line 3, in
import ijson.backends.yajl2 as ijson
File “/Users/xxx/miniconda3/lib/python3.6/site-packages/ijson/backends/yajl2.py”, line 12, in
yajl = backends.find_yajl_ctypes(2)
File “/Users/xxx/miniconda3/lib/python3.6/site-packages/ijson/backends/init.py”, line 36, in find_yajl_ctypes
raise YAJLImportError(‘YAJL shared object not found.’)
ijson.backends.YAJLImportError: YAJL shared object not found.

Hello @lincoln, thank you for reporting the issues, is it possible also to show your test cases definition from the .json file?

I get the same error using the test_server_status.json from your article. I’m using Python 3.6.7 on OS X 10.15.2 / Catalina.

I can see that its easy to send requests to different endpoints, but what exactly are you testing and why? That it returns a 200? What if the expected result is a 201/400/500/etc?

Can payloads be examined?

Can any data be staged, or is this just for idempotent services with pre-staged data?

Thanks