Junior — Middle
Do you create automated API interface tests?
sobes.tech AI
Answer from AI
Yes, I create automated API tests to ensure the stability and correctness of services. I usually use tools like Postman, REST Assured, or pytest with HTTP request libraries.
Here's a simple example of a Python test using requests and pytest:
import requests
def test_get_user():
response = requests.get('https://api.example.com/users/1')
assert response.status_code == 200
data = response.json()
assert 'id' in data and data['id'] == 1
Such tests can be run automatically within CI to quickly identify regressions and errors in the API.