瀏覽代碼

2025-2-11

Eazin 4 月之前
父節點
當前提交
aa9900d1bf

+ 105 - 69
src/test/java/page/DictionaryPageTest.java

@@ -3,6 +3,7 @@ package page;
 import io.qameta.allure.Description;
 import io.qameta.allure.Story;
 import io.restassured.response.Response;
+import org.testng.Reporter;
 import org.testng.annotations.Test;
 import util.JDBCUtils;
 
@@ -20,31 +21,41 @@ public class DictionaryPageTest {
     @Description("正常测试用例:搜索所有的词典")
     @Story("登录")
     public void passwordLoginSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
-        body.put("conditionOne","出口退税");
-        Response response= dictionaryPage.findConditions(body);
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<List<HashMap<String,String>>> title=response.path("data.children");
-        title.forEach(list -> {
-            list.forEach(map -> {
-                assertTrue(map.get("title").contains("出口退税"));
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
+            body.put("conditionOne","出口退税");
+            Response response= dictionaryPage.findConditions(body);
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<List<HashMap<String,String>>> title=response.path("data.children");
+            title.forEach(list -> {
+                list.forEach(map -> {
+                    assertTrue(map.get("title").contains("出口退税"));
+                });
             });
-        });
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.passwordLoginSuccess:搜索所有的词典,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("异常测试用例:关键字为空,搜索全部政策词典")
     @Story("政策词典")
     public void keywordEmptySearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
-        body.put("conditionOne","");
-        Response response=dictionaryPage.findConditions(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        assertTrue(!((List)response.path("data")).isEmpty());
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
+            body.put("conditionOne","");
+            Response response=dictionaryPage.findConditions(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            assertTrue(!((List)response.path("data")).isEmpty());
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.keywordEmptySearchSuccess:关键字为空,搜索全部政策词典,断言失败!");
+            throw  e;
+        }
     }
 
     public static boolean isContainChinese(String str) {
@@ -60,83 +71,108 @@ public class DictionaryPageTest {
     @Description("正常测试用例:按中文类型搜索政策词典")
     @Story("政策词典")
     public void chineseSearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
-        body.put("conditionThree","chinese");
-        Response response=dictionaryPage.findConditions(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<List<HashMap<String,String>>> title=response.path("data.children");
-        title.forEach(list -> {
-            list.forEach(map -> {
-                assertTrue(isContainChinese(map.get("title")) || map.get("title").matches(".*\\d.*"));
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
+            body.put("conditionThree","chinese");
+            Response response=dictionaryPage.findConditions(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<List<HashMap<String,String>>> title=response.path("data.children");
+            title.forEach(list -> {
+                list.forEach(map -> {
+                    assertTrue(isContainChinese(map.get("title")) || map.get("title").matches(".*\\d.*"));
+                });
             });
-        });
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.chineseSearchSuccess:按中文类型搜索政策词典,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:按英文类型搜索政策词典")
     @Story("政策词典")
     public void englishSearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
-        body.put("conditionThree","english");
-        Response response=dictionaryPage.findConditions(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<List<HashMap<String,String>>> title=response.path("data.children");
-        title.forEach(list -> {
-            list.forEach(map -> {
-                assertTrue(map.get("title").matches(".*\\w.*"));
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
+            body.put("conditionThree","english");
+            Response response=dictionaryPage.findConditions(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<List<HashMap<String,String>>> title=response.path("data.children");
+            title.forEach(list -> {
+                list.forEach(map -> {
+                    assertTrue(map.get("title").matches(".*\\w.*"));
+                });
             });
-        });
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.englishSearchSuccess:按英文类型搜索政策词典,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:组合搜索")
     @Story("政策词典")
     public void allKeySearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
-        body.put("conditionThree","chinese");
-        Response response=dictionaryPage.findConditions(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<List<HashMap<String,String>>> title=response.path("data.children");
-        title.forEach(list -> {
-            list.forEach(map -> {
-                assertTrue(isContainChinese(map.get("title")) || map.get("title").matches(".*\\d.*"));
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditions.json");
+            body.put("conditionThree","chinese");
+            Response response=dictionaryPage.findConditions(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<List<HashMap<String,String>>> title=response.path("data.children");
+            title.forEach(list -> {
+                list.forEach(map -> {
+                    assertTrue(isContainChinese(map.get("title")) || map.get("title").matches(".*\\d.*"));
+                });
             });
-        });
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.allKeySearchSuccess:组合搜索,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:获取词典详情信息")
     @Story("政策词典")
     public void getDictionaryInfoSuccess(){
-        List<Object[]> sql= JDBCUtils.queryMulti("select id,title,content from ims_ewei_shop_qa_question limit 0,10;");
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditionsById.json");
-        body.put("id",sql.get(0)[0]);
-        Response response=dictionaryPage.getDictionaryInfo(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        HashMap<String,Object> title=response.path("data");
-        assertEquals(title.get("title"),sql.get(0)[1]);
-        String content=""+sql.get(0)[2];
-        assertTrue(content.contains(""+title.get("content")));
+        try{
+            List<Object[]> sql= JDBCUtils.queryMulti("select id,title,content from ims_ewei_shop_qa_question limit 0,10;");
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindConditionsById.json");
+            body.put("id",sql.get(0)[0]);
+            Response response=dictionaryPage.getDictionaryInfo(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            HashMap<String,Object> title=response.path("data");
+            assertEquals(title.get("title"),sql.get(0)[1]);
+            String content=""+sql.get(0)[2];
+            assertTrue(content.contains(""+title.get("content")));
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.getDictionaryInfoSuccess:获取词典详情信息,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:获取关联的政策")
     @Story("政策词典")
     public void getMoreDictionaryPolicySuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindMorePolicy.json");
-        Response response=dictionaryPage.getMoreDictionaryPolicy(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<HashMap<String,Object>> list=response.path("data");
-        assertTrue(list.size()>0);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/dictionaryPage/eweiShopQaQuestionFindMorePolicy.json");
+            Response response=dictionaryPage.getMoreDictionaryPolicy(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<HashMap<String,Object>> list=response.path("data");
+            assertTrue(list.size()>0);
+        }catch (AssertionError e){
+            Reporter.log("DictionaryPageTest.getMoreDictionaryPolicySuccess:获取关联的政策,断言失败!");
+            throw  e;
+        }
     }
 }

+ 40 - 24
src/test/java/page/HomePageTest.java

@@ -3,6 +3,7 @@ package page;
 import io.qameta.allure.Description;
 import io.qameta.allure.Story;
 import io.restassured.response.Response;
+import org.testng.Reporter;
 import org.testng.annotations.Test;
 import util.JDBCUtils;
 
@@ -19,15 +20,20 @@ public class HomePageTest {
     @Description("正常测试用例:查询所有政策专题")
     @Story("首页")
     public void getPolicyTopic(){
-        List<Object[]> sql= JDBCUtils.queryMulti("select xcx_img,name,content from back_sys_topic where is_delete='0' and status='0' order by sort;");
-        Response response= homePage.getPolicyTopic();
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        ArrayList<HashMap<String,String>> result=response.path("data");
-        for (int i=0;i<result.size();i++){
-            assertEquals(result.get(i).get("cover"),sql.get(i)[0]);
-            assertEquals(result.get(i).get("name"),sql.get(i)[1]);
-            assertEquals(result.get(i).get("describe"),sql.get(i)[2]);
+        try{
+            List<Object[]> sql= JDBCUtils.queryMulti("select xcx_img,name,content from back_sys_topic where is_delete='0' and status='0' order by sort;");
+            Response response= homePage.getPolicyTopic();
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            ArrayList<HashMap<String,String>> result=response.path("data");
+            for (int i=0;i<result.size();i++){
+                assertEquals(result.get(i).get("cover"),sql.get(i)[0]);
+                assertEquals(result.get(i).get("name"),sql.get(i)[1]);
+                assertEquals(result.get(i).get("describe"),sql.get(i)[2]);
+            }
+        }catch (AssertionError e){
+            Reporter.log("HomePageTest.getPolicyTopic:查询所有政策专题,断言失败!");
+            throw  e;
         }
     }
 
@@ -35,15 +41,20 @@ public class HomePageTest {
     @Description("正常测试用例:查询专题关联的项目")
     @Story("首页")
     public void policyTopicList(){
-        List<Object[]> sql= JDBCUtils.queryMulti("select id from back_sys_topic where is_delete='0' and status='0' order by sort;");
-        List<Object[]> project= JDBCUtils.queryMulti("select oa_formal_file.subtitle,oa_zhengce.fw_department from oa_formal_file INNER JOIN oa_zhengce on oa_formal_file.zhengceid=oa_zhengce.id where oa_formal_file.id in(SELECT formal FROM back_sys_topic_formal where topic_id=5) and oa_formal_file.status=1 and oa_formal_file.zhijian_status=5;");
-        HashMap<String,Object> map=new HashMap<>();
-        map.put("_file", "/apijson/page/homePage/pcpIndexGetPolicyTopicPolicyTopicList.json");
-        map.put("id",sql.get(0)[0]);
-        Response response= homePage.policyTopicList(map);
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        assertTrue(((List)response.path("data")).size()>0);
+        try{
+            List<Object[]> sql= JDBCUtils.queryMulti("select id from back_sys_topic where is_delete='0' and status='0' order by sort;");
+            List<Object[]> project= JDBCUtils.queryMulti("select oa_formal_file.subtitle,oa_zhengce.fw_department from oa_formal_file INNER JOIN oa_zhengce on oa_formal_file.zhengceid=oa_zhengce.id where oa_formal_file.id in(SELECT formal FROM back_sys_topic_formal where topic_id=5) and oa_formal_file.status=1 and oa_formal_file.zhijian_status=5;");
+            HashMap<String,Object> map=new HashMap<>();
+            map.put("_file", "/apijson/page/homePage/pcpIndexGetPolicyTopicPolicyTopicList.json");
+            map.put("id",sql.get(0)[0]);
+            Response response= homePage.policyTopicList(map);
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            assertTrue(((List)response.path("data")).size()>0);
+        }catch (AssertionError e){
+            Reporter.log("HomePageTest.policyTopicList:查询专题关联的项目,断言失败!");
+            throw  e;
+        }
 //        boolean b=false;
 //        for(int i=1;i<result.size();i++){
 //            String sub=result.get(i).get("subtitle");
@@ -66,11 +77,16 @@ public class HomePageTest {
     @Description("正常测试用例:查询热门政策")
     @Story("首页")
     public void getIndexData(){
-        HashMap<String,Object> map=new HashMap<>();
-        map.put("_file", "/apijson/page/homePage/pcpAppletGetIndexData.json");
-        Response response= homePage.getIndexData(map);
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        assertTrue(((List)response.path("data.policyList")).size()>0);
+        try{
+            HashMap<String,Object> map=new HashMap<>();
+            map.put("_file", "/apijson/page/homePage/pcpAppletGetIndexData.json");
+            Response response= homePage.getIndexData(map);
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            assertTrue(((List)response.path("data.policyList")).size()>0);
+        }catch (AssertionError e){
+            Reporter.log("HomePageTest.getIndexData:查询热门政策,断言失败!");
+            throw  e;
+        }
     }
 }

+ 55 - 33
src/test/java/page/LoginPageTest.java

@@ -4,8 +4,10 @@ import conf.Config;
 import io.qameta.allure.Description;
 import io.qameta.allure.Story;
 import io.restassured.response.Response;
+import org.testng.Reporter;
 import org.testng.annotations.Test;
 import java.util.HashMap;
+import java.util.List;
 
 import static org.testng.Assert.*;
 
@@ -17,29 +19,39 @@ public class LoginPageTest {
     @Description("正常测试用例:正确的账密,登录成功")
     @Story("登录")
     public void passwordLoginSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
-        body.put("username",config.username);
-        body.put("password",config.password);
-        Response response= loginPage.passwordLoginSuccess(body);
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        String token=response.path("data.token");
-        assertTrue(token.length()>0);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
+            body.put("username",config.username);
+            body.put("password",config.password);
+            Response response= loginPage.passwordLoginSuccess(body);
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            String token=response.path("data.token");
+            assertTrue(token.length()>0);
+        }catch (AssertionError e){
+            Reporter.log("LoginPageTest.passwordLoginSuccess:正确的账密,登录成功,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("异常测试用例:错误的账号,登录失败")
     @Story("登录")
     public void accountFailpasswordLoginFail(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
-        body.put("username","15999999999");
-        body.put("password",config.password);
-        Response response= loginPage.passwordLoginSuccess(body);
-        assertEquals((int)response.path("code"),400);
-        assertEquals(response.path("message"),"用户不存在或已禁用");
-        assertTrue(response.path("data")==null);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
+            body.put("username","15999999999");
+            body.put("password",config.password);
+            Response response= loginPage.passwordLoginSuccess(body);
+            assertEquals((int)response.path("code"),400);
+            assertEquals(response.path("message"),"用户不存在或已禁用");
+            assertTrue(response.path("data")==null);
+        }catch (AssertionError e){
+            Reporter.log("LoginPageTest.accountFailpasswordLoginFail:错误的账号,登录失败,断言失败!");
+            throw  e;
+        }
     }
 
 
@@ -47,28 +59,38 @@ public class LoginPageTest {
     @Description("异常测试用例:账号为空,登录失败")
     @Story("登录")
     public void accountEmptyPasswordLoginFail(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
-        body.put("username","");
-        body.put("password",config.password);
-        Response response= loginPage.passwordLoginSuccess(body);
-        assertEquals((int)response.path("code"),400);
-        assertEquals(response.path("message"),"用户名不能为空");
-        assertTrue(response.path("data")==null);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
+            body.put("username","");
+            body.put("password",config.password);
+            Response response= loginPage.passwordLoginSuccess(body);
+            assertEquals((int)response.path("code"),400);
+            assertEquals(response.path("message"),"用户名不能为空");
+            assertTrue(response.path("data")==null);
+        }catch (AssertionError e){
+            Reporter.log("LoginPageTest.accountEmptyPasswordLoginFail:账号为空,登录失败,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("异常测试用例:密码错误,登录失败")
     @Story("登录")
     public void passwordFailPasswordLoginFail(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
-        body.put("username",config.username);
-        body.put("password","123");
-        Response response= loginPage.passwordLoginSuccess(body);
-        assertEquals((int)response.path("code"),400);
-        assertEquals(response.path("message"),"用户名或密码错误");
-        assertTrue(response.path("data")==null);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/loginPage/pcpLoginByType.json");
+            body.put("username",config.username);
+            body.put("password","123");
+            Response response= loginPage.passwordLoginSuccess(body);
+            assertEquals((int)response.path("code"),400);
+            assertEquals(response.path("message"),"用户名或密码错误");
+            assertTrue(response.path("data")==null);
+        }catch (AssertionError e){
+            Reporter.log("LoginPageTest.passwordFailPasswordLoginFail:账号为空,登录失败,断言失败!");
+            throw  e;
+        }
     }
 
 //    @Test

+ 21 - 15
src/test/java/page/MyPageTest.java

@@ -3,6 +3,7 @@ package page;
 import io.qameta.allure.Description;
 import io.qameta.allure.Story;
 import io.restassured.response.Response;
+import org.testng.Reporter;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 import util.JDBCUtils;
@@ -26,21 +27,26 @@ public class MyPageTest {
     @Description("正常测试用例:获取已读政策")
     @Story("我的")
     public void findsReadZC(){
-        List<Object[]> sql= JDBCUtils.queryMulti("SELECT id from oa_zhengce where status=1 and zhijian_status=5 and id not in (SELECT zid FROM applet_read_policy where member_id='"+loginPage.getMember_id()+"');");
-        HashMap<String,Object> body1=new HashMap<>();
-        body1.put("_file","/apijson/page/myPage/pcpPolicyDetailAddZCHistory.json");
-        body1.put("zid",sql.get(0)[0]);
-        body1.put("memberId",loginPage.getMember_id());
-        Response response1= myPage.addZCHistory(body1);
-        assertEquals(response1.path("message"),"操作成功");
-        HashMap<String,Object> map=new HashMap<>();
-        map.put("_file","/apijson/page/myPage/pcpPersonalCenterFindIsReadZC.json");
-        map.put("memberId",loginPage.getMember_id());
-        Response response2= myPage.findsReadZC(map);
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        List<Integer> list=response2.path("data.id");
-        assertEquals(list.get(0),sql.get(0)[0]);
+        try{
+            List<Object[]> sql= JDBCUtils.queryMulti("SELECT id from oa_zhengce where status=1 and zhijian_status=5 and id not in (SELECT zid FROM applet_read_policy where member_id='"+loginPage.getMember_id()+"');");
+            HashMap<String,Object> body1=new HashMap<>();
+            body1.put("_file","/apijson/page/myPage/pcpPolicyDetailAddZCHistory.json");
+            body1.put("zid",sql.get(0)[0]);
+            body1.put("memberId",loginPage.getMember_id());
+            Response response1= myPage.addZCHistory(body1);
+            assertEquals(response1.path("message"),"操作成功");
+            HashMap<String,Object> map=new HashMap<>();
+            map.put("_file","/apijson/page/myPage/pcpPersonalCenterFindIsReadZC.json");
+            map.put("memberId",loginPage.getMember_id());
+            Response response2= myPage.findsReadZC(map);
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            List<Integer> list=response2.path("data.id");
+            assertEquals(list.get(0),sql.get(0)[0]);
+        }catch (AssertionError e){
+            Reporter.log("MyPageTest.findsReadZC:获取已读政策,断言失败!");
+            throw  e;
+        }
     }
 
 

File diff suppressed because it is too large
+ 495 - 355
src/test/java/page/PolicyPageTest.java


+ 276 - 199
src/test/java/page/PushPageTest.java

@@ -3,8 +3,10 @@ package page;
 import io.qameta.allure.Description;
 import io.qameta.allure.Story;
 import io.restassured.response.Response;
+import org.testng.Reporter;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
+import util.JDBCUtils;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -26,18 +28,23 @@ public class PushPageTest {
     @Description("正常测试用例:【适配项目】排序方式为发文时间,根据发文时间降序排序")
     @Story("智能推送")
     public void dispatchDateSortPushProjectSearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
-        body.put("memberId",loginPage.getMember_id());
-        body.put("sortType",0);
-        Response response=pushPage.searchProjectPush(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<HashMap<String,Object>> result=response.path("data.result");
-        for (int i=0;i<result.size()-1;i++){
-            String dispatchDate1=""+result.get(i).get("dispatchDate");
-            String dispatchDate2=""+result.get(i+1).get("dispatchDate");
-            assertTrue(Integer.parseInt(dispatchDate1.replace("-",""))>=Integer.parseInt(dispatchDate2.replace("-","")));
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
+            body.put("memberId",loginPage.getMember_id());
+            body.put("sortType",0);
+            Response response=pushPage.searchProjectPush(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<HashMap<String,Object>> result=response.path("data.result");
+            for (int i=0;i<result.size()-1;i++){
+                String dispatchDate1=""+result.get(i).get("dispatchDate");
+                String dispatchDate2=""+result.get(i+1).get("dispatchDate");
+                assertTrue(Integer.parseInt(dispatchDate1.replace("-",""))>=Integer.parseInt(dispatchDate2.replace("-","")));
+            }
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.dispatchDateSortPushProjectSearchSuccess:【适配项目】排序方式为发文时间,根据发文时间降序排序,断言失败!");
+            throw  e;
         }
     }
 
@@ -45,18 +52,23 @@ public class PushPageTest {
     @Description("正常测试用例:【适配项目】排序方式为截止日期,根据截止日期降序排序")
     @Story("智能推送")
     public void endDateSortPushProjectSearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
-        body.put("memberId",loginPage.getMember_id());
-        body.put("sortType",1);
-        Response response=pushPage.searchProjectPush(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<HashMap<String,Object>> result=response.path("data.result");
-        for (int i=0;i<result.size()-1;i++){
-            String dispatchDate1=""+result.get(i).get("dispatchDate");
-            String dispatchDate2=""+result.get(i+1).get("dispatchDate");
-            assertTrue(Integer.parseInt(dispatchDate1.replace("-",""))>=Integer.parseInt(dispatchDate2.replace("-","")));
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
+            body.put("memberId",loginPage.getMember_id());
+            body.put("sortType",1);
+            Response response=pushPage.searchProjectPush(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<HashMap<String,Object>> result=response.path("data.result");
+            for (int i=0;i<result.size()-1;i++){
+                String dispatchDate1=""+result.get(i).get("dispatchDate");
+                String dispatchDate2=""+result.get(i+1).get("dispatchDate");
+                assertTrue(Integer.parseInt(dispatchDate1.replace("-",""))>=Integer.parseInt(dispatchDate2.replace("-","")));
+            }
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.endDateSortPushProjectSearchSuccess:【适配项目】排序方式为截止日期,根据截止日期降序排序,断言失败!");
+            throw  e;
         }
     }
 
@@ -85,17 +97,22 @@ public class PushPageTest {
     @Description("正常测试用例:【适配项目】筛选申报状态为申报中的项目")
     @Story("智能推送")
     public void clareStartPushProjectSearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
-        body.put("memberId",loginPage.getMember_id());
-        body.put("status",1);
-        Response response=pushPage.searchProjectPush(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<HashMap<String,Object>> result=response.path("data.result");
-        for (int i=0;i<result.size()-1;i++){
-            String declareDate=""+result.get(i).get("declareDate");
-            assertTrue(Integer.parseInt(declareDate)>=0);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
+            body.put("memberId",loginPage.getMember_id());
+            body.put("status",1);
+            Response response=pushPage.searchProjectPush(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<HashMap<String,Object>> result=response.path("data.result");
+            for (int i=0;i<result.size()-1;i++){
+                String declareDate=""+result.get(i).get("declareDate");
+                assertTrue(Integer.parseInt(declareDate)>=0);
+            }
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.clareStartPushProjectSearchSuccess:【适配项目】筛选申报状态为申报中的项目,断言失败!");
+            throw  e;
         }
     }
 
@@ -103,17 +120,22 @@ public class PushPageTest {
     @Description("正常测试用例:【适配项目】筛选申报状态为申报中的项目")
     @Story("智能推送")
     public void clareEndPushProjectSearchSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
-        body.put("memberId",loginPage.getMember_id());
-        body.put("status",2);
-        Response response=pushPage.searchProjectPush(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        List<HashMap<String,Object>> result=response.path("data.result");
-        for (int i=0;i<result.size()-1;i++){
-            String declareDate=""+result.get(i).get("declareDate");
-            assertTrue(Integer.parseInt(declareDate)<=0);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file", "/apijson/page/pushPage/pcpIntelligentPushGetGslFocusFormal.json");
+            body.put("memberId",loginPage.getMember_id());
+            body.put("status",2);
+            Response response=pushPage.searchProjectPush(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            List<HashMap<String,Object>> result=response.path("data.result");
+            for (int i=0;i<result.size()-1;i++){
+                String declareDate=""+result.get(i).get("declareDate");
+                assertTrue(Integer.parseInt(declareDate)<=0);
+            }
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.clareEndPushProjectSearchSuccess:【适配项目】筛选申报状态为申报中的项目,断言失败!");
+            throw  e;
         }
     }
 
@@ -122,220 +144,275 @@ public class PushPageTest {
     @Story("智能推送")
     public void matchProjectSuccess(){
         try{
-            Thread.sleep(5000);
-        }catch (Exception e){
-            e.printStackTrace();
+            try{
+                Thread.sleep(5000);
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/pushPage/pcpNewPersonalCenterUpdateIntelligentPush.json");
+            body.put("userId",loginPage.getMember_id());
+            Response response=pushPage.matchProject(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            assertTrue(response.path("data")==null);
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.matchProjectSuccess:【适配项目】剩余次数>0,立即匹配项目,断言失败!");
+            throw  e;
         }
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/pushPage/pcpNewPersonalCenterUpdateIntelligentPush.json");
-        body.put("userId",loginPage.getMember_id());
-        Response response=pushPage.matchProject(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        assertTrue(response.path("data")==null);
     }
 
     @Test
     @Description("正常测试用例:【适配项目】获取匹配次数")
     @Story("智能推送")
     public void getMatchProjectNumSuccess(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/pushPage/pcpNewPersonalCenterGetIntelligentPushNum.json");
-        body.put("userId",loginPage.getMember_id());
-        Response response=pushPage.getMatchProjectNum(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        assertTrue((int)response.path("data")<=3 && (int)response.path("data")>=0);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/pushPage/pcpNewPersonalCenterGetIntelligentPushNum.json");
+            body.put("userId",loginPage.getMember_id());
+            Response response=pushPage.getMatchProjectNum(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            assertTrue((int)response.path("data")<=3 && (int)response.path("data")>=0);
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.getMatchProjectNumSuccess:【适配项目】获取匹配次数,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【推送设置】获取公众号二维码")
     @Story("智能推送")
     public void getQRCode(){
-        Response response=pushPage.getQRCode();
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        String code=response.path("data");
-        assertTrue(code.contains("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="));
+        try{
+            Response response=pushPage.getQRCode();
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            String code=response.path("data");
+            assertTrue(code.contains("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="));
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.getQRCode:【推送设置】获取公众号二维码,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【推送设置】开启智能推送、仅有新项目推送、推送时间9:00")
     @Story("智能推送")
     public void updateBackSysUserPushSetAllOpen(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/pushPage/pcpIntelligentPushUpdateBackSysUserPushSet.json");
-        body.put("userId",loginPage.getMember_id());
-        body.put("id",pushPage.getBackSysUserPushSetId(loginPage.getMember_id()));
-        Response response1=pushPage.updateBackSysUserPushSet(body);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertEquals(response1.path("data"),"修改成功");
-        Response response2=pushPage.getBackSysUserPushSet(loginPage.getMember_id());
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        assertEquals((int)response2.path("data.matchPushSet"),1);
-        assertEquals((int)response2.path("data.matchRepeatPush"),1);
-        assertEquals((int)response2.path("data.pushTime"),1);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/pushPage/pcpIntelligentPushUpdateBackSysUserPushSet.json");
+            body.put("userId",loginPage.getMember_id());
+            body.put("id",pushPage.getBackSysUserPushSetId(loginPage.getMember_id()));
+            Response response1=pushPage.updateBackSysUserPushSet(body);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertEquals(response1.path("data"),"修改成功");
+            Response response2=pushPage.getBackSysUserPushSet(loginPage.getMember_id());
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            assertEquals((int)response2.path("data.matchPushSet"),1);
+            assertEquals((int)response2.path("data.matchRepeatPush"),1);
+            assertEquals((int)response2.path("data.pushTime"),1);
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.updateBackSysUserPushSetAllOpen:【推送设置】开启智能推送、仅有新项目推送、推送时间9:00,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【推送设置】推送时间15:00")
     @Story("智能推送")
     public void updateBackSysUserPushSetPutTime2(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/pushPage/pcpIntelligentPushUpdateBackSysUserPushSet.json");
-        body.put("userId",loginPage.getMember_id());
-        body.put("id",pushPage.getBackSysUserPushSetId(loginPage.getMember_id()));
-        body.put("pushTime",2);
-        Response response1=pushPage.updateBackSysUserPushSet(body);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertEquals(response1.path("data"),"修改成功");
-        Response response2=pushPage.getBackSysUserPushSet(loginPage.getMember_id());
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        assertEquals((int)response2.path("data.pushTime"),2);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/pushPage/pcpIntelligentPushUpdateBackSysUserPushSet.json");
+            body.put("userId",loginPage.getMember_id());
+            body.put("id",pushPage.getBackSysUserPushSetId(loginPage.getMember_id()));
+            body.put("pushTime",2);
+            Response response1=pushPage.updateBackSysUserPushSet(body);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertEquals(response1.path("data"),"修改成功");
+            Response response2=pushPage.getBackSysUserPushSet(loginPage.getMember_id());
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            assertEquals((int)response2.path("data.pushTime"),2);
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.updateBackSysUserPushSetPutTime2:【推送设置】推送时间15:00,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【推送设置】关闭智能推送、仅有新项目推送")
     @Story("智能推送")
     public void updateBackSysUserPushSetAllClose(){
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/pushPage/pcpIntelligentPushUpdateBackSysUserPushSet.json");
-        body.put("userId",loginPage.getMember_id());
-        body.put("id",pushPage.getBackSysUserPushSetId(loginPage.getMember_id()));
-        body.put("matchPushSet",2);
-        body.put("matchRepeatPush",2);
-        Response response1=pushPage.updateBackSysUserPushSet(body);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertEquals(response1.path("data"),"修改成功");
-        Response response2=pushPage.getBackSysUserPushSet(loginPage.getMember_id());
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        assertEquals((int)response2.path("data.matchPushSet"),2);
-        assertEquals((int)response2.path("data.matchRepeatPush"),2);
+        try{
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/pushPage/pcpIntelligentPushUpdateBackSysUserPushSet.json");
+            body.put("userId",loginPage.getMember_id());
+            body.put("id",pushPage.getBackSysUserPushSetId(loginPage.getMember_id()));
+            body.put("matchPushSet",2);
+            body.put("matchRepeatPush",2);
+            Response response1=pushPage.updateBackSysUserPushSet(body);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertEquals(response1.path("data"),"修改成功");
+            Response response2=pushPage.getBackSysUserPushSet(loginPage.getMember_id());
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            assertEquals((int)response2.path("data.matchPushSet"),2);
+            assertEquals((int)response2.path("data.matchRepeatPush"),2);
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.updateBackSysUserPushSetAllClose:【推送设置】关闭智能推送、仅有新项目推送,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【关注政策】输入关键词,查询关注政策")
     @Story("智能推送")
     public void keywordGetGsIFocusPolicy(){
-        HashMap<String,Object> body1=new HashMap<>();
-        body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
-        body1.put("id",loginPage.getMember_id());
-        body1.put("keyword","技术,佛山");
-        Response response1=pushPage.focusPolicySet(body1);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertTrue(response1.path("data")==null);
-        HashMap<String,Object> body2=new HashMap<>();
-        body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
-        body2.put("memberId",loginPage.getMember_id());
-        Response response2=pushPage.getGsIFocusPolicy(body2);
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        ArrayList<HashMap<String,Object>> map=response2.path("data.result");
-        map.forEach(map1 -> {
-            assertTrue(String.valueOf(map1.get("title")).contains("技术") || String.valueOf(map1.get("title")).contains("佛山"));
-        });
+        try{
+            HashMap<String,Object> body1=new HashMap<>();
+            body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
+            body1.put("id",loginPage.getMember_id());
+            body1.put("keyword","技术,佛山");
+            Response response1=pushPage.focusPolicySet(body1);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertTrue(response1.path("data")==null);
+            HashMap<String,Object> body2=new HashMap<>();
+            body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
+            body2.put("memberId",loginPage.getMember_id());
+            Response response2=pushPage.getGsIFocusPolicy(body2);
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            ArrayList<HashMap<String,Object>> map=response2.path("data.result");
+            map.forEach(map1 -> {
+                assertTrue(String.valueOf(map1.get("title")).contains("技术") || String.valueOf(map1.get("title")).contains("佛山"));
+            });
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.keywordGetGsIFocusPolicy:【关注政策】输入关键词,查询关注政策,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【关注政策】输入政策等级,查询关注政策")
     @Story("智能推送")
     public void zcdjGetGsIFocusPolicy(){
-        HashMap<String,Object> body1=new HashMap<>();
-        body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
-        body1.put("id",loginPage.getMember_id());
-        body1.put("zcJibie","1,3");
-        Response response1=pushPage.focusPolicySet(body1);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertTrue(response1.path("data")==null);
-        HashMap<String,Object> body2=new HashMap<>();
-        body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
-        body2.put("memberId",loginPage.getMember_id());
-        Response response2=pushPage.getGsIFocusPolicy(body2);
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        ArrayList<HashMap<String,Object>> map=response2.path("data.result");
-        map.forEach(map1 -> {
-            assertTrue((int)map1.get("heat")==0 || (int)map1.get("heat")==2);
-        });
+        try{
+            HashMap<String,Object> body1=new HashMap<>();
+            body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
+            body1.put("id",loginPage.getMember_id());
+            body1.put("zcJibie","1,3");
+            Response response1=pushPage.focusPolicySet(body1);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertTrue(response1.path("data")==null);
+            HashMap<String,Object> body2=new HashMap<>();
+            body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
+            body2.put("memberId",loginPage.getMember_id());
+            Response response2=pushPage.getGsIFocusPolicy(body2);
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            ArrayList<HashMap<String,Object>> map=response2.path("data.result");
+            map.forEach(map1 -> {
+                assertTrue((int)map1.get("heat")==0 || (int)map1.get("heat")==2);
+            });
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.zcdjGetGsIFocusPolicy:【关注政策】输入政策等级,查询关注政策,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【关注政策】输入关键词、政策等级,查询关注政策")
     @Story("智能推送")
     public void allGetGsIFocusPolicy(){
-        HashMap<String,Object> body1=new HashMap<>();
-        body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
-        body1.put("id",loginPage.getMember_id());
-        body1.put("zcJibie","1,3");
-        body1.put("keyword","技术,佛山");
-        Response response1=pushPage.focusPolicySet(body1);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertTrue(response1.path("data")==null);
-        HashMap<String,Object> body2=new HashMap<>();
-        body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
-        body2.put("memberId",loginPage.getMember_id());
-        Response response2=pushPage.getGsIFocusPolicy(body2);
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        ArrayList<HashMap<String,Object>> map=response2.path("data.result");
-        map.forEach(map1 -> {
-            assertTrue((int)map1.get("heat")==0 || (int)map1.get("heat")==2);
-            assertTrue(String.valueOf(map1.get("title")).contains("技术") || String.valueOf(map1.get("title")).contains("佛山"));
+        try{
+            HashMap<String,Object> body1=new HashMap<>();
+            body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
+            body1.put("id",loginPage.getMember_id());
+            body1.put("zcJibie","1,3");
+            body1.put("keyword","技术,佛山");
+            Response response1=pushPage.focusPolicySet(body1);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertTrue(response1.path("data")==null);
+            HashMap<String,Object> body2=new HashMap<>();
+            body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
+            body2.put("memberId",loginPage.getMember_id());
+            Response response2=pushPage.getGsIFocusPolicy(body2);
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            ArrayList<HashMap<String,Object>> map=response2.path("data.result");
+            map.forEach(map1 -> {
+                assertTrue((int)map1.get("heat")==0 || (int)map1.get("heat")==2);
+                assertTrue(String.valueOf(map1.get("title")).contains("技术") || String.valueOf(map1.get("title")).contains("佛山"));
 
-        });
-        HashMap<String,Object> body3=new HashMap<>();
-        body3.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetFocusPolicySetting.json");
-        body3.put("id",loginPage.getMember_id());
-        Response response3=pushPage.getFocusPolicySetInfo(body3);
-        assertEquals((int) response3.path("code"),200);
-        assertEquals(response3.path("message"),"操作成功");
-        assertEquals(response3.path("data.keyword"),"技术,佛山");
-        assertEquals(response3.path("data.zcJibie"),"1,3");
+            });
+            HashMap<String,Object> body3=new HashMap<>();
+            body3.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetFocusPolicySetting.json");
+            body3.put("id",loginPage.getMember_id());
+            Response response3=pushPage.getFocusPolicySetInfo(body3);
+            assertEquals((int) response3.path("code"),200);
+            assertEquals(response3.path("message"),"操作成功");
+            assertEquals(response3.path("data.keyword"),"技术,佛山");
+            assertEquals(response3.path("data.zcJibie"),"1,3");
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.allGetGsIFocusPolicy:【关注政策】输入关键词、政策等级,查询关注政策,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("异常测试用例:【关注政策】均为空,查询关注政策为空")
     @Story("智能推送")
     public void emptyGetGsIFocusPolicy(){
-        HashMap<String,Object> body1=new HashMap<>();
-        body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
-        body1.put("id",loginPage.getMember_id());
-        Response response1=pushPage.focusPolicySet(body1);
-        assertEquals((int) response1.path("code"),200);
-        assertEquals(response1.path("message"),"操作成功");
-        assertTrue(response1.path("data")==null);
-        HashMap<String,Object> body2=new HashMap<>();
-        body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
-        body2.put("memberId",loginPage.getMember_id());
-        Response response2=pushPage.getGsIFocusPolicy(body2);
-        assertEquals((int) response2.path("code"),200);
-        assertEquals(response2.path("message"),"操作成功");
-        assertTrue((int)response2.path("data.total")==0);
+        try{
+            HashMap<String,Object> body1=new HashMap<>();
+            body1.put("_file","/apijson/page/pushPage/pcpIntelligentPushFocusPolicySet.json");
+            body1.put("id",loginPage.getMember_id());
+            Response response1=pushPage.focusPolicySet(body1);
+            assertEquals((int) response1.path("code"),200);
+            assertEquals(response1.path("message"),"操作成功");
+            assertTrue(response1.path("data")==null);
+            HashMap<String,Object> body2=new HashMap<>();
+            body2.put("_file","/apijson/page/pushPage/pcpIntelligentPushGetGslFocusPolicy.json");
+            body2.put("memberId",loginPage.getMember_id());
+            Response response2=pushPage.getGsIFocusPolicy(body2);
+            assertEquals((int) response2.path("code"),200);
+            assertEquals(response2.path("message"),"操作成功");
+            assertTrue((int)response2.path("data.total")==0);
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.emptyGetGsIFocusPolicy:【关注政策】均为空,查询关注政策为空,断言失败!");
+            throw  e;
+        }
     }
 
     @Test
     @Description("正常测试用例:【我的订阅】我的订阅列表查询")
     @Story("智能推送")
     public void mySubscribe(){
-        List<Integer> yidingyue= policyPage.getYidingyue();
-        HashMap<String,Object> body=new HashMap<>();
-        body.put("_file","/apijson/page/pushPage/pcpIntelligentPushMySubscribe.json");
-        body.put("id",loginPage.getMember_id());
-        Response response=pushPage.mySubscribe(body);
-        assertEquals((int) response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        ArrayList<HashMap<String,Object>> list=response.path("data");
-        list.forEach(map -> {
-            assertTrue(yidingyue.contains(map.get("id")));
-        });
+        try{
+            List<Integer> yidingyue= policyPage.getYidingyue();
+            HashMap<String,Object> body=new HashMap<>();
+            body.put("_file","/apijson/page/pushPage/pcpIntelligentPushMySubscribe.json");
+            body.put("id",loginPage.getMember_id());
+            Response response=pushPage.mySubscribe(body);
+            assertEquals((int) response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            ArrayList<HashMap<String,Object>> list=response.path("data");
+            list.forEach(map -> {
+                assertTrue(yidingyue.contains(map.get("id")));
+            });
+        }catch (AssertionError e){
+            Reporter.log("PushPageTest.mySubscribe:【我的订阅】我的订阅列表查询,断言失败!");
+            throw  e;
+        }
     }
 }

+ 29 - 18
src/test/java/page/SpecialPageTest.java

@@ -3,6 +3,7 @@ package page;
 import io.qameta.allure.Description;
 import io.qameta.allure.Story;
 import io.restassured.response.Response;
+import org.testng.Reporter;
 import org.testng.annotations.Test;
 import util.JDBCUtils;
 
@@ -19,15 +20,20 @@ public class SpecialPageTest {
     @Description("正常测试用例:查询所有政策专题")
     @Story("政策专题")
     public void getPolicyTopic(){
-        List<Object[]> sql= JDBCUtils.queryMulti("select pc_img,name,content from back_sys_topic where is_delete='0' and status='0' order by sort;");
-        Response response= specialPage.getPolicyTopic();
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        ArrayList<HashMap<String,String>> result=response.path("data");
-        for (int i=0;i<result.size();i++){
-            assertEquals(result.get(i).get("cover"),sql.get(i)[0]);
-            assertEquals(result.get(i).get("name"),sql.get(i)[1]);
-            assertEquals(result.get(i).get("describe"),sql.get(i)[2]);
+        try{
+            List<Object[]> sql= JDBCUtils.queryMulti("select pc_img,name,content from back_sys_topic where is_delete='0' and status='0' order by sort;");
+            Response response= specialPage.getPolicyTopic();
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            ArrayList<HashMap<String,String>> result=response.path("data");
+            for (int i=0;i<result.size();i++){
+                assertEquals(result.get(i).get("cover"),sql.get(i)[0]);
+                assertEquals(result.get(i).get("name"),sql.get(i)[1]);
+                assertEquals(result.get(i).get("describe"),sql.get(i)[2]);
+            }
+        }catch (AssertionError e){
+            Reporter.log("SpecialPageTest.getPolicyTopic:查询所有政策专题,断言失败!");
+            throw  e;
         }
     }
 
@@ -35,15 +41,20 @@ public class SpecialPageTest {
     @Description("正常测试用例:查询专题关联的项目")
     @Story("政策专题")
     public void policyTopicList(){
-        List<Object[]> sql= JDBCUtils.queryMulti("select id from back_sys_topic where is_delete='0' and status='0' order by sort;");
-        List<Object[]> project= JDBCUtils.queryMulti("select oa_formal_file.subtitle,oa_zhengce.fw_department from oa_formal_file INNER JOIN oa_zhengce on oa_formal_file.zhengceid=oa_zhengce.id where oa_formal_file.id in(SELECT formal FROM back_sys_topic_formal where topic_id=5) and oa_formal_file.status=1 and oa_formal_file.zhijian_status=5;");
-        HashMap<String,Object> map=new HashMap<>();
-        map.put("_file", "/apijson/page/specialPage/pcpIndexGetPolicyTopicPolicyTopicList.json");
-        map.put("id",sql.get(0)[0]);
-        Response response= specialPage.policyTopicList(map);
-        assertEquals((int)response.path("code"),200);
-        assertEquals(response.path("message"),"操作成功");
-        assertTrue(((List)response.path("data")).size()>0);
+        try{
+            List<Object[]> sql= JDBCUtils.queryMulti("select id from back_sys_topic where is_delete='0' and status='0' order by sort;");
+            List<Object[]> project= JDBCUtils.queryMulti("select oa_formal_file.subtitle,oa_zhengce.fw_department from oa_formal_file INNER JOIN oa_zhengce on oa_formal_file.zhengceid=oa_zhengce.id where oa_formal_file.id in(SELECT formal FROM back_sys_topic_formal where topic_id=5) and oa_formal_file.status=1 and oa_formal_file.zhijian_status=5;");
+            HashMap<String,Object> map=new HashMap<>();
+            map.put("_file", "/apijson/page/specialPage/pcpIndexGetPolicyTopicPolicyTopicList.json");
+            map.put("id",sql.get(0)[0]);
+            Response response= specialPage.policyTopicList(map);
+            assertEquals((int)response.path("code"),200);
+            assertEquals(response.path("message"),"操作成功");
+            assertTrue(((List)response.path("data")).size()>0);
+        }catch (AssertionError e){
+            Reporter.log("SpecialPageTest.policyTopicList:查询专题关联的项目,断言失败!");
+            throw  e;
+        }
 //        boolean b=false;
 //        for(int i=1;i<result.size();i++){
 //            String sub=result.get(i).get("subtitle");