本文整理汇总了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();
}
}
示例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);
}
示例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();
}
}
};
}
示例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()));
}
}
示例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);
}
示例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);
}
});
}
示例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);
}
});
}
示例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) {
}
}
示例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"));
}
}
示例10: getLifecycle
import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
public Allure getLifecycle() {
return lifecycle;
}
示例11: setLifecycle
import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
public void setLifecycle(Allure lifecycle) {
this.lifecycle = lifecycle;
}
示例12: getLifecycle
import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
private Allure getLifecycle() {
return lifecycle;
}
示例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());
}
示例14: getLifecycle
import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
Allure getLifecycle() {
return lifecycle;
}
示例15: setLifecycle
import ru.yandex.qatools.allure.Allure; //导入依赖的package包/类
void setLifecycle(Allure lifecycle) {
this.lifecycle = lifecycle;
}