当前位置: 首页>>代码示例>>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;未经允许,请勿转载。