Skip to content

abstracta/jmeter-dotnet-dsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Simple .Net API to run performance tests, using JMeter as engine, in a Git and programmers friendly way.

If you like this project, please give it a star ⭐! This helps the project be more visible, gain relevance, and encourage us to invest more effort in new features.

Here, you can find the Java DSL.

Please join discord server or create GitHub issues and discussions to be part of the community and clear out doubts, get the latest news, propose ideas, report issues, etc.

Usage

Add the package to your project:

dotnet add package Abstracta.JmeterDsl --version 0.6

Here is a simple example test using Nunit+ with 2 threads/users iterating 10 times each to send HTTP POST requests with a JSON body to http://my.service:

using System.Net.Http.Headers;
using System.Net.Mime;
using static Abstracta.JmeterDsl.JmeterDsl;

public class PerformanceTest
{
    [Test]
    public void LoadTest()
    {
        var stats = TestPlan(
            ThreadGroup(2, 10,
                HttpSampler("http://my.service")
                    .Post("{\"name\": \"test\"}", new MediaTypeHeaderValue(MediaTypeNames.Application.Json))
            ),
            //this is just to log details of each request stats
            JtlWriter("jtls")
        ).Run();
        Assert.That(stats.Overall.SampleTimePercentile99, Is.LessThan(TimeSpan.FromSeconds(5)));
    }
}

Java 8+ is required for test plan execution.

More examples can be found in tests

Here is a sample project for reference or for starting new projects from scratch.

Tip 1: When working with multiple samplers in a test plan, specify their names to easily check their respective statistics.

Tip 2: Since JMeter uses log4j2, if you want to control the logging level or output, you can use something similar to the tests included log4j2.xml, using "CopyToOutputDirectory" in the project item so the file is available in dotnet build output directory as well (check [Abstracta.JmeterDsl.Test/Abstracta.JmeterDsl.Tests.csproj]).

Check here for details on some interesting use cases, like running tests at scale in Azure Load Testing, and general usage guides.

Why?

Check more about the motivation and analysis of alternatives here

Support

Join our Discord server to engage with fellow JMeter DSL enthusiasts, ask questions, and share experiences. Visit GitHub Issues or GitHub Discussions for bug reports, feature requests and share ideas.

Abstracta, the main supporter for JMeter DSL development, offers enterprise-level support. Get faster response times, personalized customizations and consulting.

For detailed support information, visit our Support page.

Articles & Talks

Check articles and talks mentioning the Java version here.

Ecosystem

  • Jmeter Java DSL: Java API which is the base of the .Net API.
  • pymeter: Python API based on JMeter Java DSL that allows Python devs to create and run JMeter test plans.

Contributing & Requesting features

Currently, the project covers some of the most used features of JMeter and JMeter Java DSL test, but not everything, as we keep improving it to cover more use cases.

We invest in the development of DSL according to the community's (your) interest, which we evaluate by reviewing GitHub stars' evolution, feature requests, and contributions.

To keep improving the DSL we need you to please create an issue for any particular feature or need that you have.

We also really appreciate pull requests. Check the CONTRIBUTING guide for an explanation of the main library components and how you can extend the library.