Selenium之如何監(jiān)聽斷言
作者:
網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:
[ 2016/1/4 15:14:38 ] 推薦標(biāo)簽:
功能測(cè)試 功能測(cè)試工具
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("方法驗(yàn)證成功!");
30 }catch(Error e){
31 errors.add(e);
32 flag = false;
33 log.info("方法驗(yàn)證失敗!");
34 }
35 }
36
37 }