/** * Create an instance of {@link Description } * */ public Description createDescription() { return new Description(); }
private Predicate<Description> isHtmlDescription() { return description -> DescriptionType.HTML.equals(description.getType()); }
public Description withType(DescriptionType value) { setType(value); return this; }
/** * 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 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(); } } }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { String theValue; theValue = this.getValue(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "value", theValue), currentHashCode, theValue); } { DescriptionType theType; theType = this.getType(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "type", theType), currentHashCode, theType); } return currentHashCode; }
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); }
public boolean equals(Object object) { final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); }
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()); }
@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); } }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof Description)) { return false; } if (this == object) { return true; } final Description that = ((Description) object); { String lhsValue; lhsValue = this.getValue(); String rhsValue; rhsValue = that.getValue(); if (!strategy.equals(LocatorUtils.property(thisLocator, "value", lhsValue), LocatorUtils.property(thatLocator, "value", rhsValue), lhsValue, rhsValue)) { return false; } } { DescriptionType lhsType; lhsType = this.getType(); DescriptionType rhsType; rhsType = that.getType(); if (!strategy.equals(LocatorUtils.property(thisLocator, "type", lhsType), LocatorUtils.property(thatLocator, "type", rhsType), lhsType, rhsType)) { return false; } } return true; }
private Predicate<Description> isHtmlDescription() { return description -> DescriptionType.HTML.equals(description.getType()); }
desc.setType("text/html"); // change as per