IT개발

JMeter Test Plan

환영전사 2023. 9. 7. 16:22
반응형

JMeter에서 Test Plan은 성능 테스트 시나리오의 컨테이너 역할을 하는 기본 구성 요소입니다. 이는 본질적으로 성능 테스트를 위한 청사진으로, 테스트의 구조, 설정 및 논리를 간략하게 설명합니다.

 

다음은 JMeter 테스트 계획과 주요 구성 요소에 대한 개요입니다.

  1. Test Plan:
    • JMeter 테스트 스크립트의 최상위 요소는 "Test Plan"입니다. 성능 테스트를 구성하는 모든 요소와 구성 요소에 대한 기본 컨테이너 역할을 합니다.
  2. Thread Group:
    • Test Plan 내에서 "Thread Group" 요소는 가상 사용자(스레드)의 특성과 요청 실행 방법을 정의하는 곳입니다. 스레드 개수, 램프업 시간, 반복횟수와 같은 세부 정보를 지정합니다.
  3. Controllers:
    • Controller는 스레드 그룹 내 요청의 순서와 흐름을 결정하는 요소입니다.
      Common controllers include:
      • HTTP Request Defaults: Sets default values for HTTP requests within the thread group.
      • Recording Controller: Groups requests generated during recording.
      • Transaction Controller: Groups requests into transactions for measuring response times.
      • Loop Controller: Specifies how many times a child element should be executed.
      • If Controller: Allows conditional execution of child elements.
      • While Controller: Repeats execution of child elements while a condition is true.
      • Random Controller: Randomly selects child elements for execution.
      • Switch Controller: Routes requests based on a condition.
  4. Samplers:
    • Sampler는 대상 서버에 요청을 보내는 일을 담당합니다.
      Common samplers include:
      • HTTP Request: Sends HTTP or HTTPS requests to a web server.
      • FTP Request: Performs FTP operations.
      • JDBC Request: Sends SQL queries to a database.
      • TCP Sampler: Sends custom TCP requests.
      • SMTP Sampler: Sends emails.
      • SOAP/XML-RPC Request: Sends SOAP or XML-RPC requests.
  5. Listeners:
    • Listener는 테스트 결과를 수집하고 표시하는 데 사용되는 요소입니다. 응답 시간, 오류율 및 기타 측정항목에 대한 정보를 제공합니다.
      Common listeners include:
      • View Results Tree: Displays results in a tree-like structure.
      • Summary Report: Provides a summary of test results.
      • Aggregate Report: Generates an aggregate report with statistics.
      • Graphs (e.g., Response Times Over Time): Displays test data graphically.
      • CSV Output: Writes results to a CSV file.
      • Assertion Results: Shows the outcome of assertion checks.
  6. Timers:
    • Timer를 사용하면 요청이나 스레드 간에 지연을 도입할 수 있습니다. 이를 통해 현실적인 사용자 행동을 시뮬레이션할 수 있습니다.
      Common timers include:
      • Constant Timer: Adds a fixed delay between requests.
      • Uniform Random Timer: Introduces random delays within a specified range.
      • Gaussian Random Timer: Adds delays following a Gaussian distribution.
  7. Assertions:
    • Assertions은 서버 응답이 특정 기준을 충족하는지 또는 예상되는 콘텐츠를 포함하는지 확인하는 데 사용됩니다. Assertions 실패하면 테스트에서 요청을 실패로 표시할 수 있습니다.
      Common assertions include:
      • Response Assertion: Checks the response text against patterns.
      • Duration Assertion: Verifies that the response time is within a specified range.
      • XML Assertion: Validates XML responses.
      • JSON Assertion: Validates JSON responses.
  8. Configuration Elements:
    • Configuration elements를 사용하여 변수, 데이터 소스를 설정하거나 다른 테스트 요소의 동작을 제어할 수 있습니다. 예로는 CSV 데이터 세트 구성 및 사용자 정의 변수가 있습니다.
  9. Pre-Processors and Post-Processors:
    • 이러한 요소를 사용하면 요청을 전송하기 전에 수정하거나 요청을 받은 후 응답을 처리할 수 있습니다. 예에는 정규식 추출기 및 JSON 경로 포스트프로세서가 포함됩니다.
  10. Test Fragments:
    • Test fragments는 여러 Test Plan에 포함될 수 있는 재사용 가능한 구성 요소입니다..

JMeter 테스트 계획을 생성하려면 일반적으로 스레드 그룹을 추가하고, 샘플러를 구성하고, 결과를 캡처하기 위한 리스너를 추가하고, 테스트 목표에 따라 설정을 조정하는 것부터 시작합니다. 그런 다음 필요에 따라 컨트롤러, 타이머 및 기타 요소를 추가하여 실제 사용자 동작 및 로드 시나리오를 시뮬레이션하여 테스트 계획을 세밀하게 조정할 수 있습니다. 마지막으로 테스트 계획을 실행하여 정의된 조건에서 애플리케이션의 성능을 측정합니다.

반응형