166 lines
4.7 KiB
JSON
166 lines
4.7 KiB
JSON
{
|
|
"$schema": "flow-tester-schema.json",
|
|
"name": "분기 테스트 플로우 예시",
|
|
"description": "Flow Tester의 조건 분기 기능을 보여주는 예시 플로우입니다. 로그인 성공/실패에 따른 분기, 권한에 따른 분기, 조건부 의존성 등을 테스트합니다.",
|
|
"version": "1.0.0",
|
|
"author": "SAM Team",
|
|
"category": "examples",
|
|
"tags": ["branching", "condition", "if-else", "example"],
|
|
"config": {
|
|
"baseUrl": "",
|
|
"timeout": 30000,
|
|
"stopOnFailure": false
|
|
},
|
|
"variables": {
|
|
"user_id": "{{$env.FLOW_TESTER_USER_ID}}",
|
|
"user_pwd": "{{$env.FLOW_TESTER_USER_PWD}}"
|
|
},
|
|
"steps": [
|
|
{
|
|
"id": "login",
|
|
"name": "1. 로그인 시도",
|
|
"description": "사용자 인증을 시도합니다",
|
|
"method": "POST",
|
|
"endpoint": "/api/v1/login",
|
|
"body": {
|
|
"user_id": "{{variables.user_id}}",
|
|
"user_pwd": "{{variables.user_pwd}}"
|
|
},
|
|
"expect": {
|
|
"status": [200, 401]
|
|
},
|
|
"extract": {
|
|
"token": "$.access_token",
|
|
"role": "$.user.role",
|
|
"permissions": "$.user.permissions"
|
|
},
|
|
"continueOnFailure": true
|
|
},
|
|
|
|
{
|
|
"id": "login_success_path",
|
|
"name": "2-A. 로그인 성공 처리",
|
|
"description": "로그인이 성공했을 때만 실행됩니다",
|
|
"condition": {"stepResult": "login", "is": "success"},
|
|
"dependsOn": ["login"],
|
|
"method": "GET",
|
|
"endpoint": "/api/v1/users/me",
|
|
"headers": {
|
|
"Authorization": "Bearer {{login.token}}"
|
|
},
|
|
"expect": {
|
|
"status": [200]
|
|
}
|
|
},
|
|
|
|
{
|
|
"id": "login_failure_path",
|
|
"name": "2-B. 로그인 실패 처리",
|
|
"description": "로그인이 실패했을 때만 실행됩니다",
|
|
"condition": {"stepResult": "login", "is": "failure"},
|
|
"dependsOn": [{"step": "login", "onlyIf": "any"}],
|
|
"method": "POST",
|
|
"endpoint": "/api/v1/auth/password-reset-request",
|
|
"body": {
|
|
"email": "{{variables.user_id}}"
|
|
},
|
|
"expect": {
|
|
"status": [200, 404]
|
|
},
|
|
"continueOnFailure": true
|
|
},
|
|
|
|
{
|
|
"id": "admin_dashboard",
|
|
"name": "3-A. 관리자 대시보드",
|
|
"description": "관리자 권한이 있을 때만 실행됩니다",
|
|
"condition": "{{login.role}} == 'admin'",
|
|
"dependsOn": ["login_success_path"],
|
|
"method": "GET",
|
|
"endpoint": "/api/v1/admin/dashboard",
|
|
"headers": {
|
|
"Authorization": "Bearer {{login.token}}"
|
|
},
|
|
"expect": {
|
|
"status": [200]
|
|
}
|
|
},
|
|
|
|
{
|
|
"id": "user_dashboard",
|
|
"name": "3-B. 일반 사용자 대시보드",
|
|
"description": "일반 사용자 권한일 때만 실행됩니다",
|
|
"condition": "{{login.role}} == 'user'",
|
|
"dependsOn": ["login_success_path"],
|
|
"method": "GET",
|
|
"endpoint": "/api/v1/user/dashboard",
|
|
"headers": {
|
|
"Authorization": "Bearer {{login.token}}"
|
|
},
|
|
"expect": {
|
|
"status": [200]
|
|
}
|
|
},
|
|
|
|
{
|
|
"id": "premium_features",
|
|
"name": "3-C. 프리미엄 기능",
|
|
"description": "프리미엄 권한이 있을 때만 실행됩니다",
|
|
"condition": {
|
|
"and": [
|
|
{"stepResult": "login", "is": "success"},
|
|
{"left": "{{login.permissions}}", "op": "contains", "right": "premium"}
|
|
]
|
|
},
|
|
"dependsOn": ["login_success_path"],
|
|
"method": "GET",
|
|
"endpoint": "/api/v1/premium/features",
|
|
"headers": {
|
|
"Authorization": "Bearer {{login.token}}"
|
|
},
|
|
"expect": {
|
|
"status": [200]
|
|
}
|
|
},
|
|
|
|
{
|
|
"id": "create_report",
|
|
"name": "4. 리포트 생성 (관리자만)",
|
|
"description": "관리자만 리포트를 생성할 수 있습니다",
|
|
"condition": {"stepResult": "admin_dashboard", "is": "success"},
|
|
"dependsOn": [{"step": "admin_dashboard", "onlyIf": "executed"}],
|
|
"method": "POST",
|
|
"endpoint": "/api/v1/admin/reports",
|
|
"headers": {
|
|
"Authorization": "Bearer {{login.token}}"
|
|
},
|
|
"body": {
|
|
"type": "daily",
|
|
"date": "{{$faker.date}}"
|
|
},
|
|
"expect": {
|
|
"status": [201]
|
|
}
|
|
},
|
|
|
|
{
|
|
"id": "cleanup_always",
|
|
"name": "5. 정리 작업 (항상 실행)",
|
|
"description": "성공/실패와 무관하게 항상 실행되는 정리 작업입니다",
|
|
"dependsOn": [
|
|
{"step": "login", "onlyIf": "any"},
|
|
{"step": "admin_dashboard", "onlyIf": "any"},
|
|
{"step": "user_dashboard", "onlyIf": "any"}
|
|
],
|
|
"method": "POST",
|
|
"endpoint": "/api/v1/logout",
|
|
"headers": {
|
|
"Authorization": "Bearer {{login.token}}"
|
|
},
|
|
"expect": {
|
|
"status": [200, 401]
|
|
},
|
|
"continueOnFailure": true
|
|
}
|
|
]
|
|
} |