zoukankan      html  css  js  c++  java
  • CodeceptJS学习笔记-高级用法03-tag

     

    附加@tag到您的测试名称

    Scenario('update user profile @slow')


    或者,使用tag场景的方法来设置其他标签:

    Data(function*() {
        yield { login: '17600000000',password: '12345678'};
        yield { login: '13500000000',password: '12345678'};
      }).Scenario('test something', (I,current) => {
        //在浏览器打开页面
        I.amOnPage('/user/login')
        I.wait(10)
        //输入用户名密码
        I.fillField({css:'.ant-input-affix-wrapper .ant-input:not(:first-child)'},current.login)
        I.fillField({css:'.ant-input-affix-wrapper .ant-input:not(:last-child)'},current.password)
        // 点击登录按钮
        I.click('button, html [type="button"]')
        //截图
    }).tag('@slow').tag('important');

    运行命令

    codeceptjs run --grep @slow

    运行结果

    CodeceptJS v2.6.5
    Using test root "E:Docoumentcodeceptdemo"
     
    loginaccount --
      √ test something | {"login":"17600000000","password":"12345678"} @slow @important in 35849ms
      √ test something | {"login":"13500000000","password":"12345678"} @slow @important in 32792ms
     
      OK  | 2 passed   // 1m

    使用正则表达式进行更灵活的过滤:

    • --grep '(?=.*@smoke2)(?=.*@smoke3)' -以名称@ smoke2和@ smoke3运行测试
    • --grep "@smoke2|@smoke3" -以名称@ smoke2或@ smoke3运行测试
    • --grep '((?=.*@smoke2)(?=.*@smoke3))|@smoke4' -以名称(@ smoke2和@ smoke3)或@ smoke4运行测试
    • --grep '(?=.*@smoke2)^(?!.*@smoke3)' -使用@ smoke2运行测试,但名称中没有@ smoke3
    • --grep '(?=.*)^(?!.*@smoke4)' -运行除@ smoke4以外的所有测试
     
  • 相关阅读:
    数据库之事务与常见故障
    数学的魅力 之 正多边形
    html5 的基础理解1
    android 引入开源项目
    android 图片查看器
    java 线程安全
    python3 自动生成requirement.txt
    centos 7 安装 python3.7
    python3 创建,激活虚拟环境
    Mac 配置poetry
  • 原文地址:https://www.cnblogs.com/7047-zfy/p/13232222.html
Copyright © 2011-2022 走看看