JMeter로 테스트용 REST API 100개를 자동으로 테스트하고
결과를 파일로 저장해주는 과정입니다.
JMeter와 JMeter Plugin Manager 다운로드
아래 링크에서 JMeter와 Plugin Manager를 다운로드 해주도록 합니다.
Jdk 8 version 이상이여야 합니다.
Apache JMeter - Download Apache JMeter
Download Apache JMeter We recommend you use a mirror to download our release builds, but you must verify the integrity of the downloaded files using signatures downloaded from our main distribution directories. Recent releases (48 hours) may not yet be ava
jmeter.apache.org
Install :: JMeter-Plugins.org
Installing Plugins The easiest way to get the plugins is to install Plugins Manager. Then you'll be able to install any other plugins just by clicking a checkbox. If you experience any issues with plugins installation, don't hesitate to ask at Support Foru
jmeter-plugins.org
이후에 플러그인이 설치할게 있으면 JMeter 상단 메뉴중에 Options - Plugins Manager에서 검색해서 설치하시면 됩니다.
실행하기
JMeter의 실행은 bin/jmeter.bat을 실행해주시면 되고
Plugin Manager의 설치는 lib/ext에 설치하시면 됩니다.
TreadGroup : 여러 API들을 테스트할 묶음 단위
Sampler: 사용자의 행동을 대신해줌
Listener: 결과를 데이터나 그래프로 보여줌
테스트용 API
100개의 API로 GET 25개, POST 25개, PUT 25개, DELETE 25개로 이루어져있습니다.
응답은 status code 200만 json data로 넘겨주게 세팅했습니다.
사용할 도구들
Critical Section Controller : 테스트 목록을 묶어주는 역할을 합니다. 전체적인 결과도 내줍니다. ( 하나라도 틀리면 fail )
Sampler -> HttpRequest : REST API를 테스트 해주는 용도입니다.
https를 사용할 경우 아래 그림과 같이 protocol과 Port Number를 수정해서 사용하시면 됩니다.
Assertions -> Response Assertion : 응답코드나 헤더, body의 값이 예상 값과 일치하는지를 체크해줍니다.
아래와 같이 작성하면 "name": "apple"와 "message": "i'm banana get"과 일치하는 문장이 있는지를 확인해줍니다.
정상응답이지만 일치하지 않는경우 결과에 응답은 200이지만 fail이 뜨게 됩니다.
Listener -> View Results Tree
클릭하면 요청이나 응답에 대한 여러가지 값과 결과들을 확인할 수 있습니다.
Filename을 지정하면 결과를 따로 저장할 수 있습니다.
우측에 Configuration을 클릭하면 저장할 때 어떤 값들을 확인하고 싶은지 체크박스를 선택하시면 됩니다.
'Test' 카테고리의 다른 글
JMeter로 REST API 자동 테스트하기4 (0) | 2021.07.02 |
---|---|
JMeter로 REST API 자동 테스트 하기3 (0) | 2021.06.28 |
JMeter로 REST API 자동 테스트 하기2 (0) | 2021.06.24 |