首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >这有可能在柏木js中多次命中单个api吗?

这有可能在柏木js中多次命中单个api吗?
EN

Stack Overflow用户
提问于 2022-03-03 14:21:45
回答 2查看 41关注 0票数 1

例如,我有api“localhost:4000/ api /配准”,我想在单个测试用例中按这个api 10次

EN

回答 2

Stack Overflow用户

发布于 2022-03-03 14:25:49

使用房倒法Cypress._.times()

示例:

代码语言:javascript
复制
Cypress._.times(10, (k) => {
  it(`register ${k + 1} times`, () => {
    // here the test
  })
})
票数 2
EN

Stack Overflow用户

发布于 2022-03-03 17:59:00

你也可以喜欢这个,这是我用的样本,

代码语言:javascript
复制
const count = 10;
static pollAndWait(count) {
        
        cy.testNetwork().then((response) => {
            expect(response.status).to.eq(200);

            if (response.body.resultSizeEstimate > 0  || count == 0) {
                return;
            }
            else {
               this.testNetwork(--count);
            }
        });
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71338715

复制
相关文章

相似问题

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