我已经用 CSVDataConfig 记录了 jmeter 脚本。我提到了 csv 配置文件位置为“search.csv”,如
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="true">
<stringProp name="delimiter">,</stringProp>
<stringProp name="fileEncoding"></stringProp>
<stringProp name="filename">search.csv</stringProp>
<boolProp name="quotedData">false</boolProp>
<boolProp name="recycle">true</boolProp>
<stringProp name="shareMode">shareMode.all</stringProp>
<boolProp name="stopThread">true</boolProp>
<stringProp name="variableNames">searchkeyword</stringProp></CSVDataSet>
现在我在java中使用以下代码调用jmeter非gui
public String sJMeterHome = "C:/Apache/apache-jmeter-2.13";
public String sJMeterProprtiesPath = "C:/Apache/apache-jmeter-2.13/bin/jmeter.properties";
String sUrlTestScriptFilePath = "C:/SourceFiles";
FileInputStream oFileTestCaseNameCSV = new FileInputStream(sUrlTestScriptCSVFilePath);
JMeterUtils.setJMeterHome(sJMeterHome);
JMeterUtils.loadJMeterProperties(sJMeterProprties.getPath());
JMeterUtils.initLogging();// you can comment this line out to see extra log messages of i.e. DEBUG level
JMeterUtils.initLocale();
StandardJMeterEngine jmeter = new StandardJMeterEngine();
HashTree testPlanTree = new HashTree();
SaveService.loadProperties();
testPlanTree = SaveService.loadTree(oFileTestCaseName);
jmeter.configure(testPlanTree);
jmeter.run();
现在的问题是 csv file not found 抛出异常错误。
我将 jmx 和 csv 文件存储在同一个文件夹中。oFileTestCaseName - 读取 jmx 文件并添加到 saveservice。
我该如何解决这个问题