【问题标题】:Incorrect junit test method name?不正确的junit测试方法名称?
【发布时间】:2020-04-20 11:38:23
【问题描述】:

我有如下方法:

   @DisplayName("testCreateExecution")
   @ParameterizedTest(name = "testCreateExecution[ testId:{index}, size:{0}, side:{1} ]")
   @MethodSource(SINGLE_EXECUTION_DATA_PROVIDER)
   public void testCreateExecution(double size, char side) throws TestRunException{
    ...
    }

这个测试由带有感叹号和红色小箭头的junit标记,而不是通常的绿色箭头。 当我尝试运行它时,这个测试用例没有被执行(什么都没有发生),但随后被标记为通过。 当我重命名此方法时,例如。到 testCreateExecutions 一切正常。

我真的很惊讶 - 这个测试方法名称有什么问题? 此方法由 intellij 重命名选项命名,但这是原因吗?旧方法是否缓存在某处并引起任​​何冲突?

【问题讨论】:

    标签: testing intellij-idea methods junit


    【解决方案1】:

    没关系,问题是由未找到具有我也重命名的数据提供者的类引起的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-11
      • 1970-01-01
      • 1970-01-01
      • 2016-10-31
      • 1970-01-01
      • 2022-11-28
      • 1970-01-01
      • 2014-01-07
      相关资源
      最近更新 更多