本文整理汇总了Java中org.apache.jmeter.assertions.ResponseAssertion.setTestFieldResponseHeaders方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseAssertion.setTestFieldResponseHeaders方法的具体用法?Java ResponseAssertion.setTestFieldResponseHeaders怎么用?Java ResponseAssertion.setTestFieldResponseHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.assertions.ResponseAssertion
的用法示例。
在下文中一共展示了ResponseAssertion.setTestFieldResponseHeaders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTestElement
import org.apache.jmeter.assertions.ResponseAssertion; //导入方法依赖的package包/类
public TestElement getTestElement() {
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(testString);
ResponseAssertion assertion = new ResponseAssertion();
assertion.setProperty(TestElement.GUI_CLASS, AssertionGui.class.getName());
assertion.setProperty(TestElement.TEST_CLASS, ResponseAssertion.class.getName());
assertion.setName(name);
assertion.setEnabled(true);
switch (responseField) {
case TEXT:
assertion.setTestFieldResponseData();
break;
case DOCUMENT:
assertion.setTestFieldResponseDataAsDocument();
break;
case URL:
assertion.setTestFieldURL();
break;
case RESPONSE_CODE:
assertion.setTestFieldResponseCode();
break;
case RESPONSE_MESSAGE:
assertion.setTestFieldResponseMessage();
break;
case RESPONSE_HEADERS:
assertion.setTestFieldResponseHeaders();
break;
}
if (ignoreStatus) assertion.setAssumeSuccess(!ignoreStatus);
switch (responsePatternType) {
case CONTAINS:
assertion.setToContainsType();
break;
case MATCHES:
assertion.setToMatchType();
break;
case EQUALS:
assertion.setToEqualsType();
break;
case SUBSTRING:
assertion.setToSubstringType();
break;
}
if (not) assertion.setToNotType();
assertion.addTestString(testString);
return assertion;
}
示例2: modifyTestElement
import org.apache.jmeter.assertions.ResponseAssertion; //导入方法依赖的package包/类
@Override
public void modifyTestElement(TestElement el) {
GuiUtils.stopTableEditing(stringTable);
configureTestElement(el);
if (el instanceof ResponseAssertion) {
ResponseAssertion ra = (ResponseAssertion) el;
saveScopeSettings(ra);
ra.clearTestStrings();
String[] testStrings = tableModel.getData().getColumn(COL_RESOURCE_NAME);
for (String testString : testStrings) {
ra.addTestString(testString);
}
if (responseStringButton.isSelected()) {
ra.setTestFieldResponseData();
} else if (responseAsDocumentButton.isSelected()) {
ra.setTestFieldResponseDataAsDocument();
} else if (responseCodeButton.isSelected()) {
ra.setTestFieldResponseCode();
} else if (responseMessageButton.isSelected()) {
ra.setTestFieldResponseMessage();
} else if (responseHeadersButton.isSelected()) {
ra.setTestFieldResponseHeaders();
} else { // Assume URL
ra.setTestFieldURL();
}
ra.setAssumeSuccess(assumeSuccess.isSelected());
if (containsBox.isSelected()) {
ra.setToContainsType();
} else if (equalsBox.isSelected()) {
ra.setToEqualsType();
} else if (substringBox.isSelected()) {
ra.setToSubstringType();
} else {
ra.setToMatchType();
}
if (notBox.isSelected()) {
ra.setToNotType();
} else {
ra.unsetNotType();
}
}
}