我有一个带有单元测试的spring应用程序。当我的代码在N个线程中运行时,我想检查它是如何工作的。现在,我在测试中使用了java.util.concurrent.Executor、ExecutableFuture、spring batch等特性。
有没有简单的方法,就像这样的注解:
@SuperPuperParallelTest(threadCount=5, timesToRun=100)
@Test
public void myTestMethod() { ... }或者是另一种(最好是注释驱动的)方法?
发布于 2020-04-26 15:24:14
看一看tempus-fugit。它是一个Java库,可以帮助我们使用方便的注释来测试并发代码。
有关示例,请参阅此处:https://www.baeldung.com/java-testing-multithreaded
https://stackoverflow.com/questions/61436839
复制相似问题