rollno748 / Extended-csv-dataset-config

This plugin will enable Apache JMeter users to have similar parameter advantage as LoadRunner
MIT License
25 stars 7 forks source link

[bug] Plugin does not work in jmeter server/distributed mode #19

Closed georgejdli closed 3 months ago

georgejdli commented 3 months ago

(Thanks for creating and supporting this plugin!)

How to replicate: run jmeter in distributed mode

The error message

source code

2024-03-05 23:23:16,510 INFO o.a.j.p.j.s.J.JSR223 Sampler: JMeter.NonGui: null

rollno748 commented 3 months ago

Hey @georgejdli

Thanks for bringing up this issue. I have never tested this on distributed testing. Will give it a try and fix it at the earliest

Thanks

georgejdli commented 3 months ago

I'm not sure if there's a more robust way to determine if Jmeter is running in server mode but this is my quick fix to get the plugin working in distributed mode. The system property server_port will always be set for my use case so I do a check for that.

private boolean isServerMode() {
        return System.getProperty("server_port") != null;
    }

    @Override
    public void testStarted() {
        FileServerExtended fileServer = FileServerExtended.getFileServer();
        if(JMeter.isNonGUI() || isServerMode()){
            String baseDirectory = org.apache.jmeter.services.FileServer.getFileServer().getBaseDir();
            fileServer.setBasedir(baseDirectory);
        }else {
            String testPlanFile = GuiPackage.getInstance().getTestPlanFile();
            fileServer.setBasedir(testPlanFile);
        }
    }
rollno748 commented 3 months ago

Hey that is what I thought of doing it - Its like i am re-inventing the wheel :P Can you just do a Pull request ? contributions are always welcome mate !

georgejdli commented 3 months ago

Hey that is what I thought of doing it - Its like i am re-inventing the wheel :P Can you just do a Pull request ? contributions are always welcome mate !

I have opened a PR

rollno748 commented 3 months ago

Apologies, I was busy away... Thanks for the PR - I will merge it tomorrow

Thanks again

rollno748 commented 3 months ago

Fixes were merged to master and release has been published to plugins manager (2.2) Thanks @georgejdli for the contribution

Do support us by hitting star and feel free to open up issues if you experience a bug If you have ideas - please feel free to create a feature request :)