Skip to content

Commit

Permalink
Merge pull request #22 from amardeep2006/feat/upgrades-linux-jmeter-a…
Browse files Browse the repository at this point in the history
…ctions

feat(upgrades): Jmeter,Linux,newplugins,html reports
  • Loading branch information
QAInsights authored Nov 15, 2023
2 parents aff34bf + 3cee124 commit 49fadd0
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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/[email protected]
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

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,5 +27,5 @@ runs:
- "-t"
- "${{ inputs.test-plan-path }}"
- "-l"
- "result.jtl"
- "${{ inputs.results-file }}"
- "${{ inputs.args }}"
5 changes: 2 additions & 3 deletions jmeter-plugin-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -12,12 +12,11 @@ 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

pwd

ls -l ${JMETER_HOME}/bin/*.sh

#PluginsManagerCMD install jpgc-udp=0.4

0 comments on commit 49fadd0

Please sign in to comment.