Git Product home page Git Product logo

onsdigital.eq-performance-test's Introduction

eq-performance-test

Background

This repo is a suite of performance tests to be run against the survey-runner component of the EQ platform using JMeter. It uses ruby-jmeter to generate the Jmeter XML definition rather than editing the XML directly or via the GUI.

Installation

It is recommended to run Ruby with rbenv (https://github.com/rbenv/rbenv)

After installing rbenv, clone this repository and install the ruby version needed:

rbenv install

Then install bundler (http://bundler.io/):

gem install bundler

And install the gems needed by this project:

bundle install

Finally install jmeter:

brew install jmeter

How to run

ruby survey_runner_jmeter.rb

Build with docker

docker build . -t eq-performance-test

Run with docker

docker run \
	-e HOST=hostname \
	-e PROTOCOL=http \
	-e PORT=5000 \
	-e USERS=100 \
	-e REPEAT=10 \
	-v ~/testResults:/eq-performance-test/results \
   eq-performance-test

This opens JMeter with the Ruby generated .jmx file. You're ready to run the tests in JMeter now.

To run against a local survey runner on MacOS you will need to add an alias to the loopback network device by running sudo ifconfig lo0 alias 10.200.10.1/24 then you can set the environmental variable HOST to 10.200.10.1. See https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds

Further Information

See https://github.com/flood-io/ruby-jmeter

See http://jmeter.apache.org/

Mapping to JMeter

ruby-jmeter provides a simple mapping between Ruby functions and JMeter XML elements so you can add any JMeter XML element by selecting the right Ruby function and setting the related properties.

A quick way to do this is to look at the DSL help:

https://github.com/flood-io/ruby-jmeter/blob/master/lib/ruby-jmeter/DSL.md

Which provides a list of the JMeter elements and their Ruby function equivalents. For example, to add a JMeter "Random Variable" http://jmeter.apache.org/usermanual/component_reference.html#Random_Variable

The DSL.md shows this to be:

Random Variable random_variable

Looking at this in the DSL here:

https://github.com/flood-io/ruby-jmeter/blob/master/lib/ruby-jmeter/dsl/random_variable.rb

You can see the various properties that can be set on this in the XML:

@doc = Nokogiri::XML(<<-EOS.strip_heredoc)
<RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="#{testname}" enabled="true">
  <stringProp name="maximumValue"/>
  <stringProp name="minimumValue">1</stringProp>
  <stringProp name="outputFormat"/>
  <boolProp name="perThread">false</boolProp>
  <stringProp name="randomSeed"/>
  <stringProp name="variableName"/>
</RandomVariableConfig>)
      EOS

e.g. maximumValue and variableName, so using this in the Ruby script would look like:

    random_variable maximumValue: 10000000,
        minimumValue: 1,
        perThread: false,
        variableName: 'ru_ref'

This kind of approach can be used to add any JMeter XML elements to the Ruby scripts e.g. http_request or regular_expression_extractor

See also https://github.com/flood-io/ruby-jmeter/tree/master/examples

onsdigital.eq-performance-test's People

Contributors

ajmaddaford avatar benjefferies avatar collisdigital avatar dhilton avatar jonnyshaw89 avatar nealedj avatar warrenbailey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.