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


Java Reporter.getCurrentTestResult方法代码示例

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


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

示例1: set

import org.testng.Reporter; //导入方法依赖的package包/类
/**
 * Store the specified object in the attributes collection.
 * 
 * @param obj object to be stored; 'null' to discard value
 * @return (optional) specified object
 */
private <T> Optional<T> set(T obj) {
    ITestResult result = Reporter.getCurrentTestResult();
    Optional<T> val = TestBase.optionalOf(obj);
    result.setAttribute(key, val);
    return val;
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:13,代码来源:TestNgBase.java

示例2: nab

import org.testng.Reporter; //导入方法依赖的package包/类
/**
 * If present, get the object from the attributes collection.
 * 
 * @return (optional) stored object
 */
private Optional<?> nab() {
    ITestResult result = Reporter.getCurrentTestResult();
    Object val = result.getAttribute(key);
    if (val != null) {
        return (Optional<?>) val;
    } else {
        return set(null);
    }
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:15,代码来源:TestNgBase.java

示例3: getOutputDirectory

import org.testng.Reporter; //导入方法依赖的package包/类
@Override
public String getOutputDirectory() {
    ITestResult testResult = Reporter.getCurrentTestResult();
    if (testResult != null) {
        return testResult.getTestContext().getOutputDirectory();
    } else {
        return PathUtils.ReportsDirectory.ARTIFACT.getPath().toString();
    }
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:10,代码来源:TestNgBase.java

示例4: adjustTimeout

import org.testng.Reporter; //导入方法依赖的package包/类
@Override
public void adjustTimeout(long adjust) {
    ITestResult testResult = Reporter.getCurrentTestResult();
    if (testResult != null) {
        long timeout = testResult.getMethod().getTimeOut();
        if (timeout > 0) {
            testResult.getMethod().setTimeOut(timeout + adjust);
        }
    }
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:11,代码来源:TestNgBase.java

示例5: getLinkedListener

import org.testng.Reporter; //导入方法依赖的package包/类
/**
 * Get the listener of the specified type that's attached to the listener chain.
 * 
 * @param <T> listener type
 * @param listenerType listener type
 * @return listener of the specified type
 */
public static <T extends ITestNGListener> T getLinkedListener(Class<T> listenerType) {
    ITestResult testResult = Reporter.getCurrentTestResult();
    Optional<T> optListener = 
                    ListenerChain.getAttachedListener(testResult, listenerType);
    if (optListener.isPresent()) {
        return optListener.get();
    }
    throw new IllegalStateException(listenerType.getSimpleName() + " listener wasn't found on the listener chain");
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:17,代码来源:TestNgBase.java

示例6: testAttributeInjection

import org.testng.Reporter; //导入方法依赖的package包/类
@Test
public void testAttributeInjection() {
    
    ITestResult testResult = Reporter.getCurrentTestResult();
    
    PropertyManager.injectAttributes(attributeMap, testResult);
    Set<String> actualNames = testResult.getAttributeNames();
    
    assertEquals(actualNames, expectNames, "Actual names differ from expected names");
    assertEquals(testResult.getAttribute(BOOLEAN_KEY), BOOLEAN_VAL, "Boolean value is incorrect");
    assertEquals(testResult.getAttribute(STRING_KEY), STRING_VAL, "String value is incorrect");
    assertEquals(testResult.getAttribute(OBJECT_KEY), OBJECT_VAL, "Object value is incorrect");
    
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:15,代码来源:PropertyManagerTest.java

示例7: beforeMethod

import org.testng.Reporter; //导入方法依赖的package包/类
@BeforeMethod
public void beforeMethod(Method method) {
    if ("testMethod".equals(method.getName())) {
        fromBefore = VALUE;
        beforeResult = Reporter.getCurrentTestResult();
        beforeResult.setAttribute(ATTRIBUTE, fromBefore);
        throw new SkipException("Skip from [before]");
    }
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:10,代码来源:SkipFromBefore.java

示例8: afterMethod

import org.testng.Reporter; //导入方法依赖的package包/类
@AfterMethod
public void afterMethod(Method method) {
    if ("testMethod".equals(method.getName())) {
        afterResult = Reporter.getCurrentTestResult();
        fromAfter = (String) afterResult.getAttribute(ATTRIBUTE);
    }
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:8,代码来源:SkipFromBefore.java

示例9: beforeMethod

import org.testng.Reporter; //导入方法依赖的package包/类
@BeforeMethod
public void beforeMethod(Method method) {
    if ("testMethod".equals(method.getName())) {
        fromBefore = VALUE;
        beforeResult = Reporter.getCurrentTestResult();
        beforeResult.setAttribute(ATTRIBUTE, fromBefore);
    }
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:9,代码来源:HappyPathClass.java

示例10: testAttachedListeners

import org.testng.Reporter; //导入方法依赖的package包/类
@Test(groups = {"happyPath"})
public void testAttachedListeners() {
    System.out.println("testAttachedListeners");
    ITestResult result = Reporter.getCurrentTestResult();
    Optional<ChainedListener> optChained = ListenerChain.getAttachedListener(result, ChainedListener.class);
    assertTrue(optChained.isPresent());
    Optional<ServiceLoadedListener> optService = ListenerChain.getAttachedListener(result, ServiceLoadedListener.class);
    assertTrue(optService.isPresent());
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:10,代码来源:ListenerChainTestCases.java

示例11: testCanNotCapture

import org.testng.Reporter; //导入方法依赖的package包/类
@Test(groups = {"canNotCapture"})
public void testCanNotCapture() {
    System.out.println("canNotCapture");
    ITestResult result = Reporter.getCurrentTestResult();
    UnitTestArtifact.disableCapture(result);
    fail("canNotCapture");
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:8,代码来源:ArtifactCollectorTestCases.java

示例12: testWillNotCapture

import org.testng.Reporter; //导入方法依赖的package包/类
@Test(groups = {"willNotCapture"})
public void testWillNotCapture() {
    System.out.println("willNotCapture");
    ITestResult result = Reporter.getCurrentTestResult();
    UnitTestArtifact.crippleCapture(result);
    fail("willNotCapture");
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:8,代码来源:ArtifactCollectorTestCases.java

示例13: testAttributeExtraction

import org.testng.Reporter; //导入方法依赖的package包/类
@Test
public void testAttributeExtraction() {
    
    ITestResult testResult = Reporter.getCurrentTestResult();
    
    testResult.setAttribute(BOOLEAN_KEY, BOOLEAN_VAL);
    testResult.setAttribute(STRING_KEY, STRING_VAL);
    testResult.setAttribute(OBJECT_KEY, OBJECT_VAL);
    Map<String, Object> extractedMap = PropertyManager.extractAttributes(testResult);
    
    assertEquals(extractedMap, attributeMap, "Extracted map differs from expected map");
    
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:14,代码来源:PropertyManagerTest.java

示例14: testMethod

import org.testng.Reporter; //导入方法依赖的package包/类
@Test
public void testMethod() {
    methodResult = Reporter.getCurrentTestResult();
    fromMethod = (String) methodResult.getAttribute(ATTRIBUTE);
    assertTrue(true);
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:7,代码来源:SkipFromBefore.java

示例15: testMethod

import org.testng.Reporter; //导入方法依赖的package包/类
@Test
public void testMethod() {
    methodResult = Reporter.getCurrentTestResult();
    fromMethod = (String) methodResult.getAttribute(ATTRIBUTE);
    throw new SkipException("Skip from [method]");
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:7,代码来源:SkipFromMethod.java


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