diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c701475..ca96e08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,16 +5,25 @@ jobs: name: JMeter Test Execution steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: Create reports directory + run: mkdir reports - name: Run JMeter Tests uses: ./ with: test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx - args: "" + args: "-e -o ./reports/html/" - name: Upload Results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: jmeter-results path: result.jtl + + - name: Upload Html Reports + uses: actions/upload-artifact@v3 + with: + name: jmeter-reports + path: reports diff --git a/Dockerfile b/Dockerfile index 9ad6d01..c1995a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,22 @@ -FROM alpine:3.11 +FROM alpine:3.18 LABEL Author="NaveenKumar Namachivayam" LABEL Website="https://qainsights.com" LABEL Description="Apache JMeter Dockerfile for GitHub Actions with JMeter Plugins" -ENV JMETER_VERSION "5.5" +ENV JMETER_VERSION "5.6.2" ENV JMETER_HOME "/opt/apache/apache-jmeter-${JMETER_VERSION}" ENV JMETER_BIN "${JMETER_HOME}/bin" ENV PATH "$PATH:$JMETER_BIN" ENV JMETER_CMD_RUNNER_VERSION "2.3" -ENV JMETER_PLUGIN_MANAGER_VERSION "1.7" +ENV JMETER_PLUGIN_MANAGER_VERSION "1.9" +ENV JMETER_PLUGIN_INSTALL_LIST "jpgc-udp,jpgc-graphs-basic,jpgc-graphs-additional,jpgc-graphs-dist,jpgc-functions" COPY entrypoint.sh /entrypoint.sh COPY jmeter-plugin-install.sh /jmeter-plugin-install.sh # Downloading JMeter -RUN apk --no-cache add curl ca-certificates openjdk9-jre && \ +RUN apk --no-cache add curl ca-certificates openjdk17-jre && \ curl -L https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz --output /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \ tar -zxvf /tmp/apache-jmeter-${JMETER_VERSION}.tgz && \ mkdir -p /opt/apache && \ diff --git a/README.md b/README.md index 5301a7d..7e4dfbe 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,21 @@ Following are the prerequisites for this GitHub Action: * `args` * Optional * Additional arguments you can pass it to your test plan execution - +* `test-results` + * Optional + * If you want your result to have a different extension than jtl such as .csv , default value result.jtl ## Usage ### Example #1 with no arguments ``` - name: JMeter Test - uses: QAInsights/PerfAction@v3.1 + uses: QAInsights/PerfAction@v3.2 with: test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx args: "" - name: Upload Results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: jmeter-results path: result.jtl @@ -45,7 +47,7 @@ Following are the prerequisites for this GitHub Action: ``` - name: JMeter Test - uses: QAInsights/PerfAction@v3.1 + uses: QAInsights/PerfAction@v3.2 with: test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx args: "-H my.proxy.server -P 8000" @@ -56,6 +58,33 @@ Following are the prerequisites for this GitHub Action: name: jmeter-results path: result.jtl ``` +### Example #3 with arguments to Generate HTML Reports + +make sure you create directory with the name where you want html report to be saved. + +``` +- name: Create reports directory + run: mkdir reports + +- name: JMeter Test + uses: QAInsights/PerfAction@v3.2 + with: + test-plan-path: ./TestPlans/S01_SimpleExample/S01_SimpleExample.jmx + args: "-e -o ./reports/html/" + +- name: Upload Results + uses: actions/upload-artifact@v3 + with: + name: jmeter-results + path: result.jtl + +- name: Upload HTML Reports + uses: actions/upload-artifact@v3 + with: + name: jmeter-html-reports + path: reports + +``` ## Download JMeter Test Results diff --git a/action.yml b/action.yml index 3c55d86..303c0a1 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: test-plan-path: required: true description: jmeter test plan to execute + results-file: + required: false + description: Where to store the results e.g., result.csv + default: result.jtl args: required: false description: Optional arguments. For more details https://jmeter.apache.org/usermanual/get-started.html#non_gui @@ -23,5 +27,5 @@ runs: - "-t" - "${{ inputs.test-plan-path }}" - "-l" - - "result.jtl" + - "${{ inputs.results-file }}" - "${{ inputs.args }}" diff --git a/jmeter-plugin-install.sh b/jmeter-plugin-install.sh index 502ccd6..2e8e7b3 100644 --- a/jmeter-plugin-install.sh +++ b/jmeter-plugin-install.sh @@ -2,7 +2,7 @@ echo ${JMETER_HOME} echo ${JMETER_CMD_RUNNER_VERSION} echo ${JMETER_PLUGIN_MANAGER_VERSION} - +echo ${JMETER_PLUGIN_INSTALL_LIST} echo "Downloading CMDRunner" curl -L http://search.maven.org/remotecontent?filepath=kg/apc/cmdrunner/${JMETER_CMD_RUNNER_VERSION}/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --output ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar @@ -12,7 +12,7 @@ curl -L https://jmeter-plugins.org/get/ --output ${JMETER_HOME}/lib/ext/jmeter-p java -cp /opt/apache/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGIN_MANAGER_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller cd /opt/apache/apache-jmeter-${JMETER_VERSION}/bin/ -java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install jpgc-udp=0.4 +java -jar ${JMETER_HOME}/lib/cmdrunner-${JMETER_CMD_RUNNER_VERSION}.jar --tool org.jmeterplugins.repository.PluginManagerCMD install ${JMETER_PLUGIN_INSTALL_LIST} chmod a+x ${JMETER_HOME}/bin/*.sh @@ -20,4 +20,3 @@ pwd ls -l ${JMETER_HOME}/bin/*.sh -#PluginsManagerCMD install jpgc-udp=0.4