TIL

항해99_TIL220727 (Jmeter 스프링 적용, Json 형식 보내기)

Hyeongjun_Ham 2022. 7. 27. 18:12

1. JMeter 설치

http://jmeter.apache.org/ 사이트에 접속

 

Apache JMeter - Apache JMeter™

Apache JMeter™ The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to oth

jmeter.apache.org

 

Download Releases -> Binaries 다운로드

(윈도우의 경우 zip으로 다운로드)

 

2. JMeter 플러그인 설치 (생략 가능)

Response Times Over Time : 각 샘플러에 대해 ms 단위의 평균 응답 시간을 표시한다.

https://jmeter-plugins.org/wiki/ResponseTimesOverTime/

 

Documentation :: JMeter-Plugins.org

Response Times Over Time Download From all the tutorials floating around in the net on how to get response times graphs from JMeter log files it is clear that this feature is missing to a lot of JMeter users. Well, this is history now, as the Response Time

jmeter-plugins.org

 

 

Concurrency Thread Group : 쓰레드 그룹 커스텀

https://jmeter-plugins.org/wiki/ConcurrencyThreadGroup/

 

Documentation :: JMeter-Plugins.org

Concurrency Thread Group Download Authorship This plugin was implemented by BlazeMeter Inc. and then contributed to community as Open Source. Description This thread group offers simplified approach for configuring threads schedule. It is intended to maint

jmeter-plugins.org

 

링크를 통해 파일을 다운받는다.

lib안의 jar 파일은 Jmeter 설치 파일의 lib 폴더에 넣고, ext 폴더 안에 jar 파일은 Jmeter lib\ext 폴더 안에 넣는다.

 

3. JMeter 실행 및 설정

JMeter bin 디렉토리 안에 jmeter.bat 을 실행

Test Plan - Add - Threads(Users) - Thread Group 추가

 

이후 Thread Group에서 다음의 항목들 추가

 

  • Sampler -> Http Request
  • Config Element-> HTTP Header Manager
  • Listener -> Summary Report
  • Listener -> View Results Tree
  • Listener -> Response Times Over Time
  • Listener -> Transactions per Second

(플러그인 설치 안한 경우 없는 것도 있음)

 

Json 형식의 데이터를 보내는 api 테스트를 해보자

- Thread Group 설정

 

- HTTP Request 설정

Json 파일로 보내려면 Body Data에 Json형식의 데이터를 넣는다.

 

- HTTP Header Manager 설정

Add로 추가 가능하다.

Content-type을 application/json으로 한다.

 

현재 테스트하려는 api는 로그인한 유저만 가능하기 때문에 토큰까지 넣어준 모습이다.

(회원가입, 로그인 부분은 포스트맨으로 넣고 토큰도 거기서 받아왔다.)

 

이후 Listener로 추가한 항목에서 테스트 결과를 확인 할 수 있다.