本文整理汇总了Java中org.apache.jmeter.assertions.ResponseAssertion类的典型用法代码示例。如果您正苦于以下问题:Java ResponseAssertion类的具体用法?Java ResponseAssertion怎么用?Java ResponseAssertion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResponseAssertion类属于org.apache.jmeter.assertions包,在下文中一共展示了ResponseAssertion类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAssertion
import org.apache.jmeter.assertions.ResponseAssertion; //导入依赖的package包/类
/**
* Helper method to add a Response Assertion
* Called from AWT Event thread
*/
private void addAssertion(JMeterTreeModel model, JMeterTreeNode node) throws IllegalUserActionException {
ResponseAssertion ra = new ResponseAssertion();
ra.setProperty(TestElement.GUI_CLASS, ASSERTION_GUI);
ra.setName(JMeterUtils.getResString("assertion_title")); // $NON-NLS-1$
ra.setTestFieldResponseData();
model.addComponent(ra, node);
}
示例2: 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;
}
示例3: createTestElement
import org.apache.jmeter.assertions.ResponseAssertion; //导入依赖的package包/类
@Override
public TestElement createTestElement() {
ResponseAssertion el = new ResponseAssertion();
modifyTestElement(el);
return el;
}
示例4: 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();
}
}
}
示例5: configure
import org.apache.jmeter.assertions.ResponseAssertion; //导入依赖的package包/类
/**
* A newly created component can be initialized with the contents of a Test
* Element object by calling this method. The component is responsible for
* querying the Test Element object for the relevant information to display
* in its GUI.
*
* @param el
* the TestElement to configure
*/
@Override
public void configure(TestElement el) {
super.configure(el);
ResponseAssertion model = (ResponseAssertion) el;
showScopeSettings(model, true);
if (model.isContainsType()) {
containsBox.setSelected(true);
} else if (model.isEqualsType()) {
equalsBox.setSelected(true);
} else if (model.isSubstringType()) {
substringBox.setSelected(true);
} else {
matchesBox.setSelected(true);
}
notBox.setSelected(model.isNotType());
if (model.isTestFieldResponseData()) {
responseStringButton.setSelected(true);
} else if (model.isTestFieldResponseDataAsDocument()) {
responseAsDocumentButton.setSelected(true);
} else if (model.isTestFieldResponseCode()) {
responseCodeButton.setSelected(true);
} else if (model.isTestFieldResponseMessage()) {
responseMessageButton.setSelected(true);
} else if (model.isTestFieldResponseHeaders()) {
responseHeadersButton.setSelected(true);
} else // Assume it is the URL
{
urlButton.setSelected(true);
}
assumeSuccess.setSelected(model.getAssumeSuccess());
tableModel.clearData();
PropertyIterator tests = model.getTestStrings().iterator();
while (tests.hasNext()) {
tableModel.addRow(new Object[] { tests.next().getStringValue() });
}
if (model.getTestStrings().size() == 0) {
deletePattern.setEnabled(false);
} else {
deletePattern.setEnabled(true);
}
tableModel.fireTableDataChanged();
}