abstracta / jmeter-dotnet-dsl

Simple JMeter performance tests .Net API
https://abstracta.github.io/jmeter-dotnet-dsl/
Apache License 2.0
41 stars 1 forks source link

Error when trying to execute a simple test using a CSV file and Azure Load Testing #11

Closed lfraile closed 2 months ago

lfraile commented 2 months ago

Hello, I have simple load test like this:

[Fact]
public void Ping10Times()
{
    var configuration = new ConfigurationBuilder()
                                   .SetBasePath(Directory.GetCurrentDirectory())
                                   .AddJsonFile("appsettings.json")
                                   .AddUserSecrets<LfraileNetTests>()
                                   .AddEnvironmentVariables()
                                   .Build();
    var stats = TestPlan(
        CsvDataSet("urls.csv")
        .SharedIn(Abstracta.JmeterDsl.Core.Configs.DslCsvDataSet.Sharing.Thread),
        ThreadGroup(1, 10,
        HttpSampler("https://www.lfraile.net/${url}")
        ),
        JtlWriter("jtls")
    )
    .RunIn(
        new AzureEngine(
            tenantId: configuration["LoadTesting:TenantId"],
            clientId: configuration["LoadTesting:ClientId"],
            clientSecret: configuration["LoadTesting:ClientSecret"])
    .TestName("lfloadtestsdemo")
    .SubscriptionId(configuration["LoadTesting:SubscriptionId"])
    .TestResourceName(configuration["LoadTesting:TestResourceName"])
    .ResourceGroupName(configuration["LoadTesting:TestResourceGroup"])
    .Engines(1)
    .TestTimeout(TimeSpan.FromMinutes(5)));
    Assert.True(stats.Overall.Errors.Total == 0);
    Assert.True(stats.Overall.SampleTimePercentile99 < TimeSpan.FromSeconds(5));
}

And the "urls.csv":

url
2019/03/03/environment-variables-and-azure-pipelines/
2019/03/09/opinion-what-and-why-yaml-azure-pipelines/
2019/03/30/some-ideas-on-feature-flags/

And when I try to run it, locally or even for example with GitHub Actions, I always get this error:

[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.5.7+8f2703126a (64-bit .NET 8.0.2)
[xUnit.net 00:00:00.05]   Starting:    PoC.LoadTest.Dsl
[xUnit.net 00:00:02.16]     PoC.LoadTest.Dsl.LfraileNetTests.Ping10Times [FAIL]
[xUnit.net 00:00:02.16]       Abstracta.JmeterDsl.Core.Bridge.JvmException : JVM execution failed. Check stderr and stdout for additional info.
[xUnit.net 00:00:02.16]       Stack Trace:
[xUnit.net 00:00:02.16]            at Abstracta.JmeterDsl.Core.Bridge.BridgeService.WaitJvmProcessExit(Process process)
[xUnit.net 00:00:02.16]            at Abstracta.JmeterDsl.Core.Bridge.BridgeService.RunBridgeCommand(String command, Object testElement, String args)
[xUnit.net 00:00:02.16]            at Abstracta.JmeterDsl.Core.Bridge.BridgeService.RunTestPlanInEngine(DslTestPlan testPlan, IDslJmeterEngine engine)
[xUnit.net 00:00:02.16]            at Abstracta.JmeterDsl.Core.Engines.BaseJmeterEngine`1.Run(DslTestPlan testPlan)
[xUnit.net 00:00:02.16]            at Abstracta.JmeterDsl.Core.DslTestPlan.RunIn(IDslJmeterEngine engine)
[xUnit.net 00:00:02.16]         C:\ws\lfraileorg\jmeter-dsl-net\PoC.LoadTest.Dsl\LfraileNetTests.cs(18,0): at PoC.LoadTest.Dsl.LfraileNetTests.Ping10Times()
[xUnit.net 00:00:02.16]            at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
[xUnit.net 00:00:02.16]            at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
[xUnit.net 00:00:02.17]   Finished:    PoC.LoadTest.Dsl

If I run the test without Azure Load Testing involved (Just a simple .Run() ) it works perfectly, or if I try tu run the test in Azure Load Testing but without the CSV file.

Is this supported?, Thank you!

lfraile commented 2 months ago

Sorry closing this, it was my fault with a client secret expired I didn't noticed🤦

rabelenda commented 2 months ago

Hello, thank you for bringing it anyways.

I didn't answer because I wanted to be able to reproduce it before answering.

I am glad that you could solve it and it wasn't a bug or missing feature in the DSL :)