當前位置: 首頁>>代碼示例>>Java>>正文


Java Description.createSuiteDescription方法代碼示例

本文整理匯總了Java中org.junit.runner.Description.createSuiteDescription方法的典型用法代碼示例。如果您正苦於以下問題:Java Description.createSuiteDescription方法的具體用法?Java Description.createSuiteDescription怎麽用?Java Description.createSuiteDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.runner.Description的用法示例。


在下文中一共展示了Description.createSuiteDescription方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: map

import org.junit.runner.Description; //導入方法依賴的package包/類
private void map(Description source, Description parent) {
    for (Description child : source.getChildren()) {
        Description mappedChild;
        if (child.getMethodName() != null) {
            mappedChild = Description.createSuiteDescription(String.format("%s [%s](%s)", child.getMethodName(), getDisplayName(), child.getClassName()));
            parent.addChild(mappedChild);
            if (!isTestEnabled(new TestDescriptionBackedTestDetails(source, child))) {
                disabledTests.add(child);
            } else {
                enabledTests.add(child);
            }
        } else {
            mappedChild = Description.createSuiteDescription(child.getClassName());
        }
        descriptionTranslations.put(child, mappedChild);
        map(child, parent);
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:19,代碼來源:AbstractMultiTestRunner.java

示例2: TrisotechTCKTestRunner

import org.junit.runner.Description; //導入方法依賴的package包/類
protected TrisotechTCKTestRunner(Properties properties, Class<TrisotechTCKTest> testClass, String category, String testId, String testCase,
        File testCaseFile, File resultCSV) throws InitializationError {
    super(testClass);
    this.properties = properties;
    this.category = category;
    this.testId = testId;
    this.testCase = testCase;
    this.testCaseFile = testCaseFile;
    this.resultCSV = resultCSV;
    runnerDescription = Description.createSuiteDescription(category + " - " + testCase);
    try {
        TestCases tcs = TckMarshallingHelper.load(new FileInputStream(testCaseFile));
        modelName = tcs.getModelName();
        for (TestCase tc : tcs.getTestCase()) {
            Description testDescription = Description.createTestDescription(testClass, testCase + " - " + tc.getId());
            TrisotechTCKTest myTest = testClass.newInstance();
            myTest.setId(tc.getId());
            myTest.setDescription(testDescription);
            testCases.add(myTest);
            runnerDescription.addChild(testDescription);
        }
    } catch (FileNotFoundException | JAXBException | InstantiationException | IllegalAccessException e) {
        throw new InitializationError(e);
    }

}
 
開發者ID:dmn-tck,項目名稱:tck,代碼行數:27,代碼來源:TrisotechTCKTestRunner.java

示例3: initDescription

import org.junit.runner.Description; //導入方法依賴的package包/類
private void initDescription() {
    initExecutions();
    if (description == null) {
        description = Description.createSuiteDescription(target);
        for (Execution execution : executions) {
            execution.addDescriptions(description);
        }
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:10,代碼來源:AbstractMultiTestRunner.java

示例4: getSuiteUid

import org.junit.runner.Description; //導入方法依賴的package包/類
public String getSuiteUid(Description description) {
    String suiteName = getSuiteName(description);
    if (!getSuites().containsKey(suiteName)) {
        Description suiteDescription = Description.createSuiteDescription(description.getTestClass());
        testSuiteStarted(suiteDescription);
    }
    return getSuites().get(suiteName);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:AllureMarathonRunListener.java

示例5: testCustomLevelPerMethod

import org.junit.runner.Description; //導入方法依賴的package包/類
public void testCustomLevelPerMethod() throws Exception {
    LoggingListener loggingListener = new LoggingListener();

    Description suiteDescription = Description.createSuiteDescription(TestClass.class);

    Logger xyzLogger = Loggers.getLogger("xyz");
    Logger abcLogger = Loggers.getLogger("abc");

    final Level level = ESLoggerFactory.getRootLogger().getLevel();

    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
    loggingListener.testRunStarted(suiteDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));

    Method method = TestClass.class.getMethod("annotatedTestMethod");
    TestLogging annotation = method.getAnnotation(TestLogging.class);
    Description testDescription = Description.createTestDescription(LoggingListenerTests.class, "annotatedTestMethod", annotation);
    loggingListener.testStarted(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(Level.TRACE));
    assertThat(abcLogger.getLevel(), equalTo(level));

    loggingListener.testFinished(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));

    loggingListener.testRunFinished(new Result());
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:32,代碼來源:LoggingListenerTests.java

示例6: testInvalidClassTestLoggingAnnotation

import org.junit.runner.Description; //導入方法依賴的package包/類
public void testInvalidClassTestLoggingAnnotation() throws Exception {
    final LoggingListener loggingListener = new LoggingListener();

    final Description suiteDescription = Description.createSuiteDescription(InvalidClass.class);

    final IllegalArgumentException e =
        expectThrows(IllegalArgumentException.class, () -> loggingListener.testRunStarted(suiteDescription));
    assertThat(e.getMessage(), equalTo("invalid test logging annotation [abc]"));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:10,代碼來源:LoggingListenerTests.java

示例7: testInvalidMethodTestLoggingAnnotation

import org.junit.runner.Description; //導入方法依賴的package包/類
public void testInvalidMethodTestLoggingAnnotation() throws Exception {
    final LoggingListener loggingListener = new LoggingListener();

    final Description suiteDescription = Description.createSuiteDescription(InvalidMethod.class);

    loggingListener.testRunStarted(suiteDescription);

    final Method method = InvalidMethod.class.getMethod("invalidMethod");
    final TestLogging annotation = method.getAnnotation(TestLogging.class);
    Description testDescription = Description.createTestDescription(InvalidMethod.class, "invalidMethod", annotation);
    final IllegalArgumentException e =
        expectThrows(IllegalArgumentException.class, () -> loggingListener.testStarted(testDescription));
    assertThat(e.getMessage(), equalTo("invalid test logging annotation [abc:INFO:WARN]"));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:LoggingListenerTests.java

示例8: describeChild

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
protected Description describeChild(final FrameworkMethod method) {
    final Spockito.Name name = Spockito.nameAnnotationOrNull(method.getMethod());
    if (name != null && name.shortFormat()) {
        return Description.createSuiteDescription(testName(method), method.getAnnotations());
    } else {
        return super.describeChild(method);
    }
}
 
開發者ID:tools4j,項目名稱:spockito,代碼行數:10,代碼來源:AbstractSpockitoTestRunner.java

示例9: describeChild

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
protected Description describeChild(KarateFeature child) {
    Description description = descriptions.get(child.getFeature().getPath());
    if (description != null) {
        return description;
    }
    Feature feature = child.getFeature().getGherkinFeature();
    String name = feature.getKeyword() + ": " + feature.getName();
    return Description.createSuiteDescription(name, feature);
}
 
開發者ID:intuit,項目名稱:karate,代碼行數:11,代碼來源:Karate.java

示例10: CannotExecuteRunner

import org.junit.runner.Description; //導入方法依賴的package包/類
public CannotExecuteRunner(String displayName, Class<?> testClass, Throwable failure) {
    description = Description.createSuiteDescription(String.format("%s(%s)", displayName, testClass.getName()));
    this.failure = failure;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:5,代碼來源:AbstractMultiTestRunner.java

示例11: testCustomLevelPerClass

import org.junit.runner.Description; //導入方法依賴的package包/類
public void testCustomLevelPerClass() throws Exception {
    LoggingListener loggingListener = new LoggingListener();

    Description suiteDescription = Description.createSuiteDescription(AnnotatedTestClass.class);

    Logger abcLogger = Loggers.getLogger("abc");
    Logger xyzLogger = Loggers.getLogger("xyz");
    // we include foo and foo.bar to maintain that logging levels are applied from the top of the hierarchy down; this ensures that
    // setting the logging level for a parent logger and a child logger applies the parent level first and then the child as otherwise
    // setting the parent level would overwrite the child level
    Logger fooLogger = Loggers.getLogger("foo");
    Logger fooBarLogger = Loggers.getLogger("foo.bar");

    final Level level = ESLoggerFactory.getRootLogger().getLevel();

    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
    assertThat(fooLogger.getLevel(), equalTo(level));
    assertThat(fooBarLogger.getLevel(), equalTo(level));
    loggingListener.testRunStarted(suiteDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));
    assertThat(fooLogger.getLevel(), equalTo(Level.WARN));
    assertThat(fooBarLogger.getLevel(), equalTo(Level.ERROR));

    Description testDescription = Description.createTestDescription(LoggingListenerTests.class, "test");
    loggingListener.testStarted(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));
    assertThat(fooLogger.getLevel(), equalTo(Level.WARN));
    assertThat(fooBarLogger.getLevel(), equalTo(Level.ERROR));

    loggingListener.testFinished(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));
    assertThat(fooLogger.getLevel(), equalTo(Level.WARN));
    assertThat(fooBarLogger.getLevel(), equalTo(Level.ERROR));

    loggingListener.testRunFinished(new Result());
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
    assertThat(fooLogger.getLevel(), equalTo(level));
    assertThat(fooBarLogger.getLevel(), equalTo(level));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:45,代碼來源:LoggingListenerTests.java

示例12: testCustomLevelPerClassAndPerMethod

import org.junit.runner.Description; //導入方法依賴的package包/類
public void testCustomLevelPerClassAndPerMethod() throws Exception {
    LoggingListener loggingListener = new LoggingListener();

    Description suiteDescription = Description.createSuiteDescription(AnnotatedTestClass.class);

    Logger abcLogger = Loggers.getLogger("abc");
    Logger xyzLogger = Loggers.getLogger("xyz");

    final Level level = ESLoggerFactory.getRootLogger().getLevel();

    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
    loggingListener.testRunStarted(suiteDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    Method method = TestClass.class.getMethod("annotatedTestMethod");
    TestLogging annotation = method.getAnnotation(TestLogging.class);
    Description testDescription = Description.createTestDescription(LoggingListenerTests.class, "annotatedTestMethod", annotation);
    loggingListener.testStarted(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(Level.TRACE));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    loggingListener.testFinished(testDescription);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    Method method2 = TestClass.class.getMethod("annotatedTestMethod2");
    TestLogging annotation2 = method2.getAnnotation(TestLogging.class);
    Description testDescription2 = Description.createTestDescription(LoggingListenerTests.class, "annotatedTestMethod2", annotation2);
    loggingListener.testStarted(testDescription2);
    assertThat(xyzLogger.getLevel(), equalTo(Level.DEBUG));
    assertThat(abcLogger.getLevel(), equalTo(Level.TRACE));

    loggingListener.testFinished(testDescription2);
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(Level.WARN));

    loggingListener.testRunFinished(new Result());
    assertThat(xyzLogger.getLevel(), equalTo(level));
    assertThat(abcLogger.getLevel(), equalTo(level));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:43,代碼來源:LoggingListenerTests.java

示例13: getDescription

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public Description getDescription() {
    return Description.createSuiteDescription(testClass.getName(),
            testClass.getJavaClass().getAnnotations());
}
 
開發者ID:mirkosertic,項目名稱:Bytecoder,代碼行數:6,代碼來源:BytecoderUnitTestRunner.java

示例14: getDescription

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public Description getDescription() {
    return Description.createSuiteDescription(testClass);
}
 
開發者ID:andrewjc,項目名稱:kheera-testrunner-android,代碼行數:5,代碼來源:FeatureFileExecutor.java


注:本文中的org.junit.runner.Description.createSuiteDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。