/** * Sets description using fluent-api * * @param description value to set * @return modified instance */ public TestCaseStartedEvent withDescription(Description description) { setDescription(description); return this; }
public void update(TestCaseStartedEvent event) { if (isTitleAnnotationPresent()) { event.setTitle(getTitle()); } if (isDescriptionAnnotationPresent()) { event.setDescription(getDescription()); } if (isStoriesAnnotationPresent()) { event.getLabels().addAll(getStoryLabels()); } if (isFeaturesAnnotationPresent()) { event.getLabels().addAll(getFeatureLabels()); } if (isSeverityAnnotationPresent()) { event.setSeverity(getSeverity()); } }
event.setDescription(getDescription());
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); } }