zoukankan      html  css  js  c++  java
  • 自动化测试断言Assent的使用

     Assent 断言模板包含如下方法:

    assert.fail(actual, expected, message, operator)

    assert.ok(value, [message])

    assert.equal(actual, expected, [message])

    assert.notEqual(actual, expected, [message])
    assert.deepEqual(actual, expected, [message])
    assert.notDeepEqual(actual, expected, [message])
    assert.strictEqual(actual, expected, [message])
    assert.notStrictEqual(actual, expected, [message])
    assert.throws(block, [error], [message])
    assert.doesNotThrow(block, [error], [message])
    assert.ifError(value)

     1     public static boolean flag=true;
     2     public static void verifyEquals(Object actual,Object expected){
     3         try {
     4             Assert.assertEquals(actual, expected);
     5             System.out.println("断言成功!"+flag);
     6         }catch (Error e){
     7             flag=false;
     8             System.out.println("断言失败"+flag);
     9         }
    10     }
    1   public static void verifyEquals(Object actual,Object expected,String message){
    2         try {
    3             Assert.assertEquals(message,actual,expected);
    4             System.out.println("断言成功!");
    5         }catch (Error e){
    6             flag=false;
    7             System.out.println("断言失败"+flag);
    8         }
    9     }
  • 相关阅读:
    js设计模式(一)---单例模式
    JavaScript---设计模式总结
    js设计模式---单例模式
    js设计模式---工厂模式
    react学习笔记01
    css常用布局
    js 继承
    vue路由动态加载
    vue 项目总结
    css文字两端对齐
  • 原文地址:https://www.cnblogs.com/sunny-sl/p/6735353.html
Copyright © 2011-2022 走看看