# jmeter-xml-generator

Latest version **0.3.2** (published 2023-01-29) · 0 weekly downloads

## Install

```sh
npm install jmeter-xml-generator
pnpm add jmeter-xml-generator
yarn add jmeter-xml-generator
bun add jmeter-xml-generator
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2023-01-29 |
| First published | 2022-10-08 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 563.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | elasehuang |

## Links

- npm: https://www.npmjs.com/package/jmeter-xml-generator
- Repository: https://github.com/Ahuang0107/jmeter-xml-generator
- Issues: https://github.com/Ahuang0107/jmeter-xml-generator/issues
- npm.io page: https://npm.io/package/jmeter-xml-generator

## Recent versions

- 0.3.2 (latest) — 2023-01-29
- 0.3.1 — 2022-12-05
- 0.3.0 — 2022-12-02
- 0.2.2 — 2022-10-24
- 0.2.1 — 2022-10-20
- 0.2.0 — 2022-10-17
- 0.1.1 — 2022-10-14
- 0.1.0 — 2022-10-08

## README

<div style="display:flex;flex-direction: column;align-items: center">

  <h1><code>jmeter-xml-generator</code></h1>

  <p>
    <strong>Faster way to get jmeter script.</strong>
  </p>

<sub>Built with 🦀Rust</sub>
</div>

## Example

### Vue + Axios

You can see example in [example-with-vue2](/preview/example-with-vue2)

Generate jmeter performance test script with Vue and Axios.

1. install

   ```shell
   npm install jmeter-xml-generator@0.3.0
   ```

2. enable WebAssembly in Vue2

   ```js
   // vue.config.js
   const {defineConfig} = require('@vue/cli-service')
   module.exports = defineConfig({
      transpileDependencies: true,
      configureWebpack: {
         experiments: {
            asyncWebAssembly: true,
         }
      }
   })
   ```

3. bind scriptBuilder to Vue.prototype

    ```js
    import {ScriptBuilder} from "jmeter-xml-generator"
    
    Vue.prototype.scriptBuilder = ScriptBuilder.new()
    ```

4. add middleware to axios

    ```js
    const instance = axios.create({
        baseURL: 'http://localhost:26005/'
    })
    instance.interceptors.request.use(function (config) {
        const heads = {"Content-Type": config.headers["Content-Type"]}
        const requestArg = JSON.stringify({
            baseUrl: config.baseURL,
            url: config.url,
            method: config.method,
            heads,
            params: config.params,
            data: config.data,
        })
        Vue.prototype.scriptBuilder.add_axios_request(requestArg)
        return config
    })
    ```
5. download script

    ```js
    const result = Vue.prototype.scriptBuilder.build()
    let blob = new Blob([result], {type: "application/xml"})
    let blobUrl = URL.createObjectURL(blob)
    let linkDOM = document.createElement("a")
    linkDOM.style.display = "none"
    linkDOM.href = blobUrl
    linkDOM.setAttribute("download", "test script " + Date.now() + ".jmx")
    document.body.appendChild(linkDOM)
    linkDOM.click()
    document.body.removeChild(linkDOM)
    URL.revokeObjectURL(blobUrl)
    ```

---
_Source: https://npm.io/package/jmeter-xml-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
