npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@processity/cli-performance-testing

v0.0.9

Published

A SF CLI extension to initiate, Monitor and generate report for apex-performance-testing

Downloads

66

Readme

@processity/cli-performance-testing

NPM Downloads/week License

Overview

The @processity/cli-performance-testing plugin is a Salesforce CLI extension that enables users to run Apex performance test suites, monitor their progress, and generate detailed reports.

Prerequisites

Before using this plugin, ensure the following:

  1. You have the Salesforce CLI installed.
  2. The latest version of the apex-performance-testing unlocked package is installed in your target Salesforce org.
  3. The target Salesforce org is authenticated using the Salesforce CLI and is set as the default org for your project repository.
  4. An Apex Performance suite is created and deployed in your org.

Installation

To install the plugin, use the following command:

sf plugins install @processity/cli-performance-testing

Note: if you have installed the namespaced version of apex-performance-testing, set the namespace environment variable to mantra

export namespace=mantra

Usage

Running a Performance Suite

Execute the following command to run a performance test suite:

sf performance test run TestSuiteClassName

This command will

  1. start the performance suite execution
  2. Display a live progress bar
  3. Generate a PDF report with graphs once the execution is complete.

Comparing against a benchmark

you can compare the generated report against a benchmark by creating a ptest.config.json file in root directory

{
  "benchmarks": [
    {
      "suiteName": "{suite label}",
      "svgResponses": {
        "cpuTime": {
          "plots": {
            "{scenario 1 label}": {
              "xMin": 3,
              "xMax": 30,
              "yMin": 283,
              "yMax": 194
            },
            "{scenario 2 label}": {
              "xMin": 3,
              "xMax": 30,
              "yMin": 301,
              "yMax": 222
            }
          }
        }
        // ... Other metrics
      }
    }
    // ...Other suite's benchmark
  ]
}

Quick Tip: The actual report for each suite can be found in .ptest/{suitename}/response.json

If a benchmark JSON is available for the suite, it will be displayed as a dotted line on the graph to facilitate easy comparison. For example, notice how the Iterator loop takes more time than the set benchmark. Benchmark example

Reporting Issues

If you encounter any issues, please report them on the GitHub Issues page.

Building the Plugin Locally

To build the plugin locally, ensure you have Yarn installed and then run the following commands:

# Clone the repository
git clone [email protected]:processity/cli-performance-testing.git

# Install dependencies and compile
yarn && yarn build

You can use your plugin locally by running it with the ./bin/dev or ./bin/dev.cmd file:

# Run using the local development file
./bin/dev performance test run TestSuiteName

There should be no difference when running the plugin via the Salesforce CLI or using the local run file. However, linking the plugin can be helpful for additional testing or to run commands from any location on your machine:

# Link your plugin to the Salesforce CLI
sf plugins link .

# Verify the link
sf plugins

Commands

sf performance test run

Use this command to initiate the execution of performance suite(s).

USAGE
  $ sf performance test run -n [--json]

FLAGS
  -n, --name=<value>  [required] Comma-separated list of test suite names.
  -m, --metrics [optional] Comma-separated list of metrics for which report needs to be generated

GLOBAL FLAGS
  --json  Output the results in JSON format.

DESCRIPTION
  Initiates the execution of one or more Apex performance test suites, monitors progress, and generates a performance report upon completion.

EXAMPLES
  Run TestSuite1, monitor its progress, and generate a performance report:

    $ sf performance test run -n TestSuite1

  Run TestSuite1 and TestSuite2 sequentially, monitor progress, and generate a performance report:

    $ sf performance test run -n TestSuite1,TestSuite2

  Generate report for only CPU Time
    $ sf performance test report -n TestSuite1,TestSuite2 -m CPUTime

  Generate report for CPU Time and Heap Size
    $ sf performance test report -n TestSuite1,TestSuite2 -m CPUTime,HeapSize

sf performance test report

Use this command to generate report for performance suite(s).

USAGE
  $ sf performance test report -n [--json]

FLAGS
  -n, --name=<value>  [required] Comma-separated list of test suite labels.
  -m, --metrics [optional] Comma-separated list of metrics for which report needs to be generated

GLOBAL FLAGS
  --json  Output the results in JSON format.

DESCRIPTION
  This will generate report in PDF with 1 graph for each suite execution

EXAMPLES
  Generate report for TestSuite1 execution:

    $ sf performance test report -n TestSuite1

  Generate report for TestSuite1 and TestSuite2executions:

    $ sf performance test report -n TestSuite1,TestSuite2

  Generate report for only CPU Time
    $ sf performance test report -n TestSuite1,TestSuite2 -m CPUTime

  Generate report for CPU Time and Heap Size
    $ sf performance test report -n TestSuite1,TestSuite2 -m CPUTime,HeapSize