Home > database >  Jmeter upload test artifacts on GIT
Jmeter upload test artifacts on GIT

Time:09-05

Hello I want to upload the HTML file generated from the execution of my Jmeter, unfortunately I'm encountering an error upon executing my script. Your response is highly appreciated. Thank you

Here's my YAML file.

name: CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  workflow_dispatch:
    inputs:
      choice:
        type: choice
        description: Environment
        options:
        - test
        - dev
        - uat

jobs:

  build:
    runs-on: ubuntu-latest
    
    steps:
      - uses: actions/checkout@v3

      - name: setup-jmeter
        run: |
          sudo apt-get update
          sudo apt install curl -y
          sudo apt install -y default-jdk
          sudo curl -O https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.tgz 
          sudo tar -xvf apache-jmeter-5.3.tgz
          cd $GITHUB_WORKSPACE/apache-jmeter-5.3/lib && sudo curl -O https://repo1.maven.org/maven2/kg/apc/cmdrunner/2.2.1/cmdrunner-2.2.1.jar
          cd $GITHUB_WORKSPACE/apache-jmeter-5.3/lib/ext && sudo curl -O https://repo1.maven.org/maven2/kg/apc/jmeter-plugins-manager/1.6/jmeter-plugins-manager-1.6.jar
          cd $GITHUB_WORKSPACE/apache-jmeter-5.3/lib && sudo java -jar cmdrunner-2.2.1.jar --tool org.jmeterplugins.repository.PluginManagerCMD install-all-except jpgc-hadoop,jpgc-oauth,ulp-jmeter-autocorrelator-plugin,ulp-jmeter-videostreaming-plugin,ulp-jmeter-gwt-plugin,tilln-iso8583
      - name: run-jmeter-test
        run: |
          echo "choice is ${{ github.event.inputs.choice }}" / ${{ inputs.choice }}
          $GITHUB_WORKSPACE/apache-jmeter-5.3/bin/./jmeter.sh -n -t testGIT.jmx -Jchoice="${{ github.event.inputs.choice }}" -l result.jtl -e -o $GITHUB_WORKSPACE/html/test
          
          
      - name: Upload Results
        uses: actions/upload-artifact@v2
        with:
          name: jmeter-results
          path: result.jtl


      - name: Upload HTML
        uses: actions/upload-artifact@v2
        with:
          name: jmeter-results-HTML
          path: index.html

Expected Result:

I should able to see 2 entries for the result one for jmeter-results and the other one is jmeter-results-HTML.

Screenshot:

enter image description here

Note: the index.html generated from my local this is what I want to display from my execution

enter image description here

CodePudding user response:

  1. You're creating HTML Reporting Dashboard under html/test folder and trying to upload index.html file from the current folder. I believe you need to change the artifact path to

    path: html/test/index.html
    
  2. It doesn't make sense to archive index.html alone, it relies on the content and sbadmin2-1.0.7 folders so it's better to consider uploading the whole folder otherwise the dashboard will not be usable.

  3. According to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.5 (or whatever is the latest stable version available at JMeter Downloads page)

  • Related