mirror of
https://github.com/LukasKanka/api_test.git
synced 2026-11-11 06:34:36 +01:00
- Add apiTest/JsonPlaceholder/opencollection.yml - Add Users/Get all users.yml (GET /users test) - Add Posts/Get post by ID.yml (GET /posts/1 test) - Add Posts/Create new post.yml (POST /posts test) - Update README.md with JsonPlaceholder reference Tests use public JSONPlaceholder API - no local backend required. Works in CI/CD pipeline automatically. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
41 lines
869 B
YAML
41 lines
869 B
YAML
info:
|
|
name: Get post by ID
|
|
type: http
|
|
seq: 1
|
|
|
|
http:
|
|
method: GET
|
|
url: https://jsonplaceholder.typicode.com/posts/1
|
|
auth: inherit
|
|
|
|
runtime:
|
|
scripts:
|
|
- type: tests
|
|
code: |-
|
|
const status = res.getStatus();
|
|
const body = res.getBody();
|
|
|
|
test("Status code is 200", function() {
|
|
expect(status).to.equal(200);
|
|
});
|
|
|
|
test("Response has id 1", function() {
|
|
expect(body.id).to.equal(1);
|
|
});
|
|
|
|
test("Response has title and body", function() {
|
|
expect(body).to.have.property('title');
|
|
expect(body).to.have.property('body');
|
|
});
|
|
|
|
test("Title is not empty", function() {
|
|
expect(body.title).to.not.be.empty;
|
|
});
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 10000
|
|
followRedirects: true
|
|
maxRedirects: 5
|
|
forwardAuthorizationHeader: true
|