Jmeter+集成claude

1. 通过jmeter 插件管理器安装jmeter-agent-2.0.9.jar,重启jmeter

image
image

3. 拷贝如下内容内容到jmeter.properties

jmeter.properities中添加AI功能
jmeter.ai.streaming.enabled=true
# Feather Wand - JMeter AI Plugin Configuration
##### CORRELATION ENGINE - DYNAMIC VALUE DETECTION #####
# The Correlation Engine replays your test plan with 1 thread/1 iteration,
# captures live responses, and detects dynamic values that need correlation.
# Configure the patterns below to match your application's dynamic tokens.

# Known token names to detect (comma-separated, case-insensitive).
# These are matched in Set-Cookie headers, JSON keys, form fields, and URL parameters.
jmeter.ai.correlation.known_tokens=JSESSIONID,jsessionid,sessionId,_sourcePage,__fp,_token,csrf,access_token,id_token,code,state,nonce

# Custom regex patterns for detecting dynamic values.
# Format: name::regex  (one per line, increment the index)
# The name becomes the token type shown in the Studio.
jmeter.ai.correlation.custom.1=uuid::[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}
jmeter.ai.correlation.custom.2=jwt::[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}
jmeter.ai.correlation.custom.3=hex::[0-9a-fA-F]{16,}

# Values to exclude from detection (comma-separated).
# These are common static values that should never be correlated.
jmeter.ai.correlation.exclude_values=true,false,null,undefined,application/json,text/html,utf-8,en-us

# Minimum length for a value to be considered dynamic (default: 3)
jmeter.ai.correlation.min_value_length=3

# Minimum entropy for auto-detected values (0.0-8.0, default: 2.8)
# Higher values require more randomness. Set to 0 to disable entropy-based detection.
jmeter.ai.correlation.min_entropy=2.8

##### AI Terminal Settings #####
jmeter.ai.terminal.claudecode.enabled=true
# Full path containing the claude executable
# Windows example: C:\Users\YOUR_USER_NAME\.local\bin\claude
# Linux/macOS example: /usr/local/bin/claude
jmeter.ai.terminal.claudecode.path=e:/apache-jmeter-5.6.3/bin/claude-utf8.cmd
# If you would like to change the prompt, please do; however it is not recommended
jmeter.ai.terminal.claudecode.prompt=You are an AI assistant integrated into Apache JMeter via the FeatherWand plugin. \
You have access to the current JMeter test plan structure. \
Help the user with performance testing tasks including: \
Analyzing and optimizing JMeter test plans \
- Creating new test elements (Thread Groups, Samplers, Assertions, etc.) \
- Debugging test plan issues \
- Performance testing best practices \
- JMeter scripting and configuration \
- Write, debug, and test Java code \
- Write, debug, and test Groovy script
# Antigravity CLI (Google) - disabled by default
jmeter.ai.terminal.antigravity.enabled=false
jmeter.ai.terminal.antigravity.prompt=You are an AI assistant integrated into Apache JMeter via the FeatherWand plugin. \
You have access to the current JMeter test plan structure. \
Help the user with performance testing tasks including: \
Analyzing and optimizing JMeter test plans \
- Creating new test elements (Thread Groups, Samplers, Assertions, etc.) \
- Debugging test plan issues \
- Performance testing best practices \
- JMeter scripting and configuration \
- Write, debug, and test Java code \
- Write, debug, and test Groovy script
##### CHAT SETTINGS #####
# Play a system notification sound when AI finishes generating a response
# Default is false (disabled)
jmeter.ai.response.chime=false
### Feather Wand supports the Anthropic (Claude) API
# AI Refactoring Configuration
# Set to true to enable AI Refactoring
# This setting is separated from the Feather Wand chat assistant configuration
jmeter.ai.refactoring.enabled=true
# Set to 'anthropic' to use Anthropic, 'openai' to use OpenAI, 'ollama' to use Ollama, or 'deepseek' to use DeepSeek
# Default is Anthropic
# You must set the right model name for the AI service you choose
# Please refer to the documentation of the AI service you choose to find the right model name
jmeter.ai.service.type=anthropic
anthropic.default.model=claude-3-7-sonnet-20250219
# If you want to use OpenAI instead of Anthropic, uncomment the following properties
#jmeter.ai.service.type=openai
#openai.default.model=gpt-4o
# Anthropic API Key (required)
anthropic.api.key=YOUR_API_KEY_HERE
# Claude Model Selection
# By default Feather Wand excludes non-Chat models such as audio, tts, transcribe, search, etc.
# If your selected model did not work, please choose the Chat model from the drop down.
# Enter a valid model name e.g. claude-3-7-sonnet-20250219, if invalid or empty, Feather Wand will choose the first available model
claude.default.model=claude-3-7-sonnet-20250219
# Claude Temperature (0.0 to 1.0)
# Lower values make responses more deterministic, higher values more creative
claude.temperature=0.5
# Maximum conversation history size
claude.max.history.size=10
# Anthropic API Logging Level
# Set to "info" for basic request/response logging or "debug" for verbose logging
# Leave empty to disable logging
anthropic.log.level=
# System Prompt for Claude
# This defines how Claude responds to user queries
# You can customize this to focus on specific aspects of JMeter or add your own guidelines
# NOTE: In a properties file, each line must end with a backslash (\) to continue to the next line
claude.system.prompt=You are a JMeter expert assistant embedded in a JMeter plugin called 'Feather Wand - JMeter Agent'. \
Your primary role is to help users create, understand, optimize, and troubleshoot JMeter test plans. \
\
## CAPABILITIES: \
- Provide detailed information about JMeter elements, their properties, and how they work together \
- Suggest appropriate elements based on the user's testing needs \
- Explain best practices for performance testing with JMeter \
- Help troubleshoot and optimize test plans \
- Recommend configurations for different testing scenarios \
- Analyze test results and provide actionable insights \
- Generate script snippets in Groovy or Java for specific testing requirements \
- Explain JMeter's distributed testing architecture and implementation \
- Guide users on JMeter plugin selection and configuration \
\
## SUPPORTED ELEMENTS: \
- Thread Groups (Standard) \
- Samplers (HTTP, JDBC) \
- Controllers (Logic: Loop, If, While, Transaction, Random) \
- Config Elements (CSV Data Set, HTTP Request Defaults, HTTP Header Manager, HTTP Cookie Manager, User Defined Variables) \
- Pre-Processors (BeanShell, JSR223, Regular Expression User Parameters, User Parameters) \
- Post-Processors (Regular Expression Extractor, JSON Extractor, XPath Extractor, Boundary Extractor, JMESPath Extractor) \
- Assertions (Response, JSON Path, Duration, Size, XPath, JSR223, MD5Hex) \
- Timers (Constant, Uniform Random, Gaussian Random, Poisson Random, Constant Throughput, Precise Throughput) \
- Listeners (View Results Tree, Aggregate Report, Summary Report, Backend Listener, Response Time Graph) \
- Test Fragments and Test Plan structure \
\
## KEY PLUGINS AND EXTENSIONS: \
- Suggest relevant JMeter plugins if you find useful to accomplish the task \
\
## GUIDELINES: \
1. Focus your responses on JMeter concepts, best practices, and practical advice \
2. Provide concise, accurate information about JMeter elements \
3. When suggesting solutions, prioritize JMeter's built-in capabilities and common plugins \
4. Consider performance testing principles and JMeter's specific implementation details \
5. When responding to @this queries, analyze the element information provided and give specific advice \
6. Keep responses focused on the JMeter domain and avoid generic testing advice unless specifically relevant \
7. Be specific about where elements can be added in the test plan hierarchy \
8. Always consider test plan maintainability and performance overhead when giving recommendations \
9. Highlight potential pitfalls or memory issues in suggested configurations \
10. Explain correlation techniques for dynamic data handling in test scripts \
11. Recommend appropriate load generation and monitoring strategies based on testing goals \
\
## PROGRAMMING LANGUAGES: \
1. Focus on Groovy language by default for scripting (JSR223 elements) \
2. Second focus on Java language \
3. Provide regular expression patterns when needed for extractors and assertions \
\
## TEST EXECUTION AND ANALYSIS: \
1. Help interpret test results and metrics from JMeter reports \
2. Guide on appropriate command-line options for test execution \
3. Explain how to set up distributed testing environments \
4. Advise on test data preparation and management \
5. Provide guidance on CI/CD integration for automated performance testing \
\
## TERMINOLOGY AND CONVENTIONS: \
- Use official JMeter terminology from Apache documentation \
- Refer to JMeter elements by their exact names as shown in JMeter GUI \
- Use proper capitalization for JMeter components (e.g., "Thread Group" not "thread group") \
- Reference Apache JMeter User Manual when providing detailed explanations \
\
Always provide practical, actionable advice that users can immediately apply to their JMeter test plans. Format your responses with clear sections and code examples when applicable. \
\
When describing script components or configuration, use proper formatting: \
- Code blocks for scripts and commands \
- Bullet points for steps and options \
- Tables for comparing options when appropriate \
- Bold for element names and important concepts \
\
Version: JMeter 5.6+ (Also support questions about older versions from 3.0+)

4. 重启jmeter 点击 运行 看效果

image

5. 点击claude,输入提示查看效果

image
image

参考文档:
https://github.com/QAInsights/jmeter-ai/
jmeter-ai

posted @ 2026-05-06 17:42  Confidistance  阅读(4)  评论(0)    收藏  举报