java java中有哪些可用的单元测试框架?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4055957/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 04:35:49  来源:igfitidea点击:

What are the unit testing frameworks available in java?

javaunit-testing

提问by Sarit

What are the technologies out there? (I only know of JUnit) What is the most popular? Can you please explain the pros/cons of each?

有哪些技术?(我只知道JUnit)什么是最流行的?你能解释一下每个的优缺点吗?

回答by Jon

JUnitand TestNGare the main unit test frameworks.

JUnitTestNG是主要的单元测试框架。

Comparison can be found here - http://www.mkyong.com/unittest/junit-4-vs-testng-comparison

可以在这里找到比较 - http://www.mkyong.com/unittest/junit-4-vs-testng-comparison

I've used JUnit in most places I've worked, it seems to be the standard, but there are some nice things in TestNG.

我在我工作过的大多数地方都使用过 JUnit,它似乎是标准,但在 TestNG 中有一些不错的东西。

I've used the following in combination with JUnit to facilitate testing:

我将以下内容与 JUnit 结合使用以促进测试:

回答by Bozho

JUnit and TestNGare the most popular. JUnit being the de-facto standard, and TestNG providing some extra features.

JUnit 和TestNG是最受欢迎的。JUnit 是事实上的标准,而 TestNG 提供了一些额外的功能。

回答by Michael Borgwardt

There are a lot of "add-on" framework for specific kinds of testing, typically these depend on JUnit. Examples:

有很多用于特定类型测试的“附加”框架,通常这些依赖于 JUnit。例子:

  • DBUnit- for testing code that accesses a database
  • JFCUnit- for testing Swing apps
  • HTMLUnit- for testing web apps
  • DBUnit- 用于测试访问数据库的代码
  • JFCUnit- 用于测试 Swing 应用程序
  • HTMLUnit- 用于测试网络应用程序

回答by Shahid Siddique

Heres is a list

这是一个列表

  1. JUnit
  2. Cactus
  3. StrutsTestCase
  4. JFCUnit 10 javascript framework to download
  5. TestNG
  6. jMock
  7. Grinder
  8. Jetif
  9. Unitils
  10. p-unit
  11. XMLUnit
  12. Ejb3Unit
  13. FEST-Swing
  14. Ripplet
  15. Feed4JUnit
  16. Jubula functional testing tools
  17. JsTestDriver
  18. Citrus Testframework 19.JBehave
  19. JCrawler – load testing framework
  1. JUnit
  2. 仙人掌
  3. Struts 测试用例
  4. JFCUnit 10 javascript框架下载
  5. 测试NG
  6. 模拟
  7. 磨床
  8. 捷夫
  9. 单位
  10. p单位
  11. XML单元
  12. Ejb3单元
  13. FEST-Swing
  14. 波纹
  15. Feed4JUnit
  16. Jubula 功能测试工具
  17. 测试驱动程序
  18. 柑橘测试框架 19.JBehave
  19. JCrawler – 负载测试框架

List Source

列出来源

回答by trix

You can find good comparison between JUnit and TestNG here:

您可以在此处找到 JUnit 和 TestNG 之间的良好比较:

http://hi.baidu.com/auraro816/blog/item/efe0574d03db6df4d72afc9f.html

http://hi.baidu.com/auraro816/blog/item/efe0574d03db6df4d72afc9f.html

if you have time to listen podcast try with Basement coders -Episode 21 – Interview with Cedric Beust creator of testNG

如果您有时间收听播客,请尝试使用 Basement 编码器 - 第 21 集 – 采访 testNG 的 Cedric Beust 创建者

回答by java_mouse

Apart from all the listing above, You can include selenium as well. This is widely used in industry for Java UI testing.

除了上面列出的所有内容,您还可以包含硒。这在业界广泛用于 Java UI 测试。