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
547145a8
Commit
547145a8
authored
Jul 29, 2020
by
Su-Yi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文章推荐
parent
be75345f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1070 additions
and
777 deletions
+1070
-777
Article.java
src/test/java/com/kjj/qa/cases/Article.java
+6
-6
Pay.java
src/test/java/com/kjj/qa/cases/Pay.java
+46
-1
BasicConfig.java
src/test/java/com/kjj/qa/config/BasicConfig.java
+1
-1
BaseUtils.java
src/test/java/com/kjj/qa/utils/BaseUtils.java
+1
-1
Pay.class
target/test-classes/com/kjj/qa/cases/Pay.class
+0
-0
BasicConfig.class
target/test-classes/com/kjj/qa/config/BasicConfig.class
+0
-0
report.html
test-output/report.html
+1016
-768
No files found.
src/test/java/com/kjj/qa/cases/Article.java
View file @
547145a8
...
@@ -178,10 +178,10 @@ public class Article {
...
@@ -178,10 +178,10 @@ public class Article {
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
3
);
params
.
put
(
"pageSize"
,
2
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
);
int
count
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
;
boolean
hasList
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
>
0
;
Assert
.
assert
Equals
(
count
,
3
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"
获取个人专栏列表有误"
,
response
.
body
().
asString
()));
Assert
.
assert
True
(
hasList
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"代理人-
获取个人专栏列表有误"
,
response
.
body
().
asString
()));
String
answer
=
response
.
jsonPath
().
getString
(
"data.list[0].answer"
);
String
answer
=
response
.
jsonPath
().
getString
(
"data.list[0].answer"
);
Assert
.
assertNotNull
(
answer
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"获取问答内容有误"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
answer
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"获取问答内容有误"
,
response
.
body
().
asString
()));
}
}
...
@@ -406,10 +406,10 @@ public class Article {
...
@@ -406,10 +406,10 @@ public class Article {
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"scid"
,
scid
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
3
);
params
.
put
(
"pageSize"
,
2
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
);
Response
response
=
network
.
getResponse
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
);
int
count
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
;
boolean
hasList
=
response
.
jsonPath
().
getInt
(
"data.list.size()"
)
>
0
;
Assert
.
assert
Equals
(
count
,
3
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"访客-获取个人专栏列表有误"
,
response
.
body
().
asString
()));
Assert
.
assert
True
(
hasList
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"访客-获取个人专栏列表有误"
,
response
.
body
().
asString
()));
String
answer
=
response
.
jsonPath
().
getString
(
"data.list[0].answer"
);
String
answer
=
response
.
jsonPath
().
getString
(
"data.list[0].answer"
);
Assert
.
assertNotNull
(
answer
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"访客-获取问答内容有误"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
answer
,
network
.
message
(
params
,
ARTICLE_ENHANCEDCOLUMN_GETFAQS
,
"访客-获取问答内容有误"
,
response
.
body
().
asString
()));
}
}
...
...
src/test/java/com/kjj/qa/cases/Pay.java
View file @
547145a8
...
@@ -116,7 +116,37 @@ public class Pay {
...
@@ -116,7 +116,37 @@ public class Pay {
Assert
.
assertEquals
(
userVersion
,
changeVersion
,
network
.
message
(
params
,
VERSION_INFO
,
"会员类型版本判断:判断错误,此版本为尊享版"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
userVersion
,
changeVersion
,
network
.
message
(
params
,
VERSION_INFO
,
"会员类型版本判断:判断错误,此版本为尊享版"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"默认付费_微信支付后回调"
,
priority
=
5
)
@Test
(
description
=
"优惠券付费"
,
priority
=
5
)
public
void
优惠券付费
()
throws
IOException
{
String
promotionCode
=
BaseUtils
.
getPromotionCode
();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"code"
,
promotionCode
);
Response
response
=
network
.
getResponse
(
params
,
PAY_COMBOLIST
);
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
payParams
.
put
(
"userVersion"
,
2
);
// 1 通用版 2 保险版
payParams
.
put
(
"comboId"
,
"Kj21MTU"
);
payParams
.
put
(
"oaId"
,
"1"
);
payParams
.
put
(
"paySource"
,
"101004"
);
payParams
.
put
(
"sellerFrom"
,
""
);
payParams
.
put
(
"promotionCode"
,
promotionCode
);
response
=
network
.
postResponse
(
payParams
,
PAY_ORDERCREATE
);
String
tradeNo
=
response
.
jsonPath
().
getString
(
"data.tradeNo"
);
response
.
body
().
prettyPrint
();
// mock微信回调成功
Map
<
String
,
Object
>
callbackParams
=
new
HashMap
<
String
,
Object
>();
callbackParams
.
put
(
"tradeNo"
,
tradeNo
);
callbackParams
.
put
(
"payResult"
,
true
);
callbackParams
.
put
(
"payTradeNo"
,
"test"
);
response
=
network
.
getResponse
(
callbackParams
,
PAY_CALLOUT
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data"
);
response
.
body
().
prettyPrint
();
Assert
.
assertTrue
(
result
,
network
.
message
(
callbackParams
,
PAY_CALLOUT
,
"mock微信支付回调成功,但我们订单处理失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"默认付费_微信支付后回调"
,
priority
=
6
)
public
void
默认付费
_
微信支付后回调
()
throws
IOException
{
public
void
默认付费
_
微信支付后回调
()
throws
IOException
{
//创建支付
//创建支付
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
payParams
=
new
HashMap
<
String
,
Object
>();
...
@@ -146,6 +176,21 @@ public class Pay {
...
@@ -146,6 +176,21 @@ public class Pay {
response
=
network
.
getResponse
(
callbackParams
,
PAY_CALLOUT
);
response
=
network
.
getResponse
(
callbackParams
,
PAY_CALLOUT
);
result
=
response
.
jsonPath
().
getBoolean
(
"data"
);
result
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
result
,
network
.
message
(
callbackParams
,
PAY_CALLOUT
,
"mock微信支付回调成功,但我们订单处理失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
callbackParams
,
PAY_CALLOUT
,
"mock微信支付回调成功,但我们订单处理失败"
,
response
.
body
().
asString
()));
// 检查会员开通结果
response
=
network
.
getResponse
(
USER_INFO
);
boolean
isVip
=
response
.
jsonPath
().
getBoolean
(
"data.vipValid"
);
Assert
.
assertTrue
(
isVip
,
network
.
message
(
USER_INFO
,
"微信支付成功,但是接口返回还是非会员状态"
,
response
.
body
().
asString
()));
// 检查会员版本类型
response
=
network
.
getResponse
(
VERSION_INFO
);
int
userVersion
=
response
.
jsonPath
().
getInt
(
"data.find {it.openType == 1}.userVersion"
);
// 找出开启状态的版本类型 1为通用版 2为保险版
Assert
.
assertEquals
(
userVersion
,
2
,
network
.
message
(
VERSION_INFO
,
"会员类型版本判断:判断错误,此版本为通用版"
,
response
.
body
().
asString
()));
// 重复提交
response
=
network
.
postResponse
(
payParams
,
PAY_ORDERCREATE
);
tradeNo
=
response
.
jsonPath
().
getString
(
"data.tradeNo"
);
System
.
out
.
println
(
tradeNo
);
}
}
...
...
src/test/java/com/kjj/qa/config/BasicConfig.java
View file @
547145a8
...
@@ -77,7 +77,7 @@ public class BasicConfig {
...
@@ -77,7 +77,7 @@ public class BasicConfig {
public
static
final
String
PAY_GETPROMOCODE
=
HOST
+
"/kjy/order/getPromoCode"
;
public
static
final
String
PAY_GETPROMOCODE
=
HOST
+
"/kjy/order/getPromoCode"
;
public
static
final
String
PAY_COMBOLIST
=
HOST
+
"/kjy/mp/combo/list/v2
?code=
"
;
public
static
final
String
PAY_COMBOLIST
=
HOST
+
"/kjy/mp/combo/list/v2"
;
public
static
final
String
PAY_ORDERCREATE
=
HOST
+
"/kjy/order/create"
;
public
static
final
String
PAY_ORDERCREATE
=
HOST
+
"/kjy/order/create"
;
...
...
src/test/java/com/kjj/qa/utils/BaseUtils.java
View file @
547145a8
...
@@ -270,7 +270,7 @@ public class BaseUtils {
...
@@ -270,7 +270,7 @@ public class BaseUtils {
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
disableUser
();
}
}
}
}
target/test-classes/com/kjj/qa/cases/Pay.class
View file @
547145a8
No preview for this file type
target/test-classes/com/kjj/qa/config/BasicConfig.class
View file @
547145a8
No preview for this file type
test-output/report.html
View file @
547145a8
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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