本文介绍了JUnit,测试和线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我连续运行多个JUnit测试时,JUnit是否为每次执行创建一个新线程,或者所有内容都包装在一个线程中?
when i run multiple JUnit tests in a row, does JUnit create a new thread for each execution or everything is wrapped in a single thread?
谢谢
推荐答案
全部都在单个线程上.您没有说如何调用测试,但是例如,运行TestSuite将按顺序运行套件中的所有测试.
It's all on a single thread. You don't say how you're invoking the tests, but for example, running a TestSuite will run all the tests in the suite sequentially.
如果要并行执行,TestNG可以同时运行测试, JUnitPerf 和 GroboUtils .
If you want parallel execution, TestNG has support for running tests concurrently, as does JUnitPerf and GroboUtils.
这篇关于JUnit,测试和线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!