1

I'm using the blazemeter/taurus:1.13.2 Docker image with the blazemeter reporting module to execute tests.

Is there a way from taurus command line that I can pass a value for the "Notes" field on BlazeMeter? I've passed other values successfully such as:

-o modules.blazemeter.report-name="${report_name}"

I was hoping something similar was all that was needed to pass in "Notes". I've tried:

-o modules.blazemeter.notes="${notes}"

but no luck.

Here's my script to run the full command line:

#!/bin/bash
api_token=$1
timestamp=`date +%s`
report_name="`hostname`_`git log --format='%h' -n 1`_taurus-jmeter_${timestamp}"
notes="testing use of notes through taurus command line args"
artifacts_dir="artifacts/${timestamp}"
docker run -t --rm -v `pwd`:/bzt-configs -v `pwd`/artifacts:/tmp/artifacts blazemeter/taurus:1.13.2 taurus.yml -o settings.artifacts-dir="${artifacts_dir}" -o modules.blazemeter.report-name="${report_name}" -o modules.blazemeter.notes="${notes}" -o modules.blazemeter.token="${api_token}"
user2762956
  • 120
  • 1
  • 9

1 Answers1

1

Using JMeter, you can use this code that you can put in a JSR223 Sampler inside setup Thread Group Alternatively you can use Shell Exec.

Code in Java: URL url = new URL("https://a.blazemeter.com:443/api/v4/masters/" + masterId); HttpURLConnection conn = null; try { conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoInput(true); conn.setDoOutput(true);

            /* We use the API Key and API Secret as Basic Authentication */
            String usernameColonPassword = "" + X_GlobalVariables.BZM_API_KEY + ":" + X_GlobalVariables.BZM_API_SECRET + "";
            String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString(usernameColonPassword.getBytes());

            // Include the HTTP Basic Authentication payload
            conn.addRequestProperty("Authorization", basicAuthPayload);

            //Create JSONObject here
            JSONObject jsonParam = new JSONObject();
            jsonParam.put("note", "Service Version: " + serviceVersion + "\nGateway Version: " + gatewayVersion + "");
            try (OutputStreamWriter out = new  OutputStreamWriter(conn.getOutputStream())) {
                out.write(jsonParam.toString());
            }

            /* Check here for a OK (200) response */
            if (conn.getResponseCode() != 200) {
                 throw new RuntimeException("Failed : HTTP error code : "
                     + conn.getResponseCode());
            }

            /* Release the connection */
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }

Source:

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116