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
f1b19809
Commit
f1b19809
authored
Apr 26, 2020
by
Su-Yi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新tku
parent
640fea81
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
262 additions
and
268 deletions
+262
-268
Home.java
src/test/java/com/kjj/qa/cases/Home.java
+0
-5
Pay.java
src/test/java/com/kjj/qa/cases/Pay.java
+1
-5
ExtentTestNGIReporterListener.java
...java/com/kjj/qa/config/ExtentTestNGIReporterListener.java
+4
-2
NetworkOperation.java
src/test/java/com/kjj/qa/services/NetworkOperation.java
+3
-26
DingTalkUtil.java
src/test/java/com/kjj/qa/utils/DingTalkUtil.java
+4
-4
report.html
test-output/report.html
+250
-226
No files found.
src/test/java/com/kjj/qa/cases/Home.java
View file @
f1b19809
...
@@ -24,11 +24,6 @@ public class Home {
...
@@ -24,11 +24,6 @@ public class Home {
network
.
agentCookies
.
put
(
"acw_tc"
,
"76b20ff215756198852864366e248d9e6bfb989ae8f073e81a05f23e6ef703"
);
network
.
agentCookies
.
put
(
"acw_tc"
,
"76b20ff215756198852864366e248d9e6bfb989ae8f073e81a05f23e6ef703"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
// 访客 cookies
network
.
vistorCookies
.
put
(
"tku"
,
"fcedkR2oRAVAoStCWGx7Y45krm9opxbQvd76nvAKqXQwmDyHyQyEiXyjEBjzRrk9hdVhppStVd5iz6GcBx8ghW"
);
network
.
vistorCookies
.
put
(
"acw_tc"
,
"76b20fea15774130899093358e57cc742bc2ebcc713ece289b4e9c26ed8785"
);
network
.
vistorHeaders
.
put
(
"Content-Type"
,
"application/json"
);
}
}
@Test
(
description
=
"JSSDK"
,
priority
=
1
)
//priorty 方法执行优先级
@Test
(
description
=
"JSSDK"
,
priority
=
1
)
//priorty 方法执行优先级
...
...
src/test/java/com/kjj/qa/cases/Pay.java
View file @
f1b19809
...
@@ -21,8 +21,7 @@ public class Pay {
...
@@ -21,8 +21,7 @@ public class Pay {
@BeforeClass
@BeforeClass
public
void
setUp
()
{
public
void
setUp
()
{
// 代理人 cookies
// 代理人 cookies
network
.
agentCookies
.
put
(
"tku"
,
"T3gM31f18jAXArVsnK4WomzkQTYdtMrQ7mddH1s4VLCViss4CrYGFX5CU5er74RDeCBz1JtxDMKpsX4m9H"
);
network
.
agentCookies
.
put
(
"tku"
,
"T3gM31f18jAXAwJJQPrjuY6xCJQThg3dXxpzkv8X5w3oZZn5yXB41EQad3CuY5A8USk26gxjQvUn7hWekU"
);
// network.agentCookies.put("acw_tc","76b20fe315823353519212714e7eb372f83a4dd118d1a883b8a62aa4907755");
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
network
.
agentHeaders
.
put
(
"Content-Type"
,
"application/json"
);
}
}
...
@@ -56,7 +55,6 @@ public class Pay {
...
@@ -56,7 +55,6 @@ public class Pay {
String
actualPayMoney
=
actualPayMoneyResponse
.
jsonPath
().
getString
(
"data[0].actualPayMoney"
);
String
actualPayMoney
=
actualPayMoneyResponse
.
jsonPath
().
getString
(
"data[0].actualPayMoney"
);
Assert
.
assertEquals
(
actualPayMoney
,
"586"
,
"获取付费价格:价格不是586"
);
Assert
.
assertEquals
(
actualPayMoney
,
"586"
,
"获取付费价格:价格不是586"
);
System
.
out
.
println
(
1
);
}
}
@Test
(
description
=
"默认付费_待支付"
,
priority
=
2
)
@Test
(
description
=
"默认付费_待支付"
,
priority
=
2
)
...
@@ -74,7 +72,6 @@ public class Pay {
...
@@ -74,7 +72,6 @@ public class Pay {
String
appId
=
orderAppId
.
jsonPath
().
getString
(
"data.appId"
);
String
appId
=
orderAppId
.
jsonPath
().
getString
(
"data.appId"
);
Assert
.
assertEquals
(
appId
,
"wxcb8c36279dd7dff2"
,
"拉起支付:拉起微信支付失败"
);
//判断返回的微信调起参数中appId是否正确
Assert
.
assertEquals
(
appId
,
"wxcb8c36279dd7dff2"
,
"拉起支付:拉起微信支付失败"
);
//判断返回的微信调起参数中appId是否正确
System
.
out
.
println
(
2
);
}
}
@Test
(
description
=
"默认付费_取消支付"
,
priority
=
3
)
@Test
(
description
=
"默认付费_取消支付"
,
priority
=
3
)
...
@@ -97,7 +94,6 @@ public class Pay {
...
@@ -97,7 +94,6 @@ public class Pay {
Response
resultResponse
=
network
.
getResponse
(
cancelParams
,
"/kjy/order/cancel"
);
Response
resultResponse
=
network
.
getResponse
(
cancelParams
,
"/kjy/order/cancel"
);
String
result
=
resultResponse
.
jsonPath
().
getString
(
"desc"
);
String
result
=
resultResponse
.
jsonPath
().
getString
(
"desc"
);
Assert
.
assertEquals
(
result
,
"OK"
,
"取消支付:取消支付失败"
);
//判断返回的微信调起参数中appId是否正确
Assert
.
assertEquals
(
result
,
"OK"
,
"取消支付:取消支付失败"
);
//判断返回的微信调起参数中appId是否正确
System
.
out
.
println
(
3
);
}
}
// @Test (description = "默认付费_成功支付",priority = 4)
// @Test (description = "默认付费_成功支付",priority = 4)
...
...
src/test/java/com/kjj/qa/config/ExtentTestNGIReporterListener.java
View file @
f1b19809
...
@@ -30,11 +30,12 @@ public class ExtentTestNGIReporterListener implements IReporter {
...
@@ -30,11 +30,12 @@ public class ExtentTestNGIReporterListener implements IReporter {
boolean
createSuiteNode
=
false
;
boolean
createSuiteNode
=
false
;
//判断执行用例的队列是否有多个
//判断执行用例的队列是否有多个
if
(
suites
.
size
()
>
0
)
{
if
(
suites
.
size
()
==
0
)
{
createSuiteNode
=
true
;
createSuiteNode
=
true
;
}
}
for
(
ISuite
suite
:
suites
)
{
for
(
ISuite
suite
:
suites
)
{
Map
<
String
,
ISuiteResult
>
result
=
suite
.
getResults
();
Map
<
String
,
ISuiteResult
>
result
=
suite
.
getResults
();
// 如果suite里面没有任何用例,直接跳过,不在报告里生成
// 如果suite里面没有任何用例,直接跳过,不在报告里生成
if
(
result
.
size
()
==
0
)
{
if
(
result
.
size
()
==
0
)
{
continue
;
continue
;
...
@@ -49,6 +50,7 @@ public class ExtentTestNGIReporterListener implements IReporter {
...
@@ -49,6 +50,7 @@ public class ExtentTestNGIReporterListener implements IReporter {
suiteTest
=
extent
.
createTest
(
suite
.
getName
()).
assignCategory
(
suite
.
getName
());
suiteTest
=
extent
.
createTest
(
suite
.
getName
()).
assignCategory
(
suite
.
getName
());
}
}
boolean
createSuiteResultNode
=
false
;
boolean
createSuiteResultNode
=
false
;
if
(
result
.
size
()
>
1
)
{
if
(
result
.
size
()
>
1
)
{
createSuiteResultNode
=
true
;
createSuiteResultNode
=
true
;
}
}
...
@@ -99,7 +101,7 @@ public class ExtentTestNGIReporterListener implements IReporter {
...
@@ -99,7 +101,7 @@ public class ExtentTestNGIReporterListener implements IReporter {
}
}
}
}
String
context
=
String
.
format
(
"通过
: %s ; 失败: %s ; 跳过: %s ;
"
,
suitePassSize
,
suiteFailSize
,
suiteSkipSize
);
String
context
=
String
.
format
(
"通过
的用例数: %s\n失败的用例数: %s\n跳过的用例数: %s\n
"
,
suitePassSize
,
suiteFailSize
,
suiteSkipSize
);
try
{
try
{
DingTalkUtil
.
sendVal
(
context
);
DingTalkUtil
.
sendVal
(
context
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/test/java/com/kjj/qa/services/NetworkOperation.java
View file @
f1b19809
...
@@ -26,27 +26,17 @@ public class NetworkOperation {
...
@@ -26,27 +26,17 @@ public class NetworkOperation {
public
Map
<
String
,
Object
>
getAgentHeaders
()
{
return
agentHeaders
;
}
public
Map
<
String
,
Object
>
getAgentHeaders
()
{
return
agentHeaders
;
}
public
void
setAgentHeaders
(
Map
<
String
,
Object
>
agentHeaders
)
{
this
.
agentHeaders
=
agentHeaders
;
}
public
void
setAgentHeaders
(
Map
<
String
,
Object
>
agentHeaders
)
{
this
.
agentHeaders
=
agentHeaders
;
}
// 访客的 cookies和headers
public
Map
<
String
,
Object
>
vistorCookies
=
new
HashMap
<
String
,
Object
>();
public
Map
<
String
,
Object
>
getVistorCookies
()
{
return
vistorCookies
;
}
public
void
setVistorCookies
(
Map
<
String
,
Object
>
vistorCookies
)
{
this
.
vistorCookies
=
vistorCookies
;
}
public
Map
<
String
,
Object
>
vistorHeaders
=
new
HashMap
<
String
,
Object
>();
public
Map
<
String
,
Object
>
getVistorHeaders
()
{
return
vistorHeaders
;
}
public
void
setVistorHeaders
(
Map
<
String
,
Object
>
vistorHeaders
)
{
this
.
vistorHeaders
=
vistorHeaders
;
}
// 钉钉的 headers
// 钉钉的 headers
public
Map
<
String
,
Object
>
dingTalkHeaders
=
new
HashMap
<
String
,
Object
>();
public
Map
<
String
,
Object
>
dingTalkHeaders
=
new
HashMap
<
String
,
Object
>();
public
Map
<
String
,
Object
>
getDingTalkHeaders
()
{
return
dingTalkHeaders
;
}
public
Map
<
String
,
Object
>
getDingTalkHeaders
()
{
return
dingTalkHeaders
;
}
public
void
setDingTalkHeaders
(
Map
<
String
,
Object
>
dingTalkHeaders
)
{
this
.
dingTalkHeaders
=
dingTalkHeaders
;
}
public
void
setDingTalkHeaders
(
Map
<
String
,
Object
>
dingTalkHeaders
)
{
this
.
dingTalkHeaders
=
dingTalkHeaders
;
}
//客集集域名
//客集集域名
// private static String host = "https://kjj.m.duiba.com.cn";
// private static String host = "https://kjj.m.duiba.com.cn";
//线上
private
static
String
host
=
"https://kjj.m.duibatest.com.cn"
;
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 不带参请求
// get 不带参请求
public
Response
getResponse
(
String
path
)
{
public
Response
getResponse
(
String
path
)
{
...
@@ -93,16 +83,6 @@ public class NetworkOperation {
...
@@ -93,16 +83,6 @@ public class NetworkOperation {
.
post
(
dingtalkPath
);
.
post
(
dingtalkPath
);
}
}
//用户行为
public
Response
visitorBehavior
(
Map
<
String
,
Object
>
params
,
String
path
){
return
given
()
.
cookies
(
vistorCookies
)
.
headers
(
vistorHeaders
)
.
params
(
params
)
.
get
(
host
+
path
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// NetworkOperation network = new NetworkOperation();
// NetworkOperation network = new NetworkOperation();
//
//
...
@@ -113,9 +93,6 @@ public class NetworkOperation {
...
@@ -113,9 +93,6 @@ public class NetworkOperation {
// text.put("content","报告 :");
// text.put("content","报告 :");
// json.put("text",text);
// json.put("text",text);
// Response res = network.dingTalkRobot(json);
// Response res = network.dingTalkRobot(json);
}
}
}
}
src/test/java/com/kjj/qa/utils/DingTalkUtil.java
View file @
f1b19809
...
@@ -6,13 +6,13 @@ import java.util.HashMap;
...
@@ -6,13 +6,13 @@ import java.util.HashMap;
public
class
DingTalkUtil
{
public
class
DingTalkUtil
{
//通过钉钉机器人发送消息到钉钉群中
//通过钉钉机器人发送消息到钉钉群中
public
static
void
sendVal
(
String
context
)
throws
Exception
{
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
+
"'}}"
;
String
entityString
=
"{'msgtype': 'text', 'text': {'content': '
【测试结果】
\n"
+
context
+
"'}}"
;
System
.
out
.
println
(
entityString
);
System
.
out
.
println
(
entityString
);
//
NetworkOperation network = new NetworkOperation();
NetworkOperation
network
=
new
NetworkOperation
();
//
network.dingTalkRobot(entityString); //发起请求
network
.
dingTalkRobot
(
entityString
);
//发起请求
}
}
...
...
test-output/report.html
View file @
f1b19809
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