zhangchenglo/jmeter-function-developer-skills/jmeter-functions-developer

Claude Code and agent skill by zhangchenglo/jmeter-function-developer-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Develop Apache JMeter custom functions in Java with JavaFaker support. Use when creating random data generators (names, phones, emails, addresses), date/time functions, or custom logic for JMeter test plans.

Install

npx vskill@latest install zhangchenglo/jmeter-function-developer-skills/jmeter-functions-developer

SKILL.md

JMeter Functions Developer

Create custom JMeter functions following a standardized 9-step workflow.

Quick Start

  1. Detect jmeter-functions project in current directory
  2. Select function type (random data, date/time, custom logic)
  3. Configure parameters interactively
  4. Preview generated code
  5. Select template (0-6 parameters, with/without JavaFaker)
  6. Create function class
  7. Build JAR package
  8. (Optional) Generate unit tests
  9. Deploy to JMeter lib/ext

Project Template

jmeter-functions/
├── pom.xml
└── src/main/java/org/apache/jmeter/functions/
└── ${FunctionName}.java

Required dependencies:

xml
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>5.5</version>
</dependency>

Function Types

Random Data
  • Name (Chinese/English), Phone, Email, Password
  • ID Card, Address, IP Address
  • Blood Type, Gender, Company, Job Title
Date/Time
  • Random Date, Random Time, Date Formatting
Custom Logic
  • User-specified business requirements

Parameter Configuration

For each parameter, collect:

  • Parameter name and purpose
  • Whether required
  • Type (string/number/options)
  • Default value (for optional)

Show parameter summary table for user confirmation before generating code.

Code Templates

Template A: No Parameters
java
public class RandomChineseName extends AbstractFunction {
private static final String key = "__RandomChineseName";
Faker faker = new Faker(Locale.CHINA);
@Override
public List<String> getArgumentDesc() {
return new LinkedList<>();
}
@Override
public void setParameters(Collection<CompoundVariable> collection) {
checkParameterCount(collection, 0);
}
@Override
public String execute(SampleResult sampleResult, Sampler sampler) {
return faker.name().fullName();
}
@Override
public String getReferenceKey() {
return key;
}
}
Template B: Single Required Parameter
java
public class RandomPhoneNumber extends AbstractFunction {
private static final String key = "__RandomPhoneNumber";
private String region;
Faker faker = new Faker(Locale.CHINA);
@Override
public List<String> getArgumentDesc() {
LinkedList<String> list = new LinkedList<>();
list.add("地区前缀(如:+86)");
return list;
}
@Override
public void setParameters(Collection<CompoundVariable> collection) {
checkParameterCount(collection, 1);
region = ((CompoundVariable)collection.toArray()[0]).execute();
}
@Override
public String execute(SampleResult sampleResult, Sampler sampler) {
return region + faker.phoneNumber().cellPhone();
}
@Override
public String getReferenceKey() {
return key;
}
}
Template C: Multiple Parameters (Required/Optional)
java
public class RandomRangeNumber extends AbstractFunction {
private static final String key = "__RandomRangeNumber";
private int min;
private int max;
@Override
public List<String> getArgumentDesc() {
LinkedList<String> list = new LinkedList<>();
list.add("最小值(必填)");
list.add("最大值(必填)");
return list;
}
@Override
public void setParameters(Collection<CompoundVariable> collection) {
checkParameterCount(collection, 2);
Object[] array = collection.toArray();
min = Integer.parseInt(((CompoundVariable)array[0]).execute().trim());
max = Integer.parseInt(((CompoundVariable)array[1]).execute().trim());
}
@Override
public String execute(SampleResult sampleResult, Sampler sampler) {
int result = (int) (Math.random() * (max - min + 1)) + min;
return String.valueOf(result);
}
@Override
public String getReferenceKey() {
return key;
}
}
Template D: Optional Parameter with JavaFaker
java
public class RandomEmail extends AbstractFunction {
private static final String key = "__RandomEmail";
private String domain;
Faker faker = new Faker(Locale.CHINA);
@Override
public List<String> getArgumentDesc() {
LinkedList<String> list = new LinkedList<>();
list.add("邮箱域名(可选,默认随机)");
return list;
}
@Override
public void setParameters(Collection<CompoundVariable> collection) {
checkParameterCount(collection, 0, 1);
if (collection.size() > 0) {
domain = ((CompoundVariable)collection.toArray()[0]).execute();
}
}
@Override
public String execute(SampleResult sampleResult, Sampler sampler) {
if (domain != null && !domain.isEmpty()) {
return faker.internet().emailAddress(domain);
}
return faker.internet().emailAddress();
}
@Override
public String getReferenceKey() {
return key;
}
}
Template E: Pure Business Logic (No JavaFaker)
java
public class RandomDigitString extends AbstractFunction {
private static final String key = "__RandomDigitString";
private int length;
@Override
public List<String> getArgumentDesc() {
LinkedList<String> list = new LinkedList<>();
list.add("字符串长度(必填)");
return list;
}
@Override
public void setParameters(Collection<CompoundVariable> collection) {
checkParameterCount(collection, 1);
length = Integer.parseInt(((CompoundVariable)collection.toArray()[0]).execute().trim());
}
@Override
public String execute(SampleResult sampleResult, Sampler sampler) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
sb.append((int) (Math.random() * 10));
}
return sb.toString();
}
@Override
public String getReferenceKey() {
return key;
}
}
Template F: With Error Handling
java
public class RandomAge extends AbstractFunction {
private static final String key = "__RandomAge";
private int minAge;
private int maxAge;
@Override
public List<String> getArgumentDesc() {
LinkedList<String> list = new LinkedList<>();
list.add("最小年龄(必填)");
list.add("最大年龄(必填)");
return list;
}
@Override
public void setParameters(Collection<CompoundVariable> collection) {
checkParameterCount(collection, 2);
Object[] array = collection.toArray();
try {
minAge = Integer.parseInt(((CompoundVariable)array[0]).execute().trim());
maxAge = Integer.parseInt(((CompoundVariable)array[1]).execute().trim());
} catch (NumberFormatException e) {
throw new InvalidVariableException("年龄必须是数字");
}
if (minAge < 0 || maxAge < 0) {
throw new InvalidVariableException("年龄不能为负数");
}
if (minAge > maxAge) {
throw new InvalidVariableException("最小年龄不能大于最大年龄");
}
}
@Override
public String execute(SampleResult sampleResult, Sampler sampler) {
int age = (int) (Math.random() * (maxAge - minAge + 1)) + minAge;
return String.valueOf(age);
}
@Override
public String getReferenceKey() {
return key;
}
}

Build and Deploy

bash
cd jmeter-functions
mvn clean package -DskipTests
# JAR output: target/jmeter-functions-1.0-SNAPSHOT.jar

JMeter lib/ext locations:

  • Windows: <JMeter>/lib/ext/
  • macOS: /Applications/ApacheJMeter.app/Contents/Resources/app/lib/ext/
  • Linux: /opt/jmeter/lib/ext/

Usage Examples

${__RandomChineseName()}
${__RandomPhoneNumber(+86)}
${__RandomAge(18, 60)}
${__RandomEmail()}
${__RandomEmail(@company.com)}

JavaFaker Reference

Data TypeMethod
Chinese Namefaker.name().fullName()
Phonefaker.phoneNumber().cellPhone()
Emailfaker.internet().emailAddress()
Passwordfaker.internet().password(min, max, upper, special)
Addressfaker.address().fullAddress()
Blood Typefaker.blood().type()
Companyfaker.company().name()
Job Titlefaker.job().title()
Random Stringfaker.lorem().characters(length)
Datefaker.date().birthday()

Important Notes

  • Function key must start with __
  • Use checkParameterCount() to validate parameter count
  • Get parameter values via CompoundVariable.execute()
  • Place JAR in lib/ext and restart JMeter to activate

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
45
7-day trend score
19

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/zhangchenglo/jmeter-function-developer-skills/jmeter-functions-developer/badge)](https://verified-skill.com/skills/zhangchenglo/jmeter-function-developer-skills/jmeter-functions-developer)

Something wrong with this skill or its page? Tell us.