GithubHelp home page GithubHelp logo

jackliucrypto / jmeter-from-java-code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from a-venger/jmeter-from-java-code

0.0 0.0 0.0 79.8 MB

JMeter script from Java code

Shell 0.06% JavaScript 59.61% Java 4.85% CSS 9.62% HTML 25.83% Batchfile 0.03%

jmeter-from-java-code's Introduction

README

This is example project demonstrating creation of JMeter script via Java API followed by execution. Also you are able to run existing JMeter script with Java code.

This example of JMeter script via Java API covers:

  • Running more than one sample
  • Using timers with random pauses
  • Using CSV Data Set for achieving data from CSV files
  • Cookie managment via Cookie Manager
  • Using Transaction Controller with generating parent sample
  • Store generated JMeter test as .jmx file
  • Store test execution results as .jtl file
  • Store and open HTML report in default browser

Requirements

The following requirements exist for running Apache JMeter:

  • Java Interpreter:

    A fully compliant Java 8 Runtime Environment is required for Apache JMeter to execute.

JMX example structure:

Scenario Structure

Configuration instructions

You can simply execute ready to run examples. The commands are simple. To open and run existing JMX simply execute in command line from jar directory.

java -jar openJMX-jar-with-dependencies.jar

To run example of JMeter script via Java API execute in command line from jar directory.

java -jar example-jar-with-dependencies.jar

You can also run those via prepared scripts (.bat - for Windows and .sh - for Linux). They are provided in project root.

You can expand exectuion by providing additional parameters.

  • -Djmeter.home=YOUR_JMETER_LOCATION - to use your jmeter properties and store result files there.
  • -DtestPlan.location=YOUR_JMX_LOCATION - to run existing JMX via openJMX class

So expanded commands will look like this:

To open and run existing jmx and providing your JMeter location

java -Djmeter.home=YOUR_JMETER_LOCATION -DtestPlan.location=YOUR_JMX_LOCATION -jar openJMX-jar-with-dependencies.jar

To run example of JMeter script via Java API and providing your JMeter location

java -Djmeter.home=YOUR_JMETER_LOCATION -jar example-jar-with-dependencies.jar

Implementation

Inspect JMeterFromCode.java and OpenJMX.java source files at Source page for details on how it is implemented.

jmeter-from-java-code's People

Contributors

a-venger 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.