How to use artillery - 3 common examples

To help you get started, we’ve selected a few artillery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github artilleryio / artillery-plugin-expect / test / index.js View on Github external
import test from 'ava';
import createDebug from 'debug';
const debug = createDebug('expect-plugin:test');
import EventEmitter from 'events';

const shelljs = require('shelljs');
const path = require('path');

//
// We only need this when running unit tests. When the plugin actually runs inside
// a recent version of Artillery, the appropriate object is already set up.
//
global.artillery = {
  util: {
    template: require('artillery/util').template
  }
};

test('Basic interface checks', async t => {
  const script = {
    config: {},
    scenarios: []
  };

  const ExpectationsPlugin = require('../index');
  const events = new EventEmitter();
  const plugin = new ExpectationsPlugin.Plugin(script, events);

  t.true(typeof ExpectationsPlugin.Plugin === 'function');
  t.true(typeof plugin === 'object');
github artilleryio / artillery-plugin-expect / lib / expectations.js View on Github external
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict';

const debug = require('debug')('plugin:expect');
const chalk = require('chalk');
const template = global.artillery ? global.artillery.util.template : require('artillery/util').template;
const _ = require('lodash');

module.exports = {
  contentType: expectContentType,
  statusCode: expectStatusCode,
  hasProperty: expectHasProperty,
  equals: expectEquals
};

function expectEquals(expectation, body, req, res, userContext) {
  debug('check equals');
  debug('expectation:', expectation);
  debug('body:', typeof body);

  let result = {
    ok: false,

artillery

Cloud-scale load testing. https://www.artillery.io

MPL-2.0
Latest version published 2 months ago

Package Health Score

89 / 100
Full package analysis

Popular artillery functions