Java Code Examples for ru.yandex.qatools.allure.events.TestCaseStartedEvent#setDescription()
The following examples show how to use
ru.yandex.qatools.allure.events.TestCaseStartedEvent#setDescription() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AllureTestListener.java From allure1 with Apache License 2.0 | 6 votes |
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(); } } }
Example 2
Source File: AllureMarathonRunListener.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void testStarted(Description description) { TestCaseStartedEvent event = new TestCaseStartedEvent(getSuiteUid(description), getTestName()); SeverityLevel severityLevel = SeverityLevel.NORMAL; Properties testProperties = getTestProperties(); String severity = testProperties.getProperty("severity"); if (severity != null) { severityLevel = SeverityLevel.fromValue(severity); } event.getLabels().add(AllureModelUtils.createSeverityLabel(severityLevel)); String desc = testProperties.getProperty("description"); if (desc != null) { String dType = "text"; if (desc.startsWith("html:")) { dType = "html"; desc = desc.substring(5); } else if (desc.startsWith("markdown:")) { dType = "markdown"; desc = desc.substring(9); } event.setDescription( new ru.yandex.qatools.allure.model.Description().withType(DescriptionType.fromValue(dType)).withValue(desc)); } String id = testProperties.getProperty("id"); if (id != null) { event.getLabels().add(AllureModelUtils.createTestLabel(id)); } Path testPath = Paths.get(testProperties.getProperty("path", "")); addGroups(issues, event.getLabels(), testPath, LabelName.ISSUE); addGroups(features, event.getLabels(), testPath, LabelName.FEATURE); addGroups(stories, event.getLabels(), testPath, LabelName.STORY); getLifecycle().fire(event); }
Example 3
Source File: AnnotationManager.java From allure1 with Apache License 2.0 | 5 votes |
/** * Sets into specified {@link ru.yandex.qatools.allure.events.TestCaseStartedEvent} * information from Allure annotations. * * @param event to change */ public void update(TestCaseStartedEvent event) { if (isTitleAnnotationPresent()) { event.setTitle(getTitle()); } if (isDescriptionAnnotationPresent()) { event.setDescription(getDescription()); } if (isSeverityAnnotationPresent()) { event.getLabels().add(createSeverityLabel(getSeverity())); } if (isIssueAnnotationPresent()) { event.getLabels().add(createIssueLabel(getIssueKey())); } if (isIssuesAnnotationPresent()) { for (String issueKey : getIssueKeys()) { event.getLabels().add(createIssueLabel(issueKey)); } } if (isTestCaseIdAnnotationPresent()) { event.getLabels().add(createTestLabel(getTestCaseId())); } event.getLabels().addAll(getStoryLabels()); event.getLabels().addAll(getFeatureLabels()); withExecutorInfo(event); }
Example 4
Source File: AllureTestListener.java From allure1 with Apache License 2.0 | 5 votes |
@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); } }
Example 5
Source File: AllureTestListener.java From allure1 with Apache License 2.0 | 5 votes |
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); }