本文介绍了我是Java自动化测试的新手.我应该选择哪种工具? JUnit还是TestNG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了 JUnit TestNG 的一些比较,看来TestNG具有更多的配置选项.另一方面,IDE,构建工具和更多的插件都支持JUnit.

I have read some comparisons of JUnit and TestNG and it looks like TestNG has more configuration options. On the other hand JUnit is more supported by IDEs, building tools, has more plugins.

我没有编写单元测试的经验. 我应该使用哪种工具?

I have no experience in writing unit tests. Which tool should I prefer?

P.S.我认为我的问题更像是:我应该尝试一下TestNG,还是像其他所有人一样坚持使用JUnit?

P.S.I think my question is more like: Should I give TestNG a try, or just stick with JUnit as everybody else?

P.S.我们开发Web应用程序,因此我认为选择还应该考虑到以后我们将使用Selenium进行功能测试.

P.S.We develop web applications, so I think the choice should also consider that we will use Selenium later for functional testing.

推荐答案

如果这是您第一次来,我建议您使用JUnit.

If this is your first time, I'd recommend JUnit.

它是第一个,最受欢迎.它有据可查,具有强大的工具支持,并且至少在最初时已被翻译成所有不同的语言(参见xUnit实现).对于大多数项目来说,它应该工作正常,这是一个了解的好工具.对于您来说,这将是一个很好的基线.

It was the first, most popular. It's well documented, has great tool support, and is the metaphor that is translated-- at least initially-- to all the different languages (see xUnit implementations). It should work fine for most any project, and it's a good tool to know. It will be a good baseline for you as a programmer.

替代方案"还有其他功能-这就是为什么有替代方案的原因-但往往是样式问题比什么都重要. TestNG可能具有一些不同的功能,但是JUnit也已经发展为具有注释,替代匹配器等功能.

There are other features of the "alternatives"-- that's why there are alternatives-- but often it's a matter of style more than anything else. TestNG may have a few different features, but JUnit has also evolved with features like annotations, alternative matchers, etc.

是的,时间到了,JUnit可以与Selenium一起正常工作.

Yes, JUnit will work fine with Selenium when the time comes.

这篇关于我是Java自动化测试的新手.我应该选择哪种工具? JUnit还是TestNG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 02:13