Commit eb7c5de7 authored by 张艳玲's avatar 张艳玲

修改目录

parent f5e48399
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="kjj" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.8"> <bytecodeTargetLevel target="1.8">
<module name="kejiji" target="1.8" /> <module name="kejiji" target="1.8" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
......
...@@ -7,13 +7,6 @@ ...@@ -7,13 +7,6 @@
<component name="JavaScriptSettings"> <component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" /> <option name="languageLevel" value="ES6" />
</component> </component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
...@@ -488,4 +488,5 @@ public class Article { ...@@ -488,4 +488,5 @@ public class Article {
network.agentCookies.put("tku",AGENT_TKU); //tku 切换为访客的 network.agentCookies.put("tku",AGENT_TKU); //tku 切换为访客的
apiCount += 13; apiCount += 13;
} }
} }
package com.kjj.qa.cases; package com.kjj.cases.basics;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
...@@ -13,7 +13,7 @@ import java.util.HashMap; ...@@ -13,7 +13,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
public class Boss { public class Boss {
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import com.kjj.qa.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
...@@ -14,13 +14,13 @@ import java.util.HashMap; ...@@ -14,13 +14,13 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.qa.config.BasicConfig.BOSS_CREATE; import static com.kjj.config.BasicConfig.BOSS_CREATE;
import static com.kjj.qa.config.BasicConfig.BOSS_DETAIL; import static com.kjj.config.BasicConfig.BOSS_DETAIL;
import static com.kjj.qa.config.BasicConfig.BOSS_EDITCONFIG; import static com.kjj.config.BasicConfig.BOSS_EDITCONFIG;
import static com.kjj.qa.config.BasicConfig.BOSS_ISDEMO; import static com.kjj.config.BasicConfig.BOSS_ISDEMO;
import static com.kjj.qa.config.BasicConfig.BOSS_PUBLISH; import static com.kjj.config.BasicConfig.BOSS_PUBLISH;
import static com.kjj.qa.config.BasicConfig.BOSS_RECEIVERLIST; import static com.kjj.config.BasicConfig.BOSS_RECEIVERLIST;
import static com.kjj.qa.config.BasicConfig.BOSS_TEAMTASKLIST; import static com.kjj.config.BasicConfig.BOSS_TEAMTASKLIST;
public class BossTest { public class BossTest {
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
...@@ -12,7 +12,7 @@ import java.util.HashMap; ...@@ -12,7 +12,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
public class CircleFriends { public class CircleFriends {
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import com.kjj.qa.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
...@@ -12,7 +12,7 @@ import java.io.IOException; ...@@ -12,7 +12,7 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
public class GreetingCard { public class GreetingCard {
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import org.testng.annotations.*; import org.testng.annotations.*;
public class Home { public class Home {
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import com.kjj.qa.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.*; import org.testng.annotations.*;
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
...@@ -12,20 +12,20 @@ import java.io.IOException; ...@@ -12,20 +12,20 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.kjj.qa.config.BasicConfig.ISVIPSUBSCRIBE; import static com.kjj.config.BasicConfig.ISVIPSUBSCRIBE;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_APPRAISELISTNEW; import static com.kjj.config.BasicConfig.SELLERCARD_APPRAISELISTNEW;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_COMPANYLIST; import static com.kjj.config.BasicConfig.SELLERCARD_COMPANYLIST;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_EDITBASEINFO; import static com.kjj.config.BasicConfig.SELLERCARD_EDITBASEINFO;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_EDITMAJORGOODAUTH; import static com.kjj.config.BasicConfig.SELLERCARD_EDITMAJORGOODAUTH;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_GETQUESTIONS; import static com.kjj.config.BasicConfig.SELLERCARD_GETQUESTIONS;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_ISDISPLAYACTIVITY; import static com.kjj.config.BasicConfig.SELLERCARD_ISDISPLAYACTIVITY;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_PERSONALPROFILE; import static com.kjj.config.BasicConfig.SELLERCARD_PERSONALPROFILE;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_PRODUCTLIST; import static com.kjj.config.BasicConfig.SELLERCARD_PRODUCTLIST;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_SELLERCARDCASENEW; import static com.kjj.config.BasicConfig.SELLERCARD_SELLERCARDCASENEW;
import static com.kjj.qa.config.BasicConfig.SELLERCARD_TOPOFDETAIL; import static com.kjj.config.BasicConfig.SELLERCARD_TOPOFDETAIL;
import static com.kjj.qa.config.BasicConfig.VERSION_INFO; import static com.kjj.config.BasicConfig.VERSION_INFO;
import static com.kjj.qa.config.BasicConfig.WECHAT_NAME; import static com.kjj.config.BasicConfig.WECHAT_NAME;
import static com.kjj.qa.config.BasicConfig.apiCount; import static com.kjj.config.BasicConfig.apiCount;
public class SellerCard { public class SellerCard {
private static final NetworkUtils network = NetworkUtils.getInstance(); private static final NetworkUtils network = NetworkUtils.getInstance();
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.*; import org.testng.annotations.*;
...@@ -117,7 +117,7 @@ public class Upload { ...@@ -117,7 +117,7 @@ public class Upload {
@Test(description = "上传_本地视频",priority = 5) @Test(description = "上传_本地视频",priority = 5)
public void 上传_本地视频() throws IOException { public void 上传_本地视频() throws IOException {
//1.上传视频到oss //1.上传视频到oss
String videoFile = "src/test/java/com/kjj/qa/resource/uploadCase.mp4"; String videoFile = "src/test/java/com/kjj/resource/uploadCase.mp4";
Response response = network.postFileResponse(videoFile, UPLOAD_UPLOADVEDIO); Response response = network.postFileResponse(videoFile, UPLOAD_UPLOADVEDIO);
String videoUrl = response.jsonPath().getString("data.videoUrl"); String videoUrl = response.jsonPath().getString("data.videoUrl");
String firstFrameUrl = response.jsonPath().getString("data.firstFrameUrl"); String firstFrameUrl = response.jsonPath().getString("data.firstFrameUrl");
......
package com.kjj.qa.cases; package com.kjj.cases.basics;
public class Video { public class Video {
......
package com.kjj.qa.config; package com.kjj.config;
public class BasicConfig { public class BasicConfig {
public static int apiCount; //接口数量统计 public static int apiCount; //接口数量统计
// 是否开启钉钉机器人推送 // 是否开启钉钉机器人推送
public static final boolean isPushReport = true; //true public static final boolean isPushReport = false; //true
// 代理人微信昵称 // 代理人微信昵称
public static final String WECHAT_NAME = "客集集-梦晨"; //true public static final String WECHAT_NAME = "客集集-梦晨"; //true
......
package com.kjj.qa.config; package com.kjj.config;
import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentReports;
...@@ -14,7 +14,7 @@ import org.testng.xml.XmlSuite; ...@@ -14,7 +14,7 @@ import org.testng.xml.XmlSuite;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import com.kjj.qa.utils.DingTalkUtils; import com.kjj.utils.DingTalkUtils;
public class ExtentTestNGIReporterListener implements IReporter { public class ExtentTestNGIReporterListener implements IReporter {
// 生成的路径以及文件名 // 生成的路径以及文件名
...@@ -79,29 +79,29 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -79,29 +79,29 @@ public class ExtentTestNGIReporterListener implements IReporter {
// 统计SuiteResult下的数据 // 统计SuiteResult下的数据
int passSize = r.getTestContext().getPassedTests().size(); int passSize = r.getTestContext().getPassedTests().size();
int failSize = r.getTestContext().getFailedTests().size(); int failSize = r.getTestContext().getFailedTests().size();
int skipSize = r.getTestContext().getSkippedTests().size(); // int skipSize = r.getTestContext().getSkippedTests().size();
suitePassSize += passSize; suitePassSize += passSize;
suiteFailSize += failSize; suiteFailSize += failSize;
suiteSkipSize += skipSize; // suiteSkipSize += skipSize;
if (failSize > 0) { if (failSize > 0) {
resultNode.getModel().setStatus(Status.FAIL); resultNode.getModel().setStatus(Status.FAIL);
} }
resultNode.getModel().setDescription( resultNode.getModel().setDescription(
String.format("Pass: %s ; Fail: %s ; Skip: %s ;", passSize, failSize, skipSize)); String.format("Pass: %s ; Fail: %s ;", passSize, failSize));
} }
buildTestNodes(resultNode, context.getFailedTests(), Status.FAIL); buildTestNodes(resultNode, context.getFailedTests(), Status.FAIL);
buildTestNodes(resultNode, context.getSkippedTests(), Status.SKIP); // buildTestNodes(resultNode, context.getSkippedTests(), Status.SKIP);
buildTestNodes(resultNode, context.getPassedTests(), Status.PASS); buildTestNodes(resultNode, context.getPassedTests(), Status.PASS);
} }
if (suiteTest != null) { if (suiteTest != null) {
suiteTest.getModel().setDescription( suiteTest.getModel().setDescription(
String.format("Pass: %s ; Fail: %s ; Skip: %s ;", suitePassSize, suiteFailSize, suiteSkipSize)); String.format("Pass: %s ; Fail: %s ;", suitePassSize, suiteFailSize));
if (suiteFailSize > 0) { if (suiteFailSize > 0) {
suiteTest.getModel().setStatus(Status.FAIL); suiteTest.getModel().setStatus(Status.FAIL);
} }
} }
String context = String.format("通过的用例数: %s\n失败的用例数: %s\n跳过的用例数: %s\n", suitePassSize, suiteFailSize, suiteSkipSize); String context = String.format("通过的用例数: %s\n失败的用例数: %s\n", suitePassSize, suiteFailSize, suiteSkipSize);
try { try {
DingTalkUtils.sendVal(context); DingTalkUtils.sendVal(context);
} catch (Exception e) { } catch (Exception e) {
......
package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Novice {
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass
public void setUp() {
}
//会员判断
@Test(description="会员判断",priority = 1)
public void 会员判断() throws IOException{
Response response = network.getResponse(ISVIPSUBSCRIBE);
boolean isVip = response.jsonPath().getBoolean("data.vip");
Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"新手任务-会员判断错误",response.body().asString()));
}
//用户信息
@Test(description = "用户信息",priority = 2)
public void 用户信息()throws IOException{
Response response = network.getResponse(USER_INFO);
String wxName = response.jsonPath().getString("data.wxName");
Assert.assertEquals(wxName,"Su Yi",network.message(USER_INFO,"新手任务-获取用户信息失败",response.body().asString()));
}
//新手任务列表
@Test (description = "新手任务列表",priority = 3) //priorty 方法执行优先级
public void 新手任务列表() throws IOException {
Response response = network.getResponse(NOVICE_LIST);
System.out.println(response.getBody().prettyPrint());
int length = response.jsonPath().getInt("data.size()");
Assert.assertEquals(length,12,network.message(NOVICE_LIST,"新手任务-任务列表数量不对",response.body().asString()));
}
// 关注公众号 需要微信回调,无法实现
// @Test (description = "新手任务_关注公众号",priority = 4) //priorty 方法执行优先级
// public void 新手任务_关注公众号() throws IOException {
// //获取列表中"关注公众号"的任务
// Response response = network.getResponse("/kjy/mp/seller/novice/list");
//
// //获取任务名为"关注公众号"的任务状态 code: 0未完成 1可领奖励 2已完成
// int code = response.jsonPath().getInt("data.find {it.taskName == '关注公众号'}.taskStatus.code");
// Assert.assertEquals(code,0,"关注公众号-任务初始状态 获取失败");
//
// //关注导师微信号和关注客集集公众号(关注需要微信回调,无法实现)
//
// //重新获取任务名为"关注公众号"的任务状态,验证任务是否生效
//
// }
// 转发文章
@Test (description = "新手任务_转发文章",priority = 5) //priorty 方法执行优先级
public void 新手任务_转发文章() throws IOException {
//获取列表中"转发文章"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '转发文章'}.taskStatus.code");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"转发文章-任务初始状态 获取失败",response.body().asString()));
//转发文章到朋友圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId",getScId(ARTICLE_CONTENTID));//文章scId
params.put("forwardType",1);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, FORWARD,"转发文章-转发到朋友圈 失败",response.body().asString()));
//重新获取任务名为"转发文章"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '转发文章'}.taskStatus.code");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"转发文章-新手任务完成状态 获取失败",response.body().asString()));
}
// 转发动画
@Test (description = "新手任务_转发动画",priority = 6) //priorty 方法执行优先级
public void 新手任务_转发动画() throws IOException {
//获取列表中"转发动画"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发动画"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '转发动画'}.taskStatus.code");
Assert.assertEquals(code,0, network.message(NOVICE_LIST,"转发动画-任务初始状态 获取失败",response.body().asString()));
//转发动画到朋友圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId",getScId(ANIMATION_CONTENTID));//动画scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, FORWARD,"转发动画-转发到朋友圈 失败",response.body().asString()));
//重新获取任务名为"转发动画"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发动画"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '转发动画'}.taskStatus.code");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"转发动画-新手任务完成状态 获取失败",response.body().asString()));
}
// 转发游戏
@Test (description = "新手任务_转发游戏",priority = 7) //priorty 方法执行优先级
public void 新手任务_转发游戏() throws IOException {
//获取列表中"转发游戏"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发游戏"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '转发游戏(内测中)'}.taskStatus.code");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"转发游戏-任务初始状态 获取失败",response.body().asString()));
//转发游戏到朋友圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId",getScId(GAME_CONTENTID));//游戏scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,FORWARD,"转发游戏-转发到朋友圈 失败",response.body().asString()));
//重新获取任务名为"转发游戏"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发游戏"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '转发游戏(内测中)'}.taskStatus.code");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"转发游戏-新手任务完成状态 获取失败",response.body().asString()));
}
//上传文章
@Test (description = "新手任务_上传文章",priority = 8) //priorty 方法执行优先级
public void 新手任务_上传文章() throws IOException {
//获取列表中"上传文章"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"上传文章"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '上传文章'}.taskStatus.code");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"上传文章-任务初始状态 获取失败",response.body().asString()));
//上传文章并发到朋友圈 (文章已经在上传case执行过,所以找到那篇文章进行转发就好)
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex",1);
params.put("pageNo",1);
params.put("pageSize",10);
//获取我的上传里文章的列表
params.put("type","article");
response = network.getResponse(params,UPLOAD_LIST);
String contentType = response.jsonPath().getString("data[0].contentType");
String contentId = response.jsonPath().getString("data[0].id");//获取文章的contentd
Assert.assertEquals(contentType, "article", network.message(params, UPLOAD_LIST,"上传文章-获取我的上传-文章列表数量有误",response.body().asString()));
//转发文章到朋友圈
Map<String, Object> shareParams = new HashMap<String, Object>();
shareParams.put("scId",getScId(contentId));
shareParams.put("forwardType",2);
response = network.getResponse(shareParams,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(shareParams, FORWARD,"上传文章-发到朋友圈 失败",response.body().asString()));
//重新获取任务名为"上传文章"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"上传文章"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '上传文章'}.taskStatus.code");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"上传文章-完成新手任务 失败",response.body().asString()));
}
// 收到好友转发访问 该接口已废弃
// @Test (description = "新手任务_收到好友转发访问",priority = 9) //priorty 方法执行优先级
// public void 新手任务_收到好友转发访问() throws IOException {
// //获取列表中"收到好友转发访问"的任务
// Response response = network.getResponse("/kjy/mp/seller/novice/list");
//
// //获取任务名为"收到好友转发访问"的任务状态 code: 0未完成 1可领奖励 2已完成
// int code = response.jsonPath().getInt("data.find {it.taskName == '收到好友转发访问'}.taskStatus.code");
// Assert.assertEquals(code,0,"获取新手任务初始状态-收到好友转发访问 失败");
//
// //收到好友转发访问
// network.agentCookies.put("tku",network.visitorTku); //tku 切换为访客的
//
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("scId","Kj20MTMwMDM5");//文章scId
// params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
// response = network.getResponse(params,"/kjy/mp/forward");
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,"收到好友转发访问-好友转发到朋友圈 失败");
//
// network.agentCookies.put("tku",network.agentTku); //tku 切换为代理人的
//
//// //重新获取任务名为"收到好友转发访问"的任务状态,验证任务是否生效
//// response = network.getResponse("/kjy/mp/seller/novice/list");
//// //获取任务名为"收到好友转发访问"的任务状态 code: 0未完成 1可领奖励 2已完成
//// code = response.jsonPath().getInt("data.find {it.taskName == '收到好友转发访问'}.taskStatus.code");
//// Assert.assertEquals(code,1,"收到好友转发访问-新手任务完成状态 获取失败");
//
//
//
// }
//查看访问客户
@Test (description = "新手任务_查看访问客户",priority = 9) //priorty 方法执行优先级
public void 新手任务_查看访问客户() throws IOException {
//获取列表中"查看访问客户"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"查看访问客户"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '查看访问客户'}.taskStatus.code");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"获取新手任务初始状态-查看访问客户 失败",response.body().asString()));
//好友转发一篇我的素材
network.agentCookies.put("tku",VISITOR_TKU); //tku 切换为访客的
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId",getScId(UPLOAD_CONTENTID));//文章scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,FORWARD,"查看访问客户-好友转发到朋友圈 失败",response.body().asString()));
network.agentCookies.put("tku",AGENT_TKU); //tku 切换为代理人的
//进入谁看过我,查看访客列表
Map<String, Object> whoSawMeParams = new HashMap<String, Object>();
whoSawMeParams.put("pageIndex",1);
whoSawMeParams.put("pageSize",30);
response = network.getResponse(whoSawMeParams, WHOSAWME_CUSTCLUELISTV2);
boolean hasnext = response.jsonPath().getBoolean("data.hasNext");
int length = response.jsonPath().getInt("data.list.size()");
Assert.assertNotEquals(0,network.message(whoSawMeParams, WHOSAWME_CUSTCLUELISTV2,"获取谁看过我列表成功",response.body().asString()));
//点击查看,进入线索详情页
Map<String, Object> noviceParams = new HashMap<String, Object>();
noviceParams.put("sceneCode","noviceTask_visitorsCustomerInfoComplete");
response = network.postResponse(noviceParams,NOVICE_MONGOLIANLAYERISPLAY);
String desc = response.jsonPath().getString("desc");
//重新获取任务名为"查看访问客户"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"查看访问客户"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '查看访问客户'}.taskStatus.code");
Assert.assertEquals(code,1, network.message(NOVICE_LIST,"查看访问客户-新手任务完成状态 获取失败",response.body().asString()));
}
//完善名片 名片改动,此处始终会处于未完成状态,待产品优化
@Test (description = "新手任务_完善名片",priority = 9) //priorty 方法执行优先级
public void 新手任务_完善名片() throws IOException {
//获取列表中"完善名片"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"完善名片"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '完善名片'}.taskStatus.code");
Assert.assertEquals(code,0, network.message(NOVICE_LIST,"获取新手任务初始状态-完善名片 失败",response.body().asString()));
//完善名片
//重新获取任务名为"完善名片"的任务状态,验证任务是否生效
}
//获取ScId
public String getScId (String contentId){
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",contentId);
Response response = network.getResponse(params, GETSCID);
String scId = response.jsonPath().getString("data");
Assert.assertNotNull(scId,network.message(params, GETSCID,"获取scId失败",response.body().asString()));
return scId;
}
@AfterClass
public static void tearDown(){
apiCount += 6;
}
}
package com.kjj.qa.utils; package com.kjj.utils;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
......
package com.kjj.qa.utils; package com.kjj.utils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
......
package com.kjj.qa.utils; package com.kjj.utils;
import java.util.HashMap; import java.util.HashMap;
import javax.crypto.Cipher; import javax.crypto.Cipher;
......
package com.kjj.qa.utils; package com.kjj.utils;
import io.restassured.response.Response; import io.restassured.response.Response;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -17,7 +17,7 @@ public class DingTalkUtils { ...@@ -17,7 +17,7 @@ public class DingTalkUtils {
+ context + context
+ "总接口数:"+ apiCount + "\n" + "总接口数:"+ apiCount + "\n"
+ "报告地址: http://10.172.58.199/view/kkk/job/kejiji_interface/HTML_20Report\n" + "报告地址: http://10.172.58.199/view/kkk/job/kejiji_interface/HTML_20Report\n"
+ "@李浩弘 @张震 @别湘灵 @张艳玲 @张慧锋"; + "@张慧锋 @张艳玲 @张震 @别湘灵";
System.out.println(context); System.out.println(context);
......
package com.kjj.qa.utils; package com.kjj.utils;
import java.sql.*; import java.sql.*;
......
package com.kjj.qa.utils; package com.kjj.utils;
import static com.kjj.qa.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static io.restassured.RestAssured.*; import static io.restassured.RestAssured.*;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
......
...@@ -13,47 +13,47 @@ ...@@ -13,47 +13,47 @@
<!-- </test>--> <!-- </test>-->
<test preserve-order="true" name="支付"> <test preserve-order="true" name="支付">
<classes> <classes>
<class name="com.kjj.qa.cases.Pay"/> <class name="com.kjj.cases.basics.Pay"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="名片"> <test preserve-order="true" name="名片">
<classes> <classes>
<class name="com.kjj.qa.cases.SellerCard"/> <class name="com.kjj.cases.basics.SellerCard"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="上传"> <test preserve-order="true" name="上传">
<classes> <classes>
<class name="com.kjj.qa.cases.Upload"/> <class name="com.kjj.cases.basics.Upload"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="文章"> <test preserve-order="true" name="文章">
<classes> <classes>
<class name="com.kjj.qa.cases.Article"/> <class name="com.kjj.cases.basics.Article"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="发圈"> <test preserve-order="true" name="发圈">
<classes> <classes>
<class name="com.kjj.qa.cases.CircleFriends"/> <class name="com.kjj.cases.basics.CircleFriends"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="boss看板"> <test preserve-order="true" name="boss看板">
<classes> <classes>
<class name="com.kjj.qa.cases.Boss"/> <class name="com.kjj.cases.basics.Boss"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="boss看板演示版"> <test preserve-order="true" name="boss看板演示版">
<classes> <classes>
<class name="com.kjj.qa.cases.BossTest"/> <class name="com.kjj.cases.basics.BossTest"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="贺卡"> <test preserve-order="true" name="贺卡">
<classes> <classes>
<class name="com.kjj.qa.cases.GreetingCard"/> <class name="com.kjj.cases.basics.GreetingCard"/>
</classes> </classes>
</test> </test>
<!-- 监听器--> <!-- 监听器-->
<listeners> <listeners>
<listener class-name="com.kjj.qa.config.ExtentTestNGIReporterListener"/> <listener class-name="com.kjj.config.ExtentTestNGIReporterListener"/>
</listeners> </listeners>
</suite> </suite>
<!-- Suite --> <!-- Suite -->
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment