Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
龚小红
oto
Commits
ad51b4a2
Commit
ad51b4a2
authored
Apr 27, 2020
by
Su-Yi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新网络框架、钉钉机器人、名片
parent
ba57991d
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1006 additions
and
251 deletions
+1006
-251
Home.java
src/test/java/com/kjj/qa/cases/Home.java
+0
-1
Pay.java
src/test/java/com/kjj/qa/cases/Pay.java
+14
-14
SellerCard.java
src/test/java/com/kjj/qa/cases/SellerCard.java
+147
-15
NetworkOperation.java
src/test/java/com/kjj/qa/services/NetworkOperation.java
+6
-4
DingTalkUtil.java
src/test/java/com/kjj/qa/utils/DingTalkUtil.java
+15
-4
KjyUtil.java
src/test/java/com/kjj/qa/utils/KjyUtil.java
+3
-0
testNG.xml
src/test/testNG.xml
+9
-9
report.html
test-output/report.html
+812
-204
No files found.
src/test/java/com/kjj/qa/cases/Home.java
View file @
ad51b4a2
...
...
@@ -21,7 +21,6 @@ public class Home {
public
void
setUp
()
{
// 代理人 cookies
network
.
agentCookies
.
put
(
"tku"
,
"3wSM7Cd4wsesMcuzVhBQVGVupkmB3tT1JHyRbv9sK6ts7f6P67rmuygUqGfPc2Xd9YduvdByMocmpuzNMzKKWd48"
);
network
.
agentCookies
.
put
(
"acw_tc"
,
"76b20ff215756198852864366e248d9e6bfb989ae8f073e81a05f23e6ef703"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
}
...
...
src/test/java/com/kjj/qa/cases/Pay.java
View file @
ad51b4a2
...
...
@@ -21,7 +21,7 @@ public class Pay {
@BeforeClass
public
void
setUp
()
{
// 代理人 cookies
network
.
agentCookies
.
put
(
"tku"
,
"T3gM31f18j
AXAwJJQPrjuY6xCJQThg3dXxpzkv8X5w3oZZn5yXB41EQad3CuY5A8USk26gxjQvUn7hWekU
"
);
network
.
agentCookies
.
put
(
"tku"
,
"T3gM31f18j
8w3o5y1iEkAGkGxfNgri1yZC1Qix9Y8JawhrzhpZMDhgTzDvhzXSbagbXZxA8AYCbxLPG4SG
"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
}
...
...
@@ -66,9 +66,8 @@ public class Pay {
payParams
.
put
(
"oaId"
,
"1"
);
payParams
.
put
(
"paySource"
,
"2"
);
payParams
.
put
(
"sellerFrom"
,
""
);
String
payJson
=
JSONObject
.
toJSONString
(
payParams
);
Response
orderAppId
=
network
.
PostResponse
(
payJson
,
"/kjy/order/create"
);
Response
orderAppId
=
network
.
postResponse
(
payParams
,
"/kjy/order/create"
);
String
appId
=
orderAppId
.
jsonPath
().
getString
(
"data.appId"
);
Assert
.
assertEquals
(
appId
,
"wxcb8c36279dd7dff2"
,
"拉起支付:拉起微信支付失败"
);
//判断返回的微信调起参数中appId是否正确
...
...
@@ -83,8 +82,7 @@ public class Pay {
payParams
.
put
(
"oaId"
,
"1"
);
payParams
.
put
(
"paySource"
,
"2"
);
payParams
.
put
(
"sellerFrom"
,
""
);
String
payJson
=
JSONObject
.
toJSONString
(
payParams
);
Response
orderAppId
=
network
.
PostResponse
(
payJson
,
"/kjy/order/create"
);
Response
orderAppId
=
network
.
postResponse
(
payParams
,
"/kjy/order/create"
);
String
tradeNo
=
orderAppId
.
jsonPath
().
getString
(
"data.tradeNo"
);
...
...
@@ -111,9 +109,11 @@ public class Pay {
int
changeVersion
=
userVersion
==
1
?
2
:
1
;
// 判断当前开启的版本,如果当前版本是1,则改为2,反之;
//切换版本
String
changeUserVersionJson
=
"{\"targetVersion\":"
+
changeVersion
+
"}"
;
Response
resultResponse
=
network
.
PostResponse
(
changeUserVersionJson
,
"/kjy/mp/version/exchange"
);
Map
<
String
,
Object
>
versionParams
=
new
HashMap
<
String
,
Object
>();
versionParams
.
put
(
"targetVersion"
,
changeVersion
);
Response
resultResponse
=
network
.
postResponse
(
versionParams
,
"/kjy/mp/version/exchange"
);
String
result
=
resultResponse
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
result
,
"OK"
,
"会员类型切换:切换失败"
);
//判断返回的微信调起参数中appId是否正确
...
...
@@ -130,7 +130,7 @@ public class Pay {
// 绑定一个上级为保险版的会员,scId和inviterSid可以在用户分享的链接里拿到
Map
<
String
,
Object
>
distributeParams
=
new
HashMap
<
String
,
Object
>();
distributeParams
.
put
(
"scId"
,
"Kj21OTk0MTU"
);
//文章ID: 文章转化访客时,传此参数
distributeParams
.
put
(
"inviterSid"
,
"Kj21MTQ4OTU"
);
//销售ID: 会员邀请好友付费时,传此参数
distributeParams
.
put
(
"inviterSid"
,
"Kj21MTQ4OTU"
);
//销售ID:
1861加密后
会员邀请好友付费时,传此参数
distributeParams
.
put
(
"fromStr"
,
6
);
//文章来源: 6文章访客转化 1会员邀请
distributeParams
.
put
(
"accessSource"
,
12
);
//支付来源:客集集
Response
distributeResponse
=
network
.
getResponse
(
distributeParams
,
"/kjy/sp/visitorPayment/distribute"
);
...
...
@@ -171,9 +171,8 @@ public class Pay {
payParams
.
put
(
"oaId"
,
"1"
);
payParams
.
put
(
"paySource"
,
"2"
);
payParams
.
put
(
"sellerFrom"
,
""
);
String
payJson
=
JSONObject
.
toJSONString
(
payParams
);
Response
orderAppId
=
network
.
PostResponse
(
payJson
,
"/kjy/order/create"
);
Response
orderAppId
=
network
.
postResponse
(
payParams
,
"/kjy/order/create"
);
String
appId
=
orderAppId
.
jsonPath
().
getString
(
"data.appId"
);
Assert
.
assertEquals
(
appId
,
"wxcb8c36279dd7dff2"
,
"拉起支付:拉起微信支付失败"
);
//判断返回的微信调起参数中appId是否正确
}
...
...
@@ -199,8 +198,7 @@ public class Pay {
payParams
.
put
(
"oaId"
,
"1"
);
payParams
.
put
(
"paySource"
,
"2"
);
payParams
.
put
(
"sellerFrom"
,
""
);
String
payJson
=
JSONObject
.
toJSONString
(
payParams
);
Response
orderAppId
=
network
.
PostResponse
(
payJson
,
"/kjy/order/create"
);
Response
orderAppId
=
network
.
postResponse
(
payParams
,
"/kjy/order/create"
);
String
tradeNo
=
orderAppId
.
jsonPath
().
getString
(
"data.tradeNo"
);
...
...
@@ -223,8 +221,10 @@ public class Pay {
int
changeVersion
=
userVersion
==
1
?
2
:
1
;
// 判断当前开启的版本,如果当前版本是1,则改为2,反之;
//切换版本
String
changeUserVersionJson
=
"{\"targetVersion\":"
+
changeVersion
+
"}"
;
Response
resultResponse
=
network
.
PostResponse
(
changeUserVersionJson
,
"/kjy/mp/version/exchange"
);
//切换版本
Map
<
String
,
Object
>
versionParams
=
new
HashMap
<
String
,
Object
>();
versionParams
.
put
(
"targetVersion"
,
changeVersion
);
Response
resultResponse
=
network
.
postResponse
(
versionParams
,
"/kjy/mp/version/exchange"
);
String
result
=
resultResponse
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
result
,
"OK"
,
"会员类型切换:切换失败"
);
//判断返回的微信调起参数中appId是否正确
...
...
src/test/java/com/kjj/qa/cases/SellerCard.java
View file @
ad51b4a2
This diff is collapsed.
Click to expand it.
src/test/java/com/kjj/qa/services/NetworkOperation.java
View file @
ad51b4a2
...
...
@@ -36,7 +36,7 @@ public class NetworkOperation {
private
static
String
host
=
"https://kjj.m.duibatest.com.cn"
;
//测试环境
//钉钉机器人域名
private
static
String
dingtalkPath
=
"https://oapi.dingtalk.com/robot/send?access_token=
f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2
"
;
private
static
String
dingtalkPath
=
"https://oapi.dingtalk.com/robot/send?access_token=
e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd
"
;
// get 不带参请求
public
Response
getResponse
(
String
path
)
{
...
...
@@ -56,7 +56,7 @@ public class NetworkOperation {
}
// post 不帶参请求
public
Response
P
ostResponse
(
String
path
)
{
public
Response
p
ostResponse
(
String
path
)
{
return
given
()
.
cookies
(
agentCookies
)
.
headers
(
agentHeaders
)
...
...
@@ -64,7 +64,8 @@ public class NetworkOperation {
}
// post 带参请求
public
Response
PostResponse
(
String
jsonStr
,
String
path
)
{
public
Response
postResponse
(
Map
<
String
,
Object
>
params
,
String
path
)
{
String
jsonStr
=
JSONObject
.
toJSONString
(
params
);
return
given
()
.
cookies
(
agentCookies
)
.
headers
(
agentHeaders
)
...
...
@@ -74,7 +75,8 @@ public class NetworkOperation {
}
// post 带参请求
public
Response
dingTalkRobot
(
String
jsonStr
)
{
public
Response
dingTalkRobot
(
Map
<
String
,
Object
>
params
)
{
String
jsonStr
=
JSONObject
.
toJSONString
(
params
);
dingTalkHeaders
.
put
(
"Content-Type"
,
"application/json;charset=utf-8"
);
return
given
()
...
...
src/test/java/com/kjj/qa/utils/DingTalkUtil.java
View file @
ad51b4a2
...
...
@@ -2,17 +2,28 @@ package com.kjj.qa.utils;
import
com.kjj.qa.services.NetworkOperation
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
DingTalkUtil
{
//通过钉钉机器人发送消息到钉钉群中
public
static
void
sendVal
(
String
context
)
throws
Exception
{
context
=
context
+
"报告地址:http://10.254.187.25/view/kjj_test/job/kejiji_interface/ws/test-output/report.html"
;
String
entityString
=
"{'msgtype': 'text', 'text': {'content': '【测试结果】\n"
+
context
+
"'}}"
;
//测试结果
context
=
"【测试结果】\n"
+
context
+
"报告地址: http://10.254.187.25/view/kjj_test/job/kejiji_interface/ws/test-output/report.html"
;
System
.
out
.
println
(
entityString
);
Map
<
String
,
Object
>
contentParams
=
new
HashMap
<
String
,
Object
>();
contentParams
.
put
(
"content"
,
context
);
//钉钉机器人消息体
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"msgtype"
,
"text"
);
params
.
put
(
"text"
,
contentParams
);
// System.out.println(params);
NetworkOperation
network
=
new
NetworkOperation
();
network
.
dingTalkRobot
(
entityString
);
//发起请求
network
.
dingTalkRobot
(
params
);
//发起dingding机器人通知
}
...
...
src/test/java/com/kjj/qa/utils/KjyUtil.java
View file @
ad51b4a2
package
com
.
kjj
.
qa
.
utils
;
import
com.kjj.qa.services.NetworkOperation
;
public
final
class
KjyUtil
{
}
src/test/testNG.xml
View file @
ad51b4a2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite
name=
"客集集-测试结果"
verbose=
"1"
thread-count=
"3"
>
<test
preserve-order=
"true"
name=
"首页"
>
<!-- <test preserve-order="true" name="首页" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.Home"/>-->
<!-- </classes>-->
<!-- </test>-->
<test
preserve-order=
"true"
name=
"支付"
>
<classes>
<class
name=
"com.kjj.qa.cases.
Home
"
/>
<class
name=
"com.kjj.qa.cases.
Pay
"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"
支付
"
>
<test
preserve-order=
"true"
name=
"
名片
"
>
<classes>
<class
name=
"com.kjj.qa.cases.
Pay
"
/>
<class
name=
"com.kjj.qa.cases.
SellerCard
"
/>
</classes>
</test>
<!-- <test preserve-order="true" name="名片" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.SellerCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- 监听器-->
<listeners>
<listener
class-name=
"com.kjj.qa.config.ExtentTestNGIReporterListener"
/>
...
...
test-output/report.html
View file @
ad51b4a2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment