public ru.yandex.qatools.allure.model.Description getDescription() { Description description = getAnnotation(Description.class); return new ru.yandex.qatools.allure.model.Description() .withValue(description.value()) .withType(description.type()); }
/** * Find first {@link ru.yandex.qatools.allure.annotations.Description} annotation * * @return {@link ru.yandex.qatools.allure.model.Description} or null if * annotation doesn't present */ public ru.yandex.qatools.allure.model.Description getDescription() { Description description = getAnnotation(Description.class); return description == null ? null : new ru.yandex.qatools.allure.model.Description() .withValue(description.value()) .withType(description.type()); }
private void createConfigEvent(ITestResult iTestResult) { String description = iTestResult.getMethod().getDescription(); if (description == null || description.isEmpty()) { description = getConfigMethodType(iTestResult).getName(); } String suiteUid = getSuiteUid(iTestResult.getTestContext()); TestCaseStartedEvent event = new TestCaseStartedEvent(suiteUid, iTestResult.getName()); event.setDescription(new Description().withValue(description)); AnnotationManager am = new AnnotationManager(getMethodAnnotations(iTestResult)); am.setDefaults(getClassAnnotations(iTestResult)); am.update(event); getLifecycle().fire(event); }
private void addPendingMethods(ITestContext iTestContext) { for (ITestNGMethod method : iTestContext.getExcludedMethods()) { if (method.isTest() && !method.getEnabled() && isInActiveGroup(method, iTestContext)) { Description description = new Description().withValue(method.getDescription()); String suiteUid = getSuiteUid(iTestContext); TestCaseStartedEvent event = new TestCaseStartedEvent(suiteUid, method.getMethodName()); if (description.getValue() != null) { event.setDescription(description); } Annotation[] annotations = method.getConstructorOrMethod().getMethod().getAnnotations(); AnnotationManager am = new AnnotationManager(annotations); am.setDefaults(method.getInstance().getClass().getAnnotations()); am.update(event); getLifecycle().fire(event); getLifecycle().fire(new TestCasePendingEvent()); fireFinishTest(); } } }
@Override public void onTestStart(ITestResult iTestResult) { ITestNGMethod method = iTestResult.getMethod(); String testSuiteLabel = iTestResult.getTestContext().getSuite().getName(); String testGroupLabel = iTestResult.getTestContext().getCurrentXmlTest().getName(); String testClassLabel = iTestResult.getTestClass().getName(); String testMethodLabel = method.getMethodName(); String suitePrefix = getCurrentSuitePrefix(iTestResult); String testName = getName(iTestResult); startedTestNames.add(testName); testName = testName.replace(suitePrefix, ""); String invoc = getMethodInvocationsAndSuccessPercentage(iTestResult); Description description = new Description().withValue(method.getDescription()); String suiteUid = getSuiteUid(iTestResult.getTestContext()); TestCaseStartedEvent event = new TestCaseStartedEvent(suiteUid, testName + invoc).withLabels( AllureModelUtils.createTestSuiteLabel(testSuiteLabel), AllureModelUtils.createTestGroupLabel(testGroupLabel), AllureModelUtils.createTestClassLabel(testClassLabel), AllureModelUtils.createTestMethodLabel(testMethodLabel)); if (description.getValue() != null) { event.setDescription(description); } AnnotationManager am = new AnnotationManager(getMethodAnnotations(iTestResult)); am.setDefaults(getClassAnnotations(iTestResult)); am.update(event); getLifecycle().fire(event); if (AllureConfig.newInstance().areTestNgParametersEnabled()) { fireAddParameterEvents(iTestResult); } }