WEB

API 테스트 툴 - Artillery

foxlee 2022. 9. 6. 22:10

https://www.artillery.io/

 

Artillery.io | Load & Smoke Testing

Keep production reliable, customers happy, and pagers silent.

www.artillery.io

  • 기존에는 직접 API를 호출하는 스크립트를 작성했지만 정확하지 않다고 판단하여 테스트 툴을 알아보았다.

 

설치 방법

- npm install -g artillery@latest

- artillery run scenarios.yaml

./scenarios.yaml
config:
    target: 'http://localhost:3000'
    phases:
        - duration: 30 # 30초 동안 1초마다 1번 요청
          arrivalRate: 1
          name: Warm up
        - duration: 120 # 120초 동안 1초마다 5번 요청을 시작으로 점점 증가해서 50번 요청
          arrivalRate: 5
          rampTo: 50
          name: Ramp up load
        - duration: 600 # 10분동안 1초에 50개씩
          arrivalRate: 50
          name: Sustained load
scenarios:
    - name: 'get guide link'
      flow:
           - get:
                 url: '/endpoint1'

          - get:
                headers:
                    Content-Type: 'application/json'
                    Accept: application/json
                    Authorization: 'Bearer token~~~'
                url: '/endpoint2'