Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
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
马博
test-platform
Commits
6a4df1ca
Commit
6a4df1ca
authored
Dec 05, 2018
by
钱雯君
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into qwj_181029
parents
fe55dddf
efb8a4b4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
12 deletions
+74
-12
Postman.java
src/test/java/base/Postman.java
+12
-3
TestListener.java
src/test/java/base/TestListener.java
+32
-1
抽奖异常测试_DuibaTest.java
...est/java/http/cases/NewActivityTest/抽奖异常测试_DuibaTest.java
+4
-0
NewActivityService.java
src/test/java/http/service/Activity/NewActivityService.java
+18
-0
duiba.properties
src/test/profiles/aliyun/duiba.properties
+8
-8
No files found.
src/test/java/base/Postman.java
View file @
6a4df1ca
...
...
@@ -21,9 +21,11 @@ import static io.restassured.RestAssured.given;
* Created by hanzhanli on 2017/11/9.
*/
public
class
Postman
{
static
String
dingdingUrl
=
"https://shark.dui88.com/test/integration"
;
static
String
testPlatformUrl
=
"http://101.37.27.82:8080/insert"
;
static
String
miriaUrl
=
"http://miria-aliyun.duibatest.com.cn/autoTest/finish"
;
final
static
String
dingdingUrl
=
"https://shark.dui88.com/test/integration"
;
final
static
String
testPlatformUrl
=
"http://101.37.27.82:8080/insert"
;
final
static
String
miriaUrl
=
"http://miria-aliyun.duibatest.com.cn/autoTest/finish"
;
final
static
String
miriaUrlTesting
=
"http://miria-aliyun.duibatest.com.cn/autoTest/testing"
;
//dingdingUrl="http://www.json.cn/";
private
static
Logger
logger
=
LogManager
.
getLogger
(
Postman
.
class
);
public
static
void
send2Dingding
(
Map
result
){
...
...
@@ -58,6 +60,13 @@ public class Postman {
System
.
out
.
println
(
"miriaUrl:"
+
miriaUrl
);
System
.
out
.
println
(
"miria响应结果:"
+
response
.
asString
());
}
public
static
void
sendTesting
(
Map
result
){
Response
response
=
given
().
params
(
result
).
get
(
miriaUrlTesting
);
System
.
out
.
println
(
"jobName:"
+
result
.
get
(
"jobName"
));
System
.
out
.
println
(
"miriaUrl:"
+
miriaUrlTesting
);
System
.
out
.
println
(
"miria响应结果:"
+
response
.
asString
());
}
public
static
Boolean
getName
(){
Calendar
c
=
Calendar
.
getInstance
();
Date
date
=
new
Date
();
...
...
src/test/java/base/TestListener.java
View file @
6a4df1ca
package
base
;
import
java.io.UnsupportedEncodingException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.env.Environment
;
import
org.testng.*
;
/**
...
...
@@ -12,6 +18,12 @@ import org.testng.*;
public
class
TestListener
implements
ITestListener
{
public
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
run
=
System
.
getProperty
(
"run"
);
ApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
Config
.
class
);
Environment
env
=
context
.
getBean
(
Environment
.
class
);
public
TestListener
()
throws
UnsupportedEncodingException
{
}
public
void
onFinish
(
ITestContext
context
)
{
Iterator
<
ITestResult
>
listOfFailedTests
=
context
.
getFailedTests
().
getAllResults
().
iterator
();
while
(
listOfFailedTests
.
hasNext
())
{
...
...
@@ -65,16 +77,26 @@ public class TestListener implements ITestListener {
// TODO Auto-generated method stub
logger
.
info
(
"onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
);
//服务检查
boolean
ServiceDoctor
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
"ServiceDoctor"
));
if
(
ServiceDoctor
){
try
{
serviceDoctor
();
}
catch
(
SkipException
e
){
SFExpress
.
skip
=
context
.
getAllTestMethods
().
length
;
// throw e;
}
}
//运行开始,触发互斥功能,用于定时任务
Map
<
String
,
String
>
mapJob
=
new
HashMap
<>();
try
{
mapJob
.
put
(
"jobName"
,
getJob
());
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
Postman
.
sendTesting
(
mapJob
);
}
public
void
serviceDoctor
(){
logger
.
info
(
"duiba-server开始检测"
);
...
...
@@ -107,4 +129,13 @@ public class TestListener implements ITestListener {
res
=
simpleDateFormat
.
format
(
date
);
return
res
;
}
public
String
getJob
()
throws
UnsupportedEncodingException
{
return
getByRun
(
run
,
"job"
);
}
public
String
getByRun
(
String
run
,
String
type
)
throws
UnsupportedEncodingException
{
run
=
run
.
substring
(
run
.
indexOf
(
"_"
)+
1
,
run
.
indexOf
(
"."
));
run
=
this
.
env
.
getProperty
(
run
+
"."
+
type
);
return
new
String
(
run
.
getBytes
(
"ISO-8859-1"
),
"UTF-8"
);
//ISO-8859-1
}
}
\ No newline at end of file
src/test/java/http/cases/NewActivityTest/抽奖异常测试_DuibaTest.java
View file @
6a4df1ca
...
...
@@ -184,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
Assert
.
assertTrue
(
response
.
jsonPath
().
getString
(
"lottery.link"
).
contains
(
"/activity/takePrizeNew?recordId="
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"11628"
,
"校验id失败"
);
logger
.
info
(
"未登录状态下有免费次数抽奖校验:title,link,id成功"
);
response
=
newActivityService
.
login
(
map
,
"2239.3.3.0"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"登录跳转接口访问失败!"
);
}
}
...
...
src/test/java/http/service/Activity/NewActivityService.java
View file @
6a4df1ca
...
...
@@ -100,6 +100,24 @@ public class NewActivityService {
return
response
;
}
public
Response
login
(
Map
cookies
,
String
dpm
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"dpm"
,
dpm
);
logger
.
info
(
"请求/hdtool/login接口"
);
logger
.
info
(
"url:"
+
url
+
"/hdtool/login"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
post
(
url
+
"/hdtool/login"
);
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
);
logger
.
info
(
"/hdtool/login接口成功,返回信息:"
+
response
.
asString
());
}
catch
(
Exception
e
){
throw
new
Exception
(
"/hdtool/login接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/hdtool/login接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
public
Response
doJoin2
(
String
activityId
,
String
token
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"activityId"
,
activityId
);
...
...
src/test/profiles/aliyun/duiba.properties
View file @
6a4df1ca
...
...
@@ -32,46 +32,46 @@ db.maxtotal = 6
pluginTest.project
=
插件
pluginTest.names
=
zhaoran,qianwenjun
pluginTest.group
=
插件-接口自动化
pluginTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_
Report/suite1_test1_results.html
pluginTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_20
Report/suite1_test1_results.html
pluginTest.job
=
duibaPlugin_interface
signTest.project
=
签到
signTest.names
=
zhousongbo
signTest.group
=
签到-接口自动化
signTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_
Report/suite1_test1_results.html
signTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_20
Report/suite1_test1_results.html
signTest.job
=
duibaSign_interface
FloorTest.project
=
楼层
FloorTest.names
=
zhaoran,qianwenjun
FloorTest.group
=
楼层-接口自动化
FloorTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_
Report/suite1_test1_results.html
FloorTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_20
Report/suite1_test1_results.html
FloorTest.job
=
duibaFloor_interface
DuibaTest.project
=
活动工具
DuibaTest.names
=
zhaoran,qianwenjun
DuibaTest.group
=
活动工具-接口自动化
DuibaTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_
Report/suite1_test1_results.html
DuibaTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_20
Report/suite1_test1_results.html
DuibaTest.job
=
duiba_interface
AccessTest.project
=
综合业务(单品抽奖/秒杀/游戏)
AccessTest.names
=
zhaoran,qianwenjun
AccessTest.group
=
综合业务-接口自动化
AccessTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_
Report/suite1_test1_results.html
AccessTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20
Report/suite1_test1_results.html
AccessTest.job
=
duibaAccess_interface
JenkinsTest.project
=
综合业务(单品抽奖/秒杀/游戏)
JenkinsTest.names
=
zhaoran,qianwenjun
JenkinsTest.group
=
综合业务-接口自动化
JenkinsTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_
Report/suite1_test1_results.html
JenkinsTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20
Report/suite1_test1_results.html
ExchangeTest.project
=
普兑业务
ExchangeTest.names
=
panyuli
ExchangeTest.group
=
普兑业务-接口自动化
ExchangeTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_
Report/suite1_test1_results.html
ExchangeTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_20
Report/suite1_test1_results.html
ExchangeTest.job
=
duibaExchange_interface
SeckillTest.project
=
秒杀业务
SeckillTest.names
=
qianwenjun
SeckillTest.group
=
秒杀业务-接口自动化
SeckillTest.resultUrl
=
http://tst
.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_
Report/suite1_test1_results.html
SeckillTest.resultUrl
=
http://tst
-idc.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_20
Report/suite1_test1_results.html
SeckillTest.job
=
Seckill_interface
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