Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions skills-generator/src/main/resources/skill-indexes/152-skill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<prompt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.7.0/pml.xsd"
id="152-java-performance-gatling">
<metadata>
<author>Juan Antonio Breña Moral</author>
<version>0.15.0</version>
<license>Apache-2.0</license>
<description>Use when you need to set up Gatling performance testing for a Java Maven project — including adding Gatling dependencies and the Gatling Maven plugin, creating Java simulations, running gatling:test, configuring a simulation class, and reviewing generated reports. This should trigger for requests such as Add Gatling performance testing; Apply Gatling performance testing; Create a Gatling simulation; Add Gatling support.</description>
</metadata>

<title>Run performance tests based on Gatling</title>
<goal><![CDATA[
Provide a complete Gatling performance testing setup for Java Maven projects by adding the required test dependencies and Gatling Maven plugin configuration, creating or guiding Java simulation placement, and explaining how to run simulations and inspect reports.

**What is covered in this Skill?**

- Add Gatling dependencies and the `gatling-maven-plugin` to `pom.xml`
- Project structure: `src/test/java` for Java simulations and `src/test/resources` for Gatling configuration, feeders, templates, and logging
- Run simulations with `./mvnw gatling:test`
- Select a simulation with `-Dgatling.simulationClass=<FullyQualifiedClassName>` when multiple simulations exist
- Use `./mvnw gatling:help -Ddetail=true -Dgoal=test` to inspect available plugin options
- Review generated Gatling run output and reports under the build output directory

**Scope:** Use Gatling through the Maven plugin for Java simulations. Prefer project-local Maven wrapper commands when available.
]]></goal>

<constraints>
<constraints-description>Gatling setup must be Maven-based, reproducible, and compatible with Java project conventions. Prefer official Gatling Maven plugin behavior and avoid inventing unsupported command-line options.</constraints-description>
<constraint-list>
<constraint>**PREREQUISITE**: Verify the project is Maven-based and prefer `./mvnw` when the Maven wrapper exists</constraint>
<constraint>**BUILD CONFIGURATION**: Add Gatling dependencies with test scope and configure `io.gatling:gatling-maven-plugin` in `pom.xml`</constraint>
<constraint>**VERSION SELECTION**: Use the project's existing dependency/version-management pattern; if no Gatling versions are present, ask before pinning versions or use placeholders that require replacement</constraint>
<constraint>**SIMULATION LOCATION**: Place Java simulations under `src/test/java` using an appropriate package name</constraint>
<constraint>**RESOURCE LOCATION**: Place Gatling resources such as `gatling.conf`, feeders, request-body templates, and Logback test configuration under `src/test/resources`</constraint>
<constraint>**BEFORE APPLYING**: Read the reference for setup, execution, and verification guidance</constraint>
<constraint>**EDGE CASE**: If the project is not Maven-based, stop and explain that this skill targets Maven projects before suggesting Gradle or sbt alternatives</constraint>
<constraint>**EDGE CASE**: If multiple simulations exist, configure or pass `-Dgatling.simulationClass=&lt;FullyQualifiedClassName&gt;` for non-interactive execution</constraint>
</constraint-list>
</constraints>

<triggers>
<trigger-list>
<trigger>Add Gatling performance testing</trigger>
<trigger>Apply Gatling performance testing</trigger>
<trigger>Create a Gatling simulation</trigger>
<trigger>Add Gatling support</trigger>
</trigger-list>
</triggers>

<steps>
<step number="1">
<step-title>Inspect the Maven project</step-title>
<step-content>Check for `pom.xml`, the Maven wrapper, existing test dependencies, dependency management, plugin management, and any existing Gatling configuration.</step-content>
</step>
<step number="2">
<step-title>Add Gatling build configuration</step-title>
<step-content>Add the Gatling test dependency and `io.gatling:gatling-maven-plugin` using the project's existing version and plugin configuration style.</step-content>
</step>
<step number="3">
<step-title>Create or adapt Java simulations</step-title>
<step-content>Create Java simulation classes under `src/test/java` or adapt existing simulations, keeping scenario names, base URLs, injection profiles, and assertions explicit.</step-content>
</step>
<step number="4">
<step-title>Configure resources</step-title>
<step-content>Add optional Gatling resources under `src/test/resources`, including `gatling.conf`, feeders, request body templates, and `logback-test.xml` only when the project needs them.</step-content>
</step>
<step number="5">
<step-title>Run and explain Gatling execution</step-title>
<step-content>Use `./mvnw gatling:test` to run simulations and `-Dgatling.simulationClass=&lt;FullyQualifiedClassName&gt;` when a specific simulation must be selected.</step-content>
</step>
<step number="6">
<step-title>Verify reports and next steps</step-title>
<step-content>Confirm the Gatling run completed, point to the generated report location from the command output, and summarize any failed assertions or performance findings.</step-content>
</step>
</steps>
</prompt>
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<prompt>

<metadata>
<author>Juan Antonio Breña Moral</author>
<version>0.15.0</version>
<license>Apache-2.0</license>
<title>Run performance tests based on Gatling</title>
<description>Use when you need to set up Gatling performance testing for a Java Maven project — including adding Gatling dependencies and the Gatling Maven plugin, creating Java simulations, running gatling:test, configuring a simulation class, and reviewing generated reports.</description>
</metadata>

<role>You are a Senior software engineer with extensive experience in Java software development, Maven, and performance testing with Gatling</role>

<goal>
When a user requests Gatling performance testing setup, provide a Maven-based Gatling solution for Java simulations, including build configuration, simulation structure, execution commands, and report verification.
</goal>

<constraints>
<constraints-description>Prerequisites and requirements that must be met before proceeding with Gatling performance testing setup</constraints-description>
<constraint-list>
<constraint>Verify that the project is Maven-based before applying this skill</constraint>
<constraint>Prefer the Maven wrapper (`./mvnw`) when it exists in the project root</constraint>
<constraint>Use the project's existing dependency and plugin version-management style</constraint>
<constraint>If no Gatling version convention exists, ask before pinning versions or use explicit placeholders that require replacement</constraint>
<constraint>Do not invent unsupported Gatling Maven plugin options; use `gatling:help` for available options</constraint>
<constraint>Do not edit generated reports or generated build output directly</constraint>
</constraint-list>
</constraints>

<steps>
<step number="1">
<step-title>Inspect the Project</step-title>
<step-content>
When a user requests Gatling performance testing setup:

1. Check whether `pom.xml` exists in the project root.
2. Check whether the Maven wrapper exists (`./mvnw` or `mvnw.cmd`).
3. Inspect existing dependency management, plugin management, and test dependencies.
4. Search for existing Gatling simulations or configuration before adding new files.

**Required Maven Project Structure:**
```
project-root/
├── pom.xml
├── mvnw # Preferred when present
├── src/test/java/
│ └── .../ExampleSimulation.java # Java Gatling simulation
├── src/test/resources/
│ ├── gatling.conf # Optional Gatling configuration
│ ├── logback-test.xml # Optional logging override
│ └── data/ # Optional feeders or request bodies
└── target/
└── gatling/ # Generated reports
```
</step-content>
</step>

<step number="2">
<step-title>Add Maven Configuration</step-title>
<step-content>
Add Gatling with the project's existing Maven style. Prefer properties or dependency management when the project already centralizes versions.

**Dependency:**
```xml
<![CDATA[<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>MANUALLY_REPLACE_WITH_LATEST_VERSION</version>
<scope>test</scope>
</dependency>]]>
```

**Plugin:**
```xml
<![CDATA[<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>MANUALLY_REPLACE_WITH_LATEST_VERSION</version>
</plugin>]]>
```

If the user wants Gatling bound to the Maven lifecycle, configure an execution for the `test` goal. By default, the Gatling Maven plugin binds the `test` goal to the `integration-test` phase when configured with an execution.
</step-content>
</step>

<step number="3">
<step-title>Create Java Simulation</step-title>
<step-content>
Create simulations as Java test sources under `src/test/java` using a package that matches the project conventions.

**Simulation Guidance:**
- Use descriptive simulation class names ending with `Simulation`
- Keep base URLs configurable through system properties or environment variables when appropriate
- Use explicit scenario names that describe the user journey under load
- Define injection profiles that match the requested load model
- Add assertions only when the expected latency, success rate, or throughput target is clear
- Keep feeders and request body templates under `src/test/resources`
</step-content>
</step>

<step number="4">
<step-title>Run Gatling Tests</step-title>
<step-content>
**Basic Usage:**
```bash
# Run with the Maven wrapper
./mvnw gatling:test

# Run with a specific simulation class
./mvnw gatling:test -Dgatling.simulationClass=com.example.performance.ExampleSimulation

# Inspect available options for the test goal
./mvnw gatling:help -Ddetail=true -Dgoal=test
```

If there is exactly one simulation, Gatling can run it directly. If multiple simulations exist, pass `-Dgatling.simulationClass=&lt;FullyQualifiedClassName&gt;` or configure the plugin with a simulation class for repeatable non-interactive execution.
</step-content>
</step>

<step number="5">
<step-title>Review Reports</step-title>
<step-content>
After execution, read the command output to locate the generated Gatling report. Reports are generated under the Maven build output, typically below `target/gatling/`.

**Report Review Checklist:**
- Confirm the simulation completed without build failures
- Check failed requests and error distributions
- Review response time percentiles and throughput
- Review assertion failures when assertions are configured
- Summarize findings and recommend follow-up load profiles only when supported by the observed result
</step-content>
</step>
</steps>

<output-format>
<output-format-list>
<output-format-item>Summarize the Maven changes applied to `pom.xml`</output-format-item>
<output-format-item>List created or updated Gatling simulation and resource files</output-format-item>
<output-format-item>Provide the exact command used to run Gatling tests</output-format-item>
<output-format-item>Point to the generated report location shown by Gatling</output-format-item>
<output-format-item>Summarize failed assertions, errors, or notable performance findings</output-format-item>
</output-format-list>
</output-format>

<safeguards>
<safeguards-list>
<safeguards-item>**PROJECT TYPE CHECK**: Stop with guidance if the project is not Maven-based</safeguards-item>
<safeguards-item>**VERSION MANAGEMENT**: Follow existing Maven version-management conventions instead of scattering hard-coded versions</safeguards-item>
<safeguards-item>**NON-INTERACTIVE RUNS**: Use `-Dgatling.simulationClass=&lt;FullyQualifiedClassName&gt;` when multiple simulations would make execution ambiguous</safeguards-item>
<safeguards-item>**CONFIGURATION SAFETY**: Place `gatling.conf` in `src/test/resources` because Gatling resolves it from the classpath</safeguards-item>
<safeguards-item>**REPORT SAFETY**: Treat `target/gatling/` as generated output and do not edit reports directly</safeguards-item>
<safeguards-item>**VALIDATION**: Run `./mvnw gatling:test` or the closest project-specific Maven verification command after setup when feasible</safeguards-item>
</safeguards-list>
</safeguards>
</prompt>
5 changes: 5 additions & 0 deletions skills-generator/src/main/resources/skills.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@
<reference>151-java-performance-jmeter</reference>
</reference-list>
</skill>
<skill id="152">
<reference-list>
<reference>152-java-performance-gatling</reference>
</reference-list>
</skill>
<skill id="161">
<reference-list>
<reference>161-java-profiling-detect</reference>
Expand Down
Loading