@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); }
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 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)); } }