### Start the Server Source: https://github.com/artilleryio/artillery/blob/main/examples/http-socketio-server/README.md Execute this command to start the server after dependencies are installed. ```shell npm start ``` -------------------------------- ### Install Server Dependencies Source: https://github.com/artilleryio/artillery/blob/main/examples/functional-testing-with-expect-plugin/README.md Run this command to install the necessary dependencies for the Express.js API server. This is a prerequisite before starting the server. ```shell npm install ``` -------------------------------- ### Start HTTP Server Source: https://github.com/artilleryio/artillery/blob/main/examples/http-file-uploads/README.md Execute this command to start the HTTP server. It will listen on http://localhost:3000/. ```shell npm run app:start ``` -------------------------------- ### Install Artillery Source: https://github.com/artilleryio/artillery/blob/main/examples/browser-playwright-reuse-authentication/README.md Install Artillery using npm. This is a prerequisite for running the example. ```sh npm install artillery ``` -------------------------------- ### Install Twirp server dependencies Source: https://github.com/artilleryio/artillery/blob/main/examples/rpc-twirp-with-custom-function/README.md Install the necessary Node.js dependencies for the Twirp server before starting it. ```bash cd twirp && npm install ``` -------------------------------- ### Start WebSockets Server Source: https://github.com/artilleryio/artillery/blob/main/examples/websockets/README.md Execute this command to start the WebSockets server, which will listen on ws://localhost:8888. ```bash npm run server ``` -------------------------------- ### SOAP Server Dependencies Installation Source: https://github.com/artilleryio/artillery/blob/main/examples/soap-with-custom-function/README.md Install the necessary dependencies for the provided SOAP server. This command should be run from the 'server' directory. ```bash cd server && npm install ``` -------------------------------- ### Install Artillery Memory Inspector Plugin Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-plugin-memory-inspector/README.md Install the plugin globally using npm. ```sh npm install -g artillery-plugin-memory-inspector ``` -------------------------------- ### Start API Server Source: https://github.com/artilleryio/artillery/blob/main/examples/functional-testing-with-expect-plugin/README.md Execute this command to launch the Express.js API server. The server will then be accessible at http://localhost:3000/. ```shell node app.js ``` -------------------------------- ### Start a Kind Kubernetes Cluster Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md Use this shell script to quickly set up a local Kubernetes cluster with a container registry using Kind. ```shell ./hack/kind/kind-with-registry.sh ``` -------------------------------- ### Run Example Scenario with Plugin Source: https://github.com/artilleryio/artillery/blob/main/examples/artillery-plugin-hello-world/README.md Execute the example scenario using the plugin. Set ARTILLERY_PLUGIN_PATH to the plugin's directory and DEBUG for plugin-specific messages. This command will display greetings, debug messages, and the custom counter in the output. ```sh ARTILLERY_PLUGIN_PATH=`pwd`/.. DEBUG=plugin:hello-world artillery run test.yml ``` -------------------------------- ### Install Artillery PostHog Engine Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-engine-posthog/README.md Install the PostHog engine globally using npm. ```sh npm install -g artillery-engine-posthog ``` -------------------------------- ### Install Skytrace Source: https://github.com/artilleryio/artillery/blob/main/packages/skytrace/README.md Install Skytrace globally using npm. This command is required before using Skytrace CLI tools. ```sh npm install -g skytrace ``` -------------------------------- ### Kubernetes Performance Metrics Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md Example output showing performance metrics from a load test. This data helps in analyzing the latency and throughput of the application under test. ```text # min: ......................................................................... 119.3 # max: ......................................................................... 119.3 # median: ...................................................................... 120.3 # p95: ......................................................................... 120.3 # p99: ......................................................................... 120.3 ``` -------------------------------- ### Get Help for a Specific Command Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery/man/artillery.1.md Use the --help flag with a specific command to view its detailed usage information. ```bash artillery run --help ``` -------------------------------- ### Run Netcat Server Source: https://github.com/artilleryio/artillery/blob/main/examples/http-set-custom-header/README.md Start a netcat listener in server mode to capture HTTP requests. This is used to verify that the custom header is being sent. ```shell nc -l 31337 ``` -------------------------------- ### Install Artillery CLI Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery/README.md Install the Artillery command-line interface globally using npm. This command makes the 'artillery' executable available in your system's PATH. ```bash npm install -g artillery ``` -------------------------------- ### Run Artillery Refresh Token Example Source: https://github.com/artilleryio/artillery/blob/main/examples/refresh-auth-token/README.md Execute the Artillery test scenario to observe the token refresh mechanism in action. Set the DEBUG environment variable to http to see detailed request information. ```sh DEBUG=http artillery run refresh.yml ``` -------------------------------- ### Run Artillery Test Source: https://github.com/artilleryio/artillery/blob/main/examples/browser-playwright-reuse-authentication/README.md Execute the Artillery test scenario. The example runs with headless disabled for easy observation. ```sh npx artillery run scenario.yml ``` -------------------------------- ### Get All Movies Source: https://github.com/artilleryio/artillery/blob/main/examples/http-socketio-server/README.md Retrieves a list of all movies available in the system. ```APIDOC ## GET /movies ### Description Returns a list of all the movies. ### Method GET ### Endpoint /movies ### Response #### Success Response (200) - **movies** (array) - A list of movie objects. ### Response Example ```json [ { "id": 1, "releaseDate": "Dec 18 1985", "director": "Terry Gilliam", "title": "Brazil", "genre": "Black Comedy", "imdbRating": 8, "runningTimeMin": 136 }, { "id": 2, "releaseDate": "Feb 16 1996", "director": "Harold Becker", "title": "City Hall", "genre": "Drama", "imdbRating": 6.1, "runningTimeMin": 111 } ] ``` ``` -------------------------------- ### Run Artillery Test Source: https://github.com/artilleryio/artillery/blob/main/examples/soap-with-custom-function/README.md Once the SOAP server is running, execute this command to start the Artillery load test using the 'soap.yml' configuration file. ```bash npx artillery run soap.yml ``` -------------------------------- ### Run Artillery GraphQL Test Script Source: https://github.com/artilleryio/artillery/blob/main/examples/graphql-api-server/README.md Execute the Artillery load test script against the running GraphQL server. Ensure the server is started before running this command. ```shell npx artillery run graphql.yml ``` -------------------------------- ### Configure PostHog Engine in Artillery Script Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-engine-posthog/README.md Example Artillery script configuration for the PostHog engine. Set the PostHog instance URL and API key, and define scenarios to send events. ```yaml config: target: "https://posthog.acme.corp" posthog: apiKey: "{{ $processEnvironment.POSTHOG_API_KEY }}" phases: - arrivalCount: 5 duration: 10 engines: posthog: {} scenarios: - name: "posthog engine test" engine: posthog flow: - count: 3 loop: - capture: distinctId: "distinct id" event: "movie played" properties: movieId: "Die Hard" category: "Christmas" - think: 2 ``` -------------------------------- ### Configure Splunk Metrics and Events Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-plugin-publish-metrics/lib/splunk/README.md Example Artillery configuration to send metrics and events to Splunk. It includes setting the Splunk realm, access token via environment variable, custom metric prefix, dimensions for metrics, and event configuration with custom dimensions and properties. ```yaml config: plugins: publish-metrics: - type: splunk realm: eu0 # SP_ACCESS_TOKEN is an environment variable containing the API key accessToken: '{{ $processEnvironment.SP_ACCESS_TOKEN }}' prefix: 'artillery.publish_metrics_plugin.' dimensions: - 'host:server_1' - 'host_id:1.2.3.4' event: eventType: 'Artillery_load_test' dimensions: - 'environment:production' - 'testId:myTest123' properties: - 'use:QA' ``` -------------------------------- ### Run Smoke Test with YAML Config Source: https://github.com/artilleryio/artillery/blob/main/examples/browser-load-testing-playwright/README.md Configure and run a Playwright script as a smoke test using Artillery with a separate YAML configuration file. This setup is suitable for checking multiple URLs and tracking custom metrics. ```bash npx artillery run browser-smoke-test.yml ``` -------------------------------- ### Create Prisma Database and Tables Source: https://github.com/artilleryio/artillery/blob/main/examples/graphql-api-server/README.md Set up the SQLite database and create the required tables using Prisma. This command applies database migrations. ```shell npx prisma migrate dev ``` -------------------------------- ### HTTP GET /movies/:id Endpoint Source: https://github.com/artilleryio/artillery/blob/main/examples/http-socketio-server/README.md This endpoint retrieves a single movie by its ID. Use this to get details for a specific movie. ```json { "id": 35, "releaseDate": "Oct 01 1999", "director": "David O. Russell", "title": "Three Kings", "genre": "Action", "imdbRating": 7.3, "runningTimeMin": 115 } ``` -------------------------------- ### Display Artillery Help Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery/man/artillery.1.md Run this command to see all available Artillery commands and options. ```bash artillery --help ``` -------------------------------- ### Get Movie by ID Source: https://github.com/artilleryio/artillery/blob/main/examples/http-socketio-server/README.md Retrieves a single movie by its unique identifier. ```APIDOC ## GET /movies/:id ### Description Returns a single movie by its id. ### Method GET ### Endpoint /movies/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the movie. ### Response #### Success Response (200) - **movie** (object) - A single movie object. ### Response Example ```json { "id": 35, "releaseDate": "Oct 01 1999", "director": "David O. Russell", "title": "Three Kings", "genre": "Action", "imdbRating": 7.3, "runningTimeMin": 115 } ``` ``` -------------------------------- ### Generated Artillery Test Script Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md This is an example of an Artillery test script scaffolded from a Kubernetes Service, targeting the '/healthz' endpoint. ```yaml config: target: http://movie-browser-service:80/ environments: functional: phases: - duration: 1 arrivalCount: 1 plugins: expect: {} scenarios: - flow: - get: url: http://movie-browser-service:80/healthz expect: - statusCode: 200 ``` -------------------------------- ### Configure New Relic Metrics Plugin Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-plugin-publish-metrics/lib/newrelic/README.md Set up the publish-metrics plugin to send data to New Relic. Ensure your API key is securely provided via environment variables. ```yaml config: plugins: publish-metrics: - type: newrelic apiKey: '{{ $processEnvironment.NEW_RELIC_LICENSE_KEY }}' prefix: 'artillery.' attributes: - 'type:soak-test' - 'service:my-service' ``` -------------------------------- ### Run a Single Artillery Scenario Source: https://github.com/artilleryio/artillery/blob/main/examples/multiple-scenario-specs/README.md Use the `--config` flag to specify a common configuration file and then provide the path to a specific scenario file to run it. ```sh artillery run --config common-config.yml scenarios/armadillo.yml ``` -------------------------------- ### HTTP GET /movies Endpoint Source: https://github.com/artilleryio/artillery/blob/main/examples/http-socketio-server/README.md This endpoint returns a JSON array of all available movies. It's useful for fetching a list of items. ```json [ { "id": 1, "releaseDate": "Dec 18 1985", "director": "Terry Gilliam", "title": "Brazil", "genre": "Black Comedy", "imdbRating": 8, "runningTimeMin": 136 }, { "id": 2, "releaseDate": "Feb 16 1996", "director": "Harold Becker", "title": "City Hall", "genre": "Drama", "imdbRating": 6.1, "runningTimeMin": 111 } ... ] ``` -------------------------------- ### Connect and Emit with Socket.IO Source: https://github.com/artilleryio/artillery/blob/main/examples/socket-io/public/index.html Establishes a Socket.IO connection and sends an 'echo' message upon successful connection. This is useful for testing basic client-server communication in a Socket.IO application. ```javascript const socket = io(); socket.on("connect", () => { socket.emit("echo", "Hello from Artillery"); }); ``` -------------------------------- ### Deploy Artillery Test to Kubernetes Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md Use kubectl apply with the -k flag to deploy the Kustomize-generated manifests to your Kubernetes cluster. This command initiates the Artillery test. ```shell kubectl apply -k artillery-manifests # configmap/movie-browser-service-test-script created # job.batch/movie-browser-service created ``` -------------------------------- ### Run Artillery with 'preprod' environment Source: https://github.com/artilleryio/artillery/blob/main/examples/script-overrides/README.md Executes an Artillery test script using the 'preprod' configuration environment, suitable for higher TPS pre-production testing. ```bash npx artillery run -e preprod test.yaml ``` -------------------------------- ### Probe a Service Endpoint Source: https://github.com/artilleryio/artillery/blob/main/examples/multiple-scenario-specs/README.md Use skytrace probe to send a GET request to a specified endpoint. This is useful for quickly testing individual service endpoints. ```sh skytrace probe http://asciizoo.artillery.io:8080/armadillo -b ``` -------------------------------- ### Deploy Movie Browser Test Server Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md Apply the Kubernetes manifest to deploy the Movie Browser HTTP test server to your cluster. ```shell kubectl apply -f k8s-deploy.yaml ``` -------------------------------- ### Run Smoke Test with TypeScript Source: https://github.com/artilleryio/artillery/blob/main/examples/browser-load-testing-playwright/README.md Execute a Playwright script as a smoke test using Artillery. This example utilizes CSV payloads for URLs and custom metrics. ```bash npx artillery run browser-smoke-test.ts ``` -------------------------------- ### Verify Movie Browser Deployment Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md Check the status of the deployed Movie Browser components, including pods, services, deployments, and replica sets. ```shell kubectl get all -l app=movie-browser ``` -------------------------------- ### Run Artillery Scenario Weights Test Source: https://github.com/artilleryio/artillery/blob/main/examples/scenario-weights/README.md Execute the Artillery test script that demonstrates scenario weights. Make sure the HTTP server is running before executing this command. ```shell artillery run scenario-weights.yml ``` -------------------------------- ### Run Artillery with PostHog API Key Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-engine-posthog/README.md Execute an Artillery test script, providing the PostHog API key as an environment variable. ```sh POSTHOG_API_KEY=xxx artillery run example.yml ``` -------------------------------- ### Configure New Relic Events and Metrics Plugin Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-plugin-publish-metrics/lib/newrelic/README.md Configure the plugin to send both metrics and custom events to New Relic. This includes setting account ID, event type, and additional attributes for events. ```yaml config: plugins: publish-metrics: - type: newrelic apiKey: '{{ $processEnvironment.NEW_RELIC_LICENSE_KEY }}' prefix: 'artillery.' attributes: - 'type:soak-test' - 'service:my-service' event: accountId: '{{ $processEnvironment.NEW_RELIC_ACCOUNT_ID }}' eventType: 'Artillery_load_test' attributes: 'alertType:info' 'priority:low' 'testId:myTest123' ``` -------------------------------- ### Enable Splunk Debug Logging Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery-plugin-publish-metrics/lib/splunk/README.md Set the DEBUG environment variable to enable detailed logging for the Splunk metrics publisher. This is useful for troubleshooting. ```bash DEBUG=plugin:publish-metrics:splunk artillery run my-script.yaml ``` -------------------------------- ### Run Functional Tests with npm Script Source: https://github.com/artilleryio/artillery/blob/main/examples/table-driven-functional-tests/README.md Execute the functional tests using the npm script defined in the project's package.json. ```sh npm run functional-test ``` -------------------------------- ### Run Simple Load Test with YAML Config Source: https://github.com/artilleryio/artillery/blob/main/examples/browser-load-testing-playwright/README.md Configure and run a Playwright script as a load test using Artillery with a separate YAML configuration file. ```bash npx artillery run browser-load-test.yml ``` -------------------------------- ### Run Artillery test script Source: https://github.com/artilleryio/artillery/blob/main/examples/rpc-twirp-with-custom-function/README.md Execute the Artillery load test scenario against the running Twirp server. ```bash npx artillery run ./test/scenario.yml ``` -------------------------------- ### Kustomize Manifest for Artillery Test Deployment Source: https://github.com/artilleryio/artillery/blob/main/examples/k8s-testing-with-kubectl-artillery/README.md This Kustomize manifest defines resources for deploying an Artillery test to Kubernetes. It includes a Job manifest and a ConfigMap generator to mount the test script. ```yaml kind: Kustomization apiVersion: kustomize.config.k8s.io/v1beta1 namespace: default resources: - test-job.yaml configMapGenerator: - name: movie-browser-service-test-script files: - test-script_movie-browser-service.yaml generatorOptions: labels: artillery.io/component: artilleryio-test-config artillery.io/part-of: artilleryio-test disableNameSuffixHash: true ``` -------------------------------- ### Run Artillery File Upload Test Source: https://github.com/artilleryio/artillery/blob/main/examples/http-file-uploads/README.md Once the HTTP server is running, use this command to execute the Artillery test script for file uploads. ```shell artillery run file-uploads.yml ``` -------------------------------- ### Run Artillery Script Source: https://github.com/artilleryio/artillery/blob/main/examples/generating-vu-tokens/README.md Execute an Artillery test script. Ensure the script is named 'auth-with-token.yml'. ```bash artillery run auth-with-token.yml ``` -------------------------------- ### Artillery CLI Usage Source: https://github.com/artilleryio/artillery/blob/main/packages/artillery/man/artillery.1.md This is the general usage information for the Artillery CLI, outlining available commands and options. ```bash Usage: artillery [options] [command] Commands: run [options]