首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rest Api load tesing tdd给出错误消息

Rest Api load tesing tdd给出错误消息
EN

Stack Overflow用户
提问于 2019-09-09 15:24:08
回答 2查看 724关注 0票数 1

我正在自动化我的rest api,并寻找一个性能测试框架来与我的junit5一起使用。我遇到了零代码测试驱动开发,但它没有帮助,它给出了错误,所有的测试都失败了。我的测试方法是正确的,当它被junit jupiter正常调用时可以正常工作。当我使用zerocodeLoadRunner做同样的事情时,它不工作。

代码语言:javascript
复制
    import org.jsmart.zerocode.core.domain.LoadWith;
    import org.jsmart.zerocode.core.domain.TestMapping;
    import org.jsmart.zerocode.core.runner.parallel.ZeroCodeLoadRunner;   
    import org.junit.runner.RunWith;

    @LoadWith("loadConfig.properties")

    @TestMapping(testClass = MyTest.class, testMethod = "myMethod")

    @RunWith(ZeroCodeLoadRunner.class)

    public class LoadTest  {

    }

我收到的错误消息如下所示。

代码语言:javascript
复制
    2019-09-09 12:35:57,191 [main] ERROR org.jsmart.zerocode.core.runner.parallel.ZeroCodeLoadRunner - myPackage.LoadTest.myMethod Failed. See target/logs -or- junit granular failure report(csv) -or- fuzzy search and filter report(html) for details

用于此的依赖项如下

代码语言:javascript
复制
    <dependency>
        <groupId>org.jsmart</groupId>
        <artifactId>zerocode-tdd-jupiter</artifactId>
        <version>1.3.8</version>
    </dependency>

我不想使用任何测试工具,因此我将使用此工具。

EN

回答 2

Stack Overflow用户

发布于 2019-09-24 07:21:49

您所做的设置适用于JUnit4(但不适用于JUnit5,因为JUnit5不支持Runners)。对于JUnit5,您需要使用以下零代码扩展。

@ExtendWith({ParallelLoadExtension.class})

JUnit5-Jupiter-Parallel-Load-Extension页面包含确切的详细信息。请尝试以下方式:

例如:

代码语言:javascript
复制
@LoadWith("load_generation.properties")
@ExtendWith({ParallelLoadExtension.class})
public class JUnit5LoadCommonLoadTest {

    @Test
    @DisplayName("testing parallel load for X, Y and Z scenarios")
    @TestMappings({
            @TestMapping(testClass = JUnit5Test.class, testMethod = "testX"),
            @TestMapping(testClass = JUnit5Test.class, testMethod = "testY"),
            @TestMapping(testClass = JUnit5MoreTest.class, testMethod = "testZ")
    })
    public void testLoad_xyz() {
        // This space remains empty
    }
}

您可以访问此Github JUnit5 Load examples了解JUnit5 Jupiter负载测试以及如何通过JUnit5 Suite运行它们。

票数 1
EN

Stack Overflow用户

发布于 2021-01-08 02:46:29

我第二个问题的答案是,你正在使用JUnit4风格的测试进行设置,并且需要为JUnit5进行设置-我最近几周已经测试过了,并且完全按照上面指定的方式工作。

需要注意的一点是,在属性文件中,我发现需要设置比线程高15- 20 %的秒数(即线程20/秒25)。如果您不这样做,那么我通常会在零代码测试中看到失败

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57849469

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档