apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.09k stars 2.05k forks source link

ThreadGroup line 273 cloneTree(threadGroupTree),I have setted CSVDataSet with filename,but after cloneTree,my filename was lost #6293

Open rosas opened 2 weeks ago

rosas commented 2 weeks ago

Expected behavior

I hope cloneTree will not lost data in threadGroupTree

Actual behavior

after cloneTree, my data has lost

Steps to reproduce the problem

企业微信截图_1718778965654 企业微信截图_17187789881176

// 创建一个CSV Data Set Config元件 CSVDataSet csvDataSet = new CSVDataSet(); csvDataSet.setFilename("D:\work\user.csv"); // CSV文件路径 csvDataSet.setVariableNames("username,password"); // CSV文件中的列名 csvDataSet.setDelimiter(","); // CSV文件的分隔符

    // 创建一个 LoopController
    LoopController loopController = new LoopController();
    loopController.setLoops(1);  // 设置循环次数
    loopController.initialize();

    ThreadGroup threadGroup = new ThreadGroup();
    threadGroup.setNumThreads(1);
    threadGroup.setRampUp(0);
    threadGroup.setSamplerController(loopController);

    // 创建一个TestPlan
    TestPlan testPlan = new TestPlan("My Test Plan");

        // 创建一个HashTree来保存TestPlan
        ListedHashTree loginPlanTree = new ListedHashTree();
        ListedHashTree threadGroupHashTree = (ListedHashTree) loginPlanTree.add(testPlan, threadGroup);
        threadGroupHashTree.add(cookieManager);
        threadGroupHashTree.add(csvDataSet);

JMeter Version

5.6.3

Java Version

java 17.0.10 2024-01-16 LTS Java(TM) SE Runtime Environment Oracle GraalVM 17.0.10+11.1 (build 17.0.10+11-LTS-jvmci-23.0-b27) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.10+11.1 (build 17.0.10+11-LTS-jvmci-23.0-b27, mixed mode, sharing)

OS Version

Microsoft Windows 11 家庭中文版

rosas commented 2 weeks ago

the second picture more info

企业微信截图_1718778965654

we must set like this can work well csvDataSet.setProperty("filename", "D:\work\user.csv");