我用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 non 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文件未找到异常错误抛出。
我将jmx和csv文件存储在同一个文件夹中。 oFileTestCaseName - 读取jmx文件并添加到saveservice。
如何解决此问题
答案 0 :(得分:0)
您是否提到完整的CSV文件名,即C:/SourceFiles/filename.csv?