本文整理匯總了Java中org.apache.jmeter.samplers.SampleResult.addAssertionResult方法的典型用法代碼示例。如果您正苦於以下問題:Java SampleResult.addAssertionResult方法的具體用法?Java SampleResult.addAssertionResult怎麽用?Java SampleResult.addAssertionResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.jmeter.samplers.SampleResult
的用法示例。
在下文中一共展示了SampleResult.addAssertionResult方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public void process() {
SampleResult prev = getThreadContext().getPreviousResult();
if (prev == null) return;
String xml = prev.getResponseDataAsString();
if (xml == null) return;
try {
log.debug("Parsing xml response");
Document doc = stringToDocument(xml);
log.debug("Processing WSS header");
doc = this.process(doc); // Delegate in abstract method
prev.setResponseData(documentToString(doc), prev.getDataEncodingWithDefault());
}
catch (Exception e) {
log.error("Processing failed! ", e);
if (e instanceof WSSecurityException && JMeterUtils.getPropDefault(FAIL_ON_WSS_EXCEPTION, true)) {
AssertionResult assertionResult = new AssertionResult("WSSecurityException").setResultForFailure(e.getMessage());
assertionResult.setError(true);
assertionResult.setFailure(true);
prev.addAssertionResult(assertionResult);
prev.setSuccessful(false);
}
}
}