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


Java Allure类代码示例

本文整理汇总了Java中ru.yandex.qatools.allure.Allure的典型用法代码示例。如果您正苦于以下问题:Java Allure类的具体用法?Java Allure怎么用?Java Allure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AllureMarathonRunListener

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
public AllureMarathonRunListener() {
    Field config;
    try {
        config = AllureResultsUtils.class.getDeclaredField("CONFIG");
        Field modifiersField = Field.class.getDeclaredField("modifiers");
        modifiersField.setAccessible(true);
        modifiersField.setInt(config, config.getModifiers() & ~Modifier.FINAL);
        config.setAccessible(true);
        config.set(null, AllureConfig.newInstance());
        AllureResultsUtils.setResultsDirectory(null);
        Constructor<Allure> constructor = Allure.class.getDeclaredConstructor();
        constructor.setAccessible(true);
        lifecycle = constructor.newInstance();
        issues = Group.getGroups(GroupType.ISSUE);
        features = Group.getGroups(GroupType.FEATURE);
        stories = Group.getGroups(GroupType.STORY);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:AllureMarathonRunListener.java

示例2: setUp

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
@Before
public void setUp() {
    testngListener = spy(new AllureTestListener());
    allure = mock(Allure.class);

    testngListener.setLifecycle(allure);

    ISuite suite = mock(ISuite.class);
    when(suite.getName()).thenReturn(DEFAULT_SUITE_NAME);
    XmlTest xmlTest = mock(XmlTest.class);
    when(xmlTest.getName()).thenReturn(DEFAULT_XML_TEST_NAME);
    testContext = mock(ITestContext.class);
    when(testContext.getSuite()).thenReturn(suite);
    when(testContext.getCurrentXmlTest()).thenReturn(xmlTest);

    // mocking test method parameters
    ConstructorOrMethod constructorOrMethod = mock(ConstructorOrMethod.class);
    when(constructorOrMethod.getMethod()).thenReturn(parametrizedTestMethod(0, null, null, null));
    method = mock(ITestNGMethod.class);
    when(method.getConstructorOrMethod()).thenReturn(constructorOrMethod);
    testResult = mock(ITestResult.class);
    when(testResult.getMethod()).thenReturn(method);
    when(testResult.getParameters()).thenReturn(new Object[]{});
    IClass iClass = mock(IClass.class);
    when(testResult.getTestClass()).thenReturn(iClass);
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:27,代码来源:AllureTestListenerTest.java

示例3: apply

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            if (retry) {
                Throwable e = null;
                for (int attempt = 1; attempt <= maxAttempts; attempt++) {
                    try {
                        if (integrationFactory.allure().isEnabled()) {
                            /**
                             * Remove all attachments from failed test before retry.
                             */
                            Allure.LIFECYCLE.fire(new RemoveAttachmentsEvent(".*"));
                            /**
                             * Remove all steps from failed test before retry.
                             */
                            Allure.LIFECYCLE.fire(new ClearStepStorageEvent());
                        } 
                        base.evaluate();
                        return;
                    } catch (Throwable throwable) {
                        LOG.warn(String.format("Test %s#%s failed, attempt %s of %s",
                                description.getClassName(), description.getMethodName(), attempt, maxAttempts));
                        e = throwable;
                    }
                }
                LOG.error(String.format("Test %s#%s failed, all %s attempts",
                        description.getClassName(), description.getMethodName(), maxAttempts));
                throw e;
            } else {
                base.evaluate();
            }
        }
    };
}
 
开发者ID:relateiq,项目名称:AugmentedDriver,代码行数:37,代码来源:TestRunnerRetryingRule.java

示例4: run

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
/**
 * Mark unfinished test cases as interrupted for each unfinished test suite, then write
 * test suite result
 * @see #createFakeTestcaseWithWarning(ru.yandex.qatools.allure.model.TestSuiteResult)
 * @see #markTestcaseAsInterruptedIfNotFinishedYet(ru.yandex.qatools.allure.model.TestCaseResult)
 */
@Override
public void run() {
    for (Map.Entry<String, TestSuiteResult> entry : testSuites) {
        for (TestCaseResult testCase : entry.getValue().getTestCases()) {
            markTestcaseAsInterruptedIfNotFinishedYet(testCase);
        }
        entry.getValue().getTestCases().add(createFakeTestcaseWithWarning(entry.getValue()));

        Allure.LIFECYCLE.fire(new TestSuiteFinishedEvent(entry.getKey()));
    }
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:18,代码来源:AllureShutdownHook.java

示例5: setUp

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    runListener = spy(new AllureRunListener());

    allure = mock(Allure.class);
    runListener.setLifecycle(allure);
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:8,代码来源:AllureRunListenerTest.java

示例6: someTest

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
@Test(timeout = 10000)
public void someTest() throws Exception {
    Allure.LIFECYCLE.fire(new TestCaseEvent() {
        @Override
        public void process(TestCaseResult context) {
            context.setTitle(NAME);
        }
    });
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:10,代码来源:TestWithTimeoutAnnotation.java

示例7: someTest

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
@Test
public void someTest() throws Exception {
    Allure.LIFECYCLE.fire(new TestCaseEvent() {
        @Override
        public void process(TestCaseResult context) {
            context.setTitle(TestWithTimeoutAnnotation.NAME);
        }
    });
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:10,代码来源:TestWithTimeoutRule.java

示例8: withParameterAnnotation

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
@After("setValueToAnyField() && withParameterAnnotation()")
public void parameterValueChanged(JoinPoint joinPoint) {
    try {
        FieldSignature fieldSignature = (FieldSignature) joinPoint.getSignature();
        Parameter parameter = fieldSignature.getField().getAnnotation(Parameter.class);
        String name = parameter.value().isEmpty() ? fieldSignature.getName() : parameter.value();
        Allure.LIFECYCLE.fire(new AddParameterEvent(name, joinPoint.getArgs()[0].toString()));
    } catch (Exception ignored) {
    }
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:11,代码来源:AllureParametersAspects.java

示例9: takeScreenshot

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
public void takeScreenshot(String step) {
    if (applicationContext.getBean(AppiumDriver.class) != null) {
        Allure.LIFECYCLE.fire(new MakeAttachmentEvent((applicationContext.getBean(AppiumDriver.class)).getScreenshotAs(OutputType.BYTES), step, "image/png"));
    }
}
 
开发者ID:alfa-laboratory,项目名称:colibri-ui,代码行数:6,代码来源:AllureReporter.java

示例10: getLifecycle

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
public Allure getLifecycle() {
    return lifecycle;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:AllureMarathonRunListener.java

示例11: setLifecycle

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
public void setLifecycle(Allure lifecycle) {
    this.lifecycle = lifecycle;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:AllureMarathonRunListener.java

示例12: getLifecycle

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
private Allure getLifecycle() {
    return lifecycle;
}
 
开发者ID:tapack,项目名称:allure-jbehave-reporter,代码行数:4,代码来源:AllureReporter.java

示例13: stepFinish

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
/**
 * Logs the end of a step. Ensure it matches a {@link #stepStart(String)}.
 **/
public static void stepFinish() {
    Allure.LIFECYCLE.fire(new StepFinishedEvent());
}
 
开发者ID:Frameworkium,项目名称:frameworkium-core,代码行数:7,代码来源:AllureLogger.java

示例14: getLifecycle

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
Allure getLifecycle() {
    return lifecycle;
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:4,代码来源:AllureTestListener.java

示例15: setLifecycle

import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
void setLifecycle(Allure lifecycle) {
    this.lifecycle = lifecycle;
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:4,代码来源:AllureTestListener.java


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