/** * Sets title using fluent-api * * @param title value to set * @return modified instance */ public TestSuiteStartedEvent withTitle(String title) { setTitle(title); return this; }
/** * Sets description using fluent-api * * @param description value to set * @return modified instance */ public TestSuiteStartedEvent withDescription(Description description) { setDescription(description); return this; }
@Override public void process(TestSuiteResult testSuite) { testSuite.setStart(System.currentTimeMillis()); testSuite.setName(getName()); testSuite.setTitle(getTitle()); testSuite.setDescription(getDescription()); testSuite.setLabels(getLabels()); } }
public void update(TestSuiteStartedEvent event) { if (isTitleAnnotationPresent()) { event.setTitle(getTitle()); } if (isDescriptionAnnotationPresent()) { event.setDescription(getDescription()); } if (isStoriesAnnotationPresent()) { event.getLabels().addAll(getStoryLabels()); } if (isFeaturesAnnotationPresent()) { event.getLabels().addAll(getFeatureLabels()); } }
public void testSuiteStarted(Description description, String suiteName) throws IllegalAccessException { String[] annotationParams = findFeatureByScenarioName(suiteName); //Create feature and story annotations. Remove unnecessary words from it Features feature = getFeaturesAnnotation(new String[]{annotationParams[0].split(":")[1].trim()}); Stories story = getStoriesAnnotation(new String[]{annotationParams[1].split(":")[1].trim()}); //If it`s Scenario Outline, add example string to story name if (description.getDisplayName().startsWith("|") || description.getDisplayName().endsWith("|")) { story = getStoriesAnnotation(new String[]{annotationParams[1].split(":")[1].trim() + " " + description.getDisplayName()}); } String uid = generateSuiteUid(suiteName); TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, story.value()[0]); event.setTitle(story.value()[0]); //Add feature and story annotations Collection<Annotation> annotations = new ArrayList<>(); for (Annotation annotation : description.getAnnotations()) { annotations.add(annotation); } annotations.add(story); annotations.add(feature); AnnotationManager am = new AnnotationManager(annotations); am.update(event); event.withLabels(AllureModelUtils.createTestFrameworkLabel("CucumberJVM")); getLifecycle().fire(event); }
@Override public void onStart(ITestContext iTestContext) { getLifecycle().fire(new TestSuiteStartedEvent( getSuiteUid(iTestContext), getCurrentSuiteTitle(iTestContext) ).withTitle( getCurrentSuiteTitle(iTestContext) ).withLabels( AllureModelUtils.createTestFrameworkLabel("TestNG") )); addPendingMethods(iTestContext); }
@Override public void onConfigurationSkip(ITestResult iTestResult) { if (isSuppressConfigEvent(iTestResult)) { return; } String suiteUid = getSuiteUid(iTestResult.getTestContext()); if (isAfterSuiteConfigMethod(iTestResult)) { String suiteTitle = getCurrentSuiteTitle(iTestResult.getTestContext()); getLifecycle().fire(new TestSuiteStartedEvent(suiteUid, suiteTitle).withTitle(suiteTitle)); } createConfigEvent(iTestResult); fireTestCaseCancel(iTestResult); fireFinishTest(); if (isAfterSuiteConfigMethod(iTestResult)) { getLifecycle().fire(new TestSuiteFinishedEvent(suiteUid)); } }
@Override public void feature(Feature feature) { this.feature = feature; uid = UUID.randomUUID().toString(); TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, feature.getName()); Collection<Annotation> annotations = new ArrayList<>(); annotations.add(getDescriptionAnnotation(feature.getDescription())); annotations.add(getFeaturesAnnotation(feature.getName())); AnnotationManager am = new AnnotationManager(annotations); am.update(event); ALLURE_LIFECYCLE.fire(event); }
/** * Sets to testSuite start time, name, title, description and labels * * @param testSuite to change */ @Override public void process(TestSuiteResult testSuite) { testSuite.setStart(System.currentTimeMillis()); testSuite.setName(getName()); testSuite.setTitle(getTitle()); testSuite.setDescription(getDescription()); testSuite.setLabels(getLabels()); }
/** * Sets into specified {@link ru.yandex.qatools.allure.events.TestSuiteStartedEvent} * information from Allure annotations. * * @param event to change */ public void update(TestSuiteStartedEvent event) { if (isTitleAnnotationPresent()) { event.setTitle(getTitle()); } if (isDescriptionAnnotationPresent()) { event.setDescription(getDescription()); } if (isIssueAnnotationPresent()) { event.getLabels().add(createIssueLabel(getIssueKey())); } if (isIssuesAnnotationPresent()) { for (String issueKey : getIssueKeys()) { event.getLabels().add(createIssueLabel(issueKey)); } } event.getLabels().addAll(getStoryLabels()); event.getLabels().addAll(getFeatureLabels()); }
@Override public void onConfigurationFailure(ITestResult iTestResult) { if (isSuppressConfigEvent(iTestResult)) { return; } String suiteUid = getSuiteUid(iTestResult.getTestContext()); if (isAfterSuiteConfigMethod(iTestResult)) { String suiteTitle = getCurrentSuiteTitle(iTestResult.getTestContext()); getLifecycle().fire(new TestSuiteStartedEvent(suiteUid, suiteTitle).withTitle(suiteTitle)); } Throwable throwable = iTestResult.getThrowable(); createConfigEvent(iTestResult); getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable)); fireFinishTest(); if (isAfterSuiteConfigMethod(iTestResult)) { getLifecycle().fire(new TestSuiteFinishedEvent(suiteUid)); } }