我已经用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中使用以下代码调用非gui的jmeter
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文件未找到异常错误抛出。
我将jmx和csv文件存储在同一个文件夹中。filetestcasename -读取jmx文件并在saveservice中添加。
如何解决这个问题
您是否提到完整的CSV文件名,即C:/SourceFiles/filename.csv ?