diff --git a/examples/custom.yaml b/examples/custom.yaml new file mode 100644 index 0000000..b4b4e91 --- /dev/null +++ b/examples/custom.yaml @@ -0,0 +1,48 @@ +name: "Test Authorization" +base_url: http://localhost:8080 +variables: + email: test@example.com + password: Test123! + +steps: + - name: "Register User" + request: + method: POST + url: /api/register + headers: + Content-Type: application/json + body: + email: "{{email}}" + password: "{{password}}" + extract: + - name: user_id + json_path: "$.id" + assert: + - type: status + value: 201 + + - name: "Login" + request: + method: POST + url: /api/login + headers: + Content-Type: application/json + body: + email: "{{email}}" + password: "{{password}}" + extract: + - name: token + json_path: "$.token" + assert: + - type: status + value: 200 + + - name: "Get Profile" + request: + method: GET + url: /api/profile + headers: + Authorization: "Bearer {{token}}" + assert: + - type: status + value: 200 diff --git a/examples/openapi.yaml b/examples/openapi.yaml new file mode 100644 index 0000000..7f202f5 --- /dev/null +++ b/examples/openapi.yaml @@ -0,0 +1,50 @@ +openapi: "3.0.0" +info: + title: "Test API" + version: "1.0.0" + +servers: + - url: http://localhost:8080 + +paths: + /api/login: + post: + operationId: "loginUser" + summary: "Login user" + requestBody: + content: + application/json: + schema: + type: object + properties: + email: + type: string + password: + type: string + responses: + "200": + description: "Success" + content: + application/json: + schema: + type: object + properties: + token: + type: string + + /api/profile: + get: + operationId: "getProfile" + summary: "Get user profile" + responses: + "200": + description: "Success" + content: + application/json: + schema: + type: object + properties: + id: + type: integer + email: + type: string diff --git a/examples/postman.yaml b/examples/postman.yaml new file mode 100644 index 0000000..6fbcde0 --- /dev/null +++ b/examples/postman.yaml @@ -0,0 +1,52 @@ +info: + name: "Test Collection" + schema: "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + +variable: + - key: base_url + value: http://localhost:8080 + - key: email + value: test@example.com + +item: + - name: "Login" + request: + method: POST + url: + raw: "{{base_url}}/api/login" + host: + - "{{base_url}}" + path: + - api + - login + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: '{"email": "{{email}}", "password": "Test123!"}' + event: + - listen: test + script: + exec: + - "pm.test('status is 200', function() { pm.response.to.have.status(200); });" + - "pm.environment.set('token', pm.response.json().token);" + + - name: "Get Profile" + request: + method: GET + url: + raw: "{{base_url}}/api/profile" + host: + - "{{base_url}}" + path: + - api + - profile + header: + - key: Authorization + value: "Bearer {{token}}" + event: + - listen: test + script: + exec: + - "pm.test('status is 200', function() { pm.response.to.have.status(200); });"