mirror of https://github.com/apache/jmeter.git
Save Response file name in sample; optionally save in log file
git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/branches/rel-2-1@392436 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: 62183a4b0b
This commit is contained in:
parent
cfbaaa09d4
commit
cdda0a9d8e
|
|
@ -575,6 +575,7 @@ save_code=Save Response Code
|
||||||
save_datatype=Save Data Type
|
save_datatype=Save Data Type
|
||||||
save_encoding=Save Encoding
|
save_encoding=Save Encoding
|
||||||
save_fieldnames=Save Field Names
|
save_fieldnames=Save Field Names
|
||||||
|
save_filename=Save Response Filename
|
||||||
save_graphics=Save Graph
|
save_graphics=Save Graph
|
||||||
save_label=Save Label
|
save_label=Save Label
|
||||||
save_latency=Save Latency
|
save_latency=Save Latency
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,15 @@ import java.util.Properties;
|
||||||
import org.apache.jmeter.testelement.TestPlan;
|
import org.apache.jmeter.testelement.TestPlan;
|
||||||
import org.apache.jmeter.util.JMeterUtils;
|
import org.apache.jmeter.util.JMeterUtils;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* N.B. to add a new field, remember the following
|
||||||
|
* - static _xyz
|
||||||
|
* - instance xyz=_xyz
|
||||||
|
* - clone s.xyz = xyz
|
||||||
|
* - setXyz(boolean)
|
||||||
|
* - saveXyz()
|
||||||
|
* - update SampleSaveConfigurationConverter to add new field
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Holds details of which sample attributes to save.
|
* Holds details of which sample attributes to save.
|
||||||
*
|
*
|
||||||
|
|
@ -364,6 +373,7 @@ public class SampleSaveConfiguration implements Cloneable, Serializable {
|
||||||
s.responseDataOnError = responseDataOnError;
|
s.responseDataOnError = responseDataOnError;
|
||||||
s.url = url;
|
s.url = url;
|
||||||
s.bytes = bytes;
|
s.bytes = bytes;
|
||||||
|
s.fileName = fileName;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ public final class OldSaveService {
|
||||||
private static final String CSV_TIME = "elapsed"; // $NON-NLS-1$
|
private static final String CSV_TIME = "elapsed"; // $NON-NLS-1$
|
||||||
private static final String CSV_BYTES= "bytes"; // $NON-NLS-1$
|
private static final String CSV_BYTES= "bytes"; // $NON-NLS-1$
|
||||||
private static final String CSV_URL = "URL"; // $NON-NLS-1$
|
private static final String CSV_URL = "URL"; // $NON-NLS-1$
|
||||||
|
private static final String CSV_FILENAME = "Filename"; // $NON-NLS-1$
|
||||||
|
|
||||||
// Initial config from properties
|
// Initial config from properties
|
||||||
static private final SampleSaveConfiguration _saveConfig = SampleSaveConfiguration.staticConfig();
|
static private final SampleSaveConfiguration _saveConfig = SampleSaveConfiguration.staticConfig();
|
||||||
|
|
@ -251,6 +252,11 @@ public final class OldSaveService {
|
||||||
text.append(delim);
|
text.append(delim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (saveConfig.saveFileName()) {
|
||||||
|
text.append(CSV_FILENAME);
|
||||||
|
text.append(delim);
|
||||||
|
}
|
||||||
|
|
||||||
String resultString = null;
|
String resultString = null;
|
||||||
int size = text.length();
|
int size = text.length();
|
||||||
int delSize = delim.length();
|
int delSize = delim.length();
|
||||||
|
|
@ -552,6 +558,11 @@ public final class OldSaveService {
|
||||||
text.append(delimiter);
|
text.append(delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (saveConfig.saveFileName()) {
|
||||||
|
text.append(sample.getResultFileName());
|
||||||
|
text.append(delimiter);
|
||||||
|
}
|
||||||
|
|
||||||
String resultString = null;
|
String resultString = null;
|
||||||
int size = text.length();
|
int size = text.length();
|
||||||
int delSize = delimiter.length();
|
int delSize = delimiter.length();
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@ public class SaveService {
|
||||||
checkVersion(TestElementPropertyConverter.class, "332820"); // $NON-NLS-1$
|
checkVersion(TestElementPropertyConverter.class, "332820"); // $NON-NLS-1$
|
||||||
checkVersion(ScriptWrapperConverter.class, "390848"); // $NON-NLS-1$
|
checkVersion(ScriptWrapperConverter.class, "390848"); // $NON-NLS-1$
|
||||||
checkVersion(TestResultWrapperConverter.class, "332820"); // $NON-NLS-1$
|
checkVersion(TestResultWrapperConverter.class, "332820"); // $NON-NLS-1$
|
||||||
checkVersion(SampleSaveConfigurationConverter.class,"390698"); // $NON-NLS-1$
|
checkVersion(SampleSaveConfigurationConverter.class,"392354"); // $NON-NLS-1$
|
||||||
|
|
||||||
if (!PROPVERSION.equalsIgnoreCase(propertiesVersion)) {
|
if (!PROPVERSION.equalsIgnoreCase(propertiesVersion)) {
|
||||||
log.warn("Bad _version - expected " + PROPVERSION + ", found " + propertiesVersion + ".");
|
log.warn("Bad _version - expected " + PROPVERSION + ", found " + propertiesVersion + ".");
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ public class SampleResultConverter extends AbstractCollectionConverter {
|
||||||
protected static final String TAG_RESPONSE_DATA = "responseData"; //$NON-NLS-1$
|
protected static final String TAG_RESPONSE_DATA = "responseData"; //$NON-NLS-1$
|
||||||
protected static final String TAG_RESPONSE_HEADER = "responseHeader"; //$NON-NLS-1$
|
protected static final String TAG_RESPONSE_HEADER = "responseHeader"; //$NON-NLS-1$
|
||||||
protected static final String TAG_SAMPLER_DATA = "samplerData"; //$NON-NLS-1$
|
protected static final String TAG_SAMPLER_DATA = "samplerData"; //$NON-NLS-1$
|
||||||
|
protected static final String TAG_RESPONSE_FILE = "responseFile"; //$NON-NLS-1$
|
||||||
|
|
||||||
// samplerData attributes. Must be unique. Keep sorted.
|
// samplerData attributes. Must be unique. Keep sorted.
|
||||||
private static final String ATT_BYTES = "by"; //$NON-NLS-1$
|
private static final String ATT_BYTES = "by"; //$NON-NLS-1$
|
||||||
|
|
@ -161,6 +162,12 @@ public class SampleResultConverter extends AbstractCollectionConverter {
|
||||||
}
|
}
|
||||||
writer.endNode();
|
writer.endNode();
|
||||||
}
|
}
|
||||||
|
if (save.saveFileName()){
|
||||||
|
writer.startNode(TAG_RESPONSE_FILE);
|
||||||
|
writer.addAttribute(ATT_CLASS, JAVA_LANG_STRING);
|
||||||
|
writer.setValue(res.getResultFileName());
|
||||||
|
writer.endNode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,9 @@ Users must explicitly check append in the sampler</li>
|
||||||
<li>Make it easier to change the RMI/Server port</li>
|
<li>Make it easier to change the RMI/Server port</li>
|
||||||
<li>Add property jmeter.save.saveservice.xml_pi to provide optional xml processing instruction in JTL files</li>
|
<li>Add property jmeter.save.saveservice.xml_pi to provide optional xml processing instruction in JTL files</li>
|
||||||
<li>Add bytes and URL to items that can be saved in sample log files (XML and CSV)</li>
|
<li>Add bytes and URL to items that can be saved in sample log files (XML and CSV)</li>
|
||||||
<li></li>
|
<li>The Post-Processor "Save Responses to a File" now saves the generated file name with the
|
||||||
|
sample, and the file name can be included in the sample log file.
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h4>Bug fixes:</h4>
|
<h4>Bug fixes:</h4>
|
||||||
|
|
|
||||||
|
|
@ -2752,7 +2752,9 @@ generate the template string, and store the result into the given variable name.
|
||||||
For each sample in its scope, it will create a file of the response Data.
|
For each sample in its scope, it will create a file of the response Data.
|
||||||
The primary use for this is in creating functional tests.
|
The primary use for this is in creating functional tests.
|
||||||
The file name is created from the specified prefix, plus a number.
|
The file name is created from the specified prefix, plus a number.
|
||||||
The file extension is created from the document type, if know.
|
The file extension is created from the document type, if known.
|
||||||
|
The generated file name is stored in the sample response, and can be saved
|
||||||
|
in the test log output file if required.
|
||||||
</description>
|
</description>
|
||||||
<properties>
|
<properties>
|
||||||
<property name="Name" required="">Descriptive name for this element that is shown in the tree.</property>
|
<property name="Name" required="">Descriptive name for this element that is shown in the tree.</property>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue