gpt4 book ai didi

java - TestNG Eclipse插件: How to change the name prefix of methods for [New -> TestNG Class]?

转载 作者:太空宇宙 更新时间:2023-11-04 08:33:09 25 4
gpt4 key购买 nike

首选

@Test
public void testMethodName() {} // [New -> JUnit Test Case]

@Test
public void methodName() {} // [New -> TestNG Class]

我可以通过以下步骤实现我想要的:

  1. [新 -> JUnit 测试用例]
  2. 快速辅助:转换为 TestNG(注释)

还有更简单的方法吗?

最佳答案

这很容易添加,但我不确定它到底有多有用:最终,您将需要重命名您的方法以描述它作为测试实际执行的操作。例如,名为 createAccount() 的方法可能应该使用名为 accountShouldBeCreated() 的测试方法进行测试。

此外,单个方法通常最终会被多个测试方法测试:accountShouldBeCreated()alreadyExistingAccountShouldNotBeAllowed() 等...

关于java - TestNG Eclipse插件: How to change the name prefix of methods for [New -> TestNG Class]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7037817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com