当前位置: 首页>>代码示例>>Java>>正文


Java AbstractScopedAssertion.isScopeChildren方法代码示例

本文整理汇总了Java中org.apache.jmeter.testelement.AbstractScopedAssertion.isScopeChildren方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractScopedAssertion.isScopeChildren方法的具体用法?Java AbstractScopedAssertion.isScopeChildren怎么用?Java AbstractScopedAssertion.isScopeChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jmeter.testelement.AbstractScopedAssertion的用法示例。


在下文中一共展示了AbstractScopedAssertion.isScopeChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkAssertions

import org.apache.jmeter.testelement.AbstractScopedAssertion; //导入方法依赖的package包/类
private void checkAssertions(List<Assertion> assertions, SampleResult parent, JMeterContext threadContext) {
    for (Assertion assertion : assertions) {
        TestBeanHelper.prepare((TestElement) assertion);
        if (assertion instanceof AbstractScopedAssertion){
            AbstractScopedAssertion scopedAssertion = (AbstractScopedAssertion) assertion;
            String scope = scopedAssertion.fetchScope();
            if (scopedAssertion.isScopeParent(scope) || scopedAssertion.isScopeAll(scope) || scopedAssertion.isScopeVariable(scope)){
                processAssertion(parent, assertion);
            }
            if (scopedAssertion.isScopeChildren(scope) || scopedAssertion.isScopeAll(scope)){
                SampleResult[] children = parent.getSubResults();
                boolean childError = false;
                for (SampleResult childSampleResult : children) {
                    processAssertion(childSampleResult, assertion);
                    if (!childSampleResult.isSuccessful()) {
                        childError = true;
                    }
                }
                // If parent is OK, but child failed, add a message and flag the parent as failed
                if (childError && parent.isSuccessful()) {
                    AssertionResult assertionResult = new AssertionResult(((AbstractTestElement)assertion).getName());
                    assertionResult.setResultForFailure("One or more sub-samples failed");
                    parent.addAssertionResult(assertionResult);
                    parent.setSuccessful(false);
                }
            }
        } else {
            processAssertion(parent, assertion);
        }
    }
    threadContext.getVariables().put(LAST_SAMPLE_OK, Boolean.toString(parent.isSuccessful()));
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:33,代码来源:JMeterThread.java

示例2: checkAssertions

import org.apache.jmeter.testelement.AbstractScopedAssertion; //导入方法依赖的package包/类
@SuppressWarnings("deprecation") // OK to call TestBeanHelper.prepare()
private void checkAssertions(List<Assertion> assertions, SampleResult parent, JMeterContext threadContext) {
    for (Assertion assertion : assertions) {
        TestBeanHelper.prepare((TestElement) assertion);
        if (assertion instanceof AbstractScopedAssertion){
            AbstractScopedAssertion scopedAssertion = (AbstractScopedAssertion) assertion;
            String scope = scopedAssertion.fetchScope();
            if (scopedAssertion.isScopeParent(scope) || scopedAssertion.isScopeAll(scope) || scopedAssertion.isScopeVariable(scope)){
                processAssertion(parent, assertion);
            }
            if (scopedAssertion.isScopeChildren(scope) || scopedAssertion.isScopeAll(scope)){
                SampleResult children[] = parent.getSubResults();
                boolean childError = false;
                for (int i=0;i <children.length; i++){
                    processAssertion(children[i], assertion);
                    if (!children[i].isSuccessful()){
                        childError = true;
                    }
                }
                // If parent is OK, but child failed, add a message and flag the parent as failed
                if (childError && parent.isSuccessful()) {
                    AssertionResult assertionResult = new AssertionResult(((AbstractTestElement)assertion).getName());
                    assertionResult.setResultForFailure("One or more sub-samples failed");
                    parent.addAssertionResult(assertionResult);
                    parent.setSuccessful(false);
                }
            }
        } else {
            processAssertion(parent, assertion);
        }
    }
    threadContext.getVariables().put(LAST_SAMPLE_OK, Boolean.toString(parent.isSuccessful()));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:34,代码来源:JMeterThread.java


注:本文中的org.apache.jmeter.testelement.AbstractScopedAssertion.isScopeChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。