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
3791741e
Commit
3791741e
authored
Jul 03, 2020
by
Su-Yi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改tku
parent
af4a6b7a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
448 additions
and
538 deletions
+448
-538
Pay.java
src/test/java/com/kjj/qa/cases/Pay.java
+26
-1
BasicConfig.java
src/test/java/com/kjj/qa/config/BasicConfig.java
+12
-2
NetworkUtil.java
src/test/java/com/kjj/qa/utils/NetworkUtil.java
+16
-7
Pay.class
target/test-classes/com/kjj/qa/cases/Pay.class
+0
-0
NetworkUtil.class
target/test-classes/com/kjj/qa/utils/NetworkUtil.class
+0
-0
report.html
test-output/report.html
+394
-528
No files found.
src/test/java/com/kjj/qa/cases/Pay.java
View file @
3791741e
...
...
@@ -2,6 +2,7 @@ package com.kjj.qa.cases;
import
static
com
.
kjj
.
qa
.
config
.
BasicConfig
.*;
import
com.kjj.qa.utils.NetworkUtil
;
import
io.restassured.http.Cookies
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.*
;
...
...
@@ -227,10 +228,34 @@ public class Pay {
}
@AfterClass
public
static
void
tearDown
(){
public
static
void
tearDown
()
throws
IOException
{
apiCount
+=
9
;
}
//切换vip
private
static
void
switchvip
()
{
// 拿到sellerId
Response
response
=
network
.
getResponse
(
USER_INFO
);
String
sellerId
=
response
.
jsonPath
().
getString
(
"data.sellerId"
);
//1.先进入SSO登录框 登入管理后台
network
.
host
=
SSO_HOST
;
Map
<
String
,
Object
>
loginParams
=
new
HashMap
<
String
,
Object
>();
loginParams
.
put
(
"email"
,
"lihaohong"
);
loginParams
.
put
(
"password"
,
"duiba123456"
);
loginParams
.
put
(
"loginTimeout"
,
1
);
loginParams
.
put
(
"redirect"
,
"https://kjj-mng.duibatest.com.cn"
);
loginParams
.
put
(
"systemId"
,
201
);
response
=
network
.
postResponse
(
loginParams
,
SSO_DOLOGIN
);
Cookies
cookies
=
response
.
getDetailedCookies
();
System
.
out
.
println
(
cookies
);
// 2.登录成功,切到管理后台
// network.host = MANAGER_HOST;
}
}
...
...
src/test/java/com/kjj/qa/config/BasicConfig.java
View file @
3791741e
...
...
@@ -10,7 +10,7 @@ public class BasicConfig {
// 用户微信昵称
public
static
final
String
WECHAT_NAME
=
"小疙瘩人寿"
;
//
// 用户tku
public
static
final
String
AGENT_TKU
=
"T3gM31f18jAW2
wRySqh6tHAzQDB2z1DmVbnGZCgtRFRnuyDa1un8sPGtpzN2yChmKZkaHJv26BHEEfMcWs
"
;
public
static
final
String
AGENT_TKU
=
"T3gM31f18jAW2
M6V9AZyhvzbbFXDBHGsiNS6yVm6DcRXUWGczEYsdCgHpSH9Ut6tb1isdesvNjkKd5nuno
"
;
// *************** 钉钉机器人 ***************
// 线上-告警群
...
...
@@ -20,7 +20,12 @@ public class BasicConfig {
;
// *************** 客集集域名 ***************
public
static
final
String
HOST
=
"https://kjj.m.duibatest.com.cn"
;
// "https://kjj.m.duiba.com.cn";
public
static
final
String
HOST
=
"https://kjj.m.duibatest.com.cn"
;
public
static
final
String
SSO_HOST
=
"https://sso.duibatest.com.cn"
;
public
static
final
String
MANAGER_HOST
=
"https://kjj-mng.duibatest.com.cn"
;
// *************** TKU ***************
public
static
final
String
VISITOR_TKU
=
"T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3kN3PcWwcLdzfxPp2gghfE4x3BFH8JN3f8PUzQ6W"
;
...
...
@@ -209,7 +214,12 @@ public class BasicConfig {
public
static
final
String
BOSS_MEMBER
=
"/kjy/mp/seller/team/member"
;
// 管理后台
public
static
final
String
SSO_DOLOGIN
=
"/doLogin"
;
public
static
final
String
SSO_INDEX
=
"/sso/ssoIndex"
;
public
static
final
String
MANAGER_AUTH
=
"/auth/getAuthList"
;
...
...
src/test/java/com/kjj/qa/utils/NetworkUtil.java
View file @
3791741e
...
...
@@ -3,9 +3,11 @@ import static com.kjj.qa.config.BasicConfig.*;
import
static
io
.
restassured
.
RestAssured
.*;
import
com.alibaba.fastjson.JSONObject
;
import
io.restassured.http.Cookies
;
import
io.restassured.response.Response
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -22,9 +24,13 @@ public class NetworkUtil {
public
void
setAgentHeaders
(
Map
<
String
,
Object
>
agentHeaders
)
{
this
.
agentHeaders
=
agentHeaders
;
}
public
Map
<
String
,
Object
>
fileHeaders
=
new
HashMap
<
String
,
Object
>();
public
Map
<
String
,
Object
>
getFileHeaders
()
{
return
agent
Headers
;
}
public
Map
<
String
,
Object
>
getFileHeaders
()
{
return
file
Headers
;
}
public
void
setFileHeadersHeaders
(
Map
<
String
,
Object
>
fileHeaders
)
{
this
.
fileHeaders
=
fileHeaders
;
}
public
String
host
=
""
;
public
String
getHost
()
{
return
host
;}
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;}
// 钉钉的 headers
public
Map
<
String
,
Object
>
dingTalkHeaders
=
new
HashMap
<
String
,
Object
>();
public
Map
<
String
,
Object
>
getDingTalkHeaders
()
{
return
dingTalkHeaders
;
}
...
...
@@ -34,6 +40,8 @@ public class NetworkUtil {
// 构造函数 初始化tku、content-type
private
NetworkUtil
(){
//配置地址
host
=
HOST
;
//cookies中的tku
agentCookies
.
put
(
"tku"
,
AGENT_TKU
);
//json类型的headers
...
...
@@ -65,7 +73,7 @@ public class NetworkUtil {
return
given
()
.
cookies
(
agentCookies
)
.
headers
(
agentHeaders
)
.
get
(
HOST
+
path
);
.
get
(
host
+
path
);
}
// get 带参请求
...
...
@@ -74,7 +82,7 @@ public class NetworkUtil {
.
cookies
(
agentCookies
)
.
headers
(
agentHeaders
)
.
params
(
params
)
.
get
(
HOST
+
path
);
.
get
(
host
+
path
);
}
// post 不帶参请求
...
...
@@ -82,7 +90,7 @@ public class NetworkUtil {
return
given
()
.
cookies
(
agentCookies
)
.
headers
(
agentHeaders
)
.
post
(
HOST
+
path
);
.
post
(
host
+
path
);
}
// post 带参请求
...
...
@@ -92,7 +100,7 @@ public class NetworkUtil {
.
cookies
(
agentCookies
)
.
headers
(
agentHeaders
)
.
body
(
jsonStr
)
.
post
(
HOST
+
path
);
.
post
(
host
+
path
);
}
// post 文件上传
...
...
@@ -101,7 +109,7 @@ public class NetworkUtil {
.
cookies
(
agentCookies
)
.
headers
(
fileHeaders
)
.
multiPart
(
"file"
,
new
File
(
filePath
))
.
post
(
HOST
+
path
);
.
post
(
host
+
path
);
}
// post 钉钉机器人
...
...
@@ -127,8 +135,9 @@ public class NetworkUtil {
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
}
}
target/test-classes/com/kjj/qa/cases/Pay.class
View file @
3791741e
No preview for this file type
target/test-classes/com/kjj/qa/utils/NetworkUtil.class
View file @
3791741e
No preview for this file type
test-output/report.html
View file @
3791741e
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