我正在尝试使用 Zerocode 对 Junit(4) 运行负载测试。我能够按照这些教程运行现有的 Junit 测试类
- Load testing with JUnit using Zerocode framework
- Reusing the Existing JUnit Tests for Load/Stress Generation
我有一个正常工作的 Junit 测试套件,我想知道如何使用 Zerocode 来启动这个测试套件,以便它将运行所有测试类中的所有测试以进行负载测试。上面的示例描述了如何运行选定的测试方法或仅运行少数测试方法。
最佳答案
我认为你不能用 Zerocode 来做到这一点。
如果您想重用 JUnit 测试,您需要创建一个 LoadScenario 测试类。在此类中,您需要告知要使用哪个测试以及应该运行哪个方法。
例如
@LoadWith("load_generation.properties")
@TestMapping(testClass = PostCorpLoanServiceTest.class, testMethod = "testPostNewLoan_crudOperations")
@TestMapping(testClass = PutCorpLoanServiceTest.class, testMethod = "testPutAmendExistingLoan")
@TestMapping(testClass = GetScreeningServiceTest.class, testMethod = "testGetScreeningLocalAndGlobal")
@RunWith(ZeroCodeMultiLoadRunner.class)
public class JunitParallelMultiScenarioTest {
}
看看 github 上托管的这个存储库: https://github.com/authorjapps/performance-tests 。 它是 ZeroCode 框架(框架的负载测试部分)的展示项目。它包含在 Zerocode 框架的帮助下创建的负载测试示例。
关于java - 使用 Zerocode 运行 Junit 测试套件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58657690/