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


Java Description.getMethodName方法代碼示例

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


在下文中一共展示了Description.getMethodName方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testFinished

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public void testFinished(final Description description) throws Exception {

    if (!Objects.equals(lastMethodName, description.getMethodName())) {
        lastMethodName = description.getMethodName();
        printSuccessful("SUCCESSFUL");
        println(simplifyMethodName(lastMethodName));
    }

}
 
開發者ID:galop-proxy,項目名稱:galop,代碼行數:11,代碼來源:ExecutionListener.java

示例3: appendAllOpts

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public ReproduceErrorMessageBuilder appendAllOpts(Description description) {
    super.appendAllOpts(description);

    if (description.getMethodName() != null) {
        //prints out the raw method description instead of methodName(description) which filters out the parameters
        super.appendOpt(SYSPROP_TESTMETHOD(), "\"" + description.getMethodName() + "\"");
    }

    return appendESProperties();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:ReproduceInfoPrinter.java

示例4: createTestResult

import org.junit.runner.Description; //導入方法依賴的package包/類
private TestResult createTestResult(final String uuid, final Description description) {
    final String className = description.getClassName();
    final String methodName = description.getMethodName();
    final String name = Objects.nonNull(methodName) ? methodName : className;
    final String fullName = Objects.nonNull(methodName) ? String.format("%s.%s", className, methodName) : className;
    final String suite = Optional.ofNullable(description.getTestClass().getAnnotation(DisplayName.class))
            .map(DisplayName::value).orElse(className);

    final TestResult testResult = new TestResult()
            .withUuid(uuid)
            .withHistoryId(getHistoryId(description))
            .withName(name)
            .withFullName(fullName)
            .withLinks(getLinks(description))
            .withLabels(
                    new Label().withName("package").withValue(getPackage(description.getTestClass())),
                    new Label().withName("testClass").withValue(className),
                    new Label().withName("testMethod").withValue(name),
                    new Label().withName("suite").withValue(suite),
                    new Label().withName("host").withValue(getHostName()),
                    new Label().withName("thread").withValue(getThreadName())
            );
    testResult.getLabels().addAll(getLabels(description));
    getDisplayName(description).ifPresent(testResult::setName);
    getDescription(description).ifPresent(testResult::setDescription);
    return testResult;
}
 
開發者ID:allure-framework,項目名稱:allure-java,代碼行數:28,代碼來源:AllureJunit4.java

示例5: targetRepoPerTestFolder

import org.junit.runner.Description; //導入方法依賴的package包/類
private String targetRepoPerTestFolder(Description description) {
    return gitClone.getGitRepoFolder()
        + "_"
        + description.getTestClass().getSimpleName()
        + "_"
        + description.getMethodName();
}
 
開發者ID:arquillian,項目名稱:smart-testing,代碼行數:8,代碼來源:TestBed.java

示例6: starting

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
protected void starting(Description description) {
  b = Timer.time(desc(description));
  logger.info(format("Test starting: %s", desc(description)));
  AccessLogFilter accessLogFilter = currentDremioDaemon.getWebServer().getAccessLogFilter();
  if (accessLogFilter != null) {

    // sanitize method name from test since it could be a parameterized test with random characters (or be really long).
    String methodName = description.getMethodName();
    methodName = methodName.replaceAll("\\W+", "");
    if(methodName.length() > 200){
      methodName = methodName.substring(0,  200);
    }
    File logFile = new File(format("target/test-access_logs/%s-%s.log", description.getClassName(), methodName));
    File parent = logFile.getParentFile();
    if ((parent.exists() && !parent.isDirectory()) || (!parent.exists() && !parent.mkdirs())) {
      throw new RuntimeException("could not create dir " + parent);
    }
    if (logFile.exists()) {
      logFile.delete();
    }
    try {
      logger.info(format("access log at %s", logFile.getAbsolutePath()));
      docLog = new PrintWriter(logFile);
    } catch (FileNotFoundException e) {
      throw new RuntimeException(e);
    }
    accessLogFilter.startLoggingToFile(docLog);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:31,代碼來源:BaseTestServer.java

示例7: starting

import org.junit.runner.Description; //導入方法依賴的package包/類
/**
 * sets test class and method name to build path to file
 *
 * @param description description of the current test method
 */
@Override
protected void starting(Description description) {
    this.testClass = description.getTestClass();
    this.methodName = description.getMethodName();
}
 
開發者ID:YashchenkoN,項目名稱:jsonverifier,代碼行數:11,代碼來源:JsonContentLoader.java

示例8: testIgnored

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public void testIgnored(final Description description) throws Exception {
    lastMethodName = description.getMethodName();
    printWarning("IGNORED   ");
    println(simplifyMethodName(lastMethodName));
}
 
開發者ID:galop-proxy,項目名稱:galop,代碼行數:7,代碼來源:ExecutionListener.java

示例9: TestRequest

import org.junit.runner.Description; //導入方法依賴的package包/類
public TestRequest(Description description) {
    testClass = description.getClassName();
    frameworkMethod = description.getMethodName();
}
 
開發者ID:blackboard,項目名稱:lambda-selenium,代碼行數:5,代碼來源:TestRequest.java

示例10: testStarted

import org.junit.runner.Description; //導入方法依賴的package包/類
/**
 *
 * @see org.junit.runner.notification.RunListener#testStarted(org.junit.runner.Description)
 */
@Override
public void testStarted( Description description ) throws Exception {

    if (log.isDebugEnabled()) {

        log.debug("testStarted(): Called when an atomic test is about to be started. Description generally class and method: "
                  + description); //, new Exception( "debugging trace" ) );

    }
    lastStartedMethodIsFailing = false;
    Class<?> testClass = description.getTestClass(); //testResult.getTestClass().getRealClass();

    String suiteName;
    String suiteSimpleName;
    String tcName = getTestName(description);
    // Update last started method. Note that testStarted() is invoked even before @Before methods
    lastStartedMethod = description.getMethodName(); // TODO: check for overridden methods
    String tcDescription = getTestDescription(description);

    suiteName = testClass.getName(); // assuming not JUnit 3 class "TestSuite"
    suiteSimpleName = testClass.getSimpleName();

    // check if we need to start a new group
    if (!suiteName.equals(lastSuiteName)) {
        if (lastSuiteName != null) {
            logger.endSuite();
        }

        String packName = suiteName.substring(0, suiteName.lastIndexOf('.'));
        logger.startSuite(packName, suiteSimpleName);
        lastSuiteName = suiteName;
    }

    // start a scenario and test case
    logger.startTestcase(suiteName, suiteSimpleName, tcName, "", tcDescription);

    // send TestStart event to all ATS agents
    TestcaseStateEventsDispacher.getInstance().onTestStart();

    logger.info("[JUnit]: Starting " + suiteName + "@" + tcName);
    super.testStarted(description);
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:47,代碼來源:AtsJunitTestListener.java

示例11: desc

import org.junit.runner.Description; //導入方法依賴的package包/類
private String desc(Description description) {
  return description.getClassName() + "." +  description.getMethodName();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:4,代碼來源:BaseTestServer.java

示例12: logInfo

import org.junit.runner.Description; //導入方法依賴的package包/類
private static void logInfo(final Description description, final long nanos) {

        final String testName = description.getMethodName();
        log.info("Test {} {} milliseconds", testName, NANOSECONDS.toMillis(nanos));
    }
 
開發者ID:juliaaano,項目名稱:payload,代碼行數:6,代碼來源:JsonBenchmark.java

示例13: getTestName

import org.junit.runner.Description; //導入方法依賴的package包/類
private String getTestName( Description description ) {

        return description.getMethodName();
    }
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:5,代碼來源:AtsJunitTestListener.java


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