Selenium之如何监听断言
作者:
网络转载 发布时间:
[ 2016/1/4 15:14:38 ] 推荐标签:
功能测试 功能测试工具
1 public class Assertion {
2
3 public static Log log=new Log(Assertion.class);
4
5 public static boolean flag=true;
6
7 public static List<Error> errors=new ArrayList<Error>();
8
9 public static void begin(){
10 flag=true;
11 }
12
13 public static void end(){
14 Assert.assertTrue(flag);
15 }
16
17 public static void verifyEquals(Object actual, Object expected){
18 try{
19 Assert.assertEquals(actual, expected);
20 }catch(Error e){
21 errors.add(e);
22 flag = false;
23 }
24 }
25
26 public static void verifyEquals(Object actual, Object expected, String message){
27 try{
28 Assert.assertEquals(actual, expected, message);
29 log.info("方法验证成功!");
30 }catch(Error e){
31 errors.add(e);
32 flag = false;
33 log.info("方法验证失败!");
34 }
35 }
36
37 }