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
fdeb0172
Commit
fdeb0172
authored
Oct 15, 2018
by
马博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f78699e6
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1480 additions
and
0 deletions
+1480
-0
Maven__commons_lang_commons_lang_2_6.xml
.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
+13
-0
BeTested.java
src/test/java/base/BeTested.java
+137
-0
ClassResult.java
src/test/java/base/ClassResult.java
+27
-0
Config.java
src/test/java/base/Config.java
+22
-0
DingdingResult.java
src/test/java/base/DingdingResult.java
+179
-0
DuibaBase.java
src/test/java/base/DuibaBase.java
+27
-0
DuibaLog.java
src/test/java/base/DuibaLog.java
+44
-0
DuibaReporter.java
src/test/java/base/DuibaReporter.java
+255
-0
DuibaTestBase.java
src/test/java/base/DuibaTestBase.java
+22
-0
MysqlConnPool.java
src/test/java/base/MysqlConnPool.java
+176
-0
MysqlUtils.java
src/test/java/base/MysqlUtils.java
+204
-0
Postman.java
src/test/java/base/Postman.java
+61
-0
RetryListener.java
src/test/java/base/RetryListener.java
+22
-0
RetryToRunCase.java
src/test/java/base/RetryToRunCase.java
+20
-0
SFExpress.java
src/test/java/base/SFExpress.java
+38
-0
SuiteResult.java
src/test/java/base/SuiteResult.java
+96
-0
TestListener.java
src/test/java/base/TestListener.java
+56
-0
TestReport.java
src/test/java/base/TestReport.java
+81
-0
No files found.
.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
0 → 100644
View file @
fdeb0172
<component
name=
"libraryTable"
>
<library
name=
"Maven: commons-lang:commons-lang:2.6"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
src/test/java/base/BeTested.java
0 → 100644
View file @
fdeb0172
package
base
;
import
io.restassured.response.Response
;
import
org.jsoup.Jsoup
;
import
org.jsoup.nodes.Document
;
import
org.jsoup.select.Elements
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by hanzhanli on 2017/11/11.
*/
public
class
BeTested
{
//从jenkins爬取变更log,取最新一个,即第一个
private
static
AbstractMap
.
SimpleEntry
<
String
,
String
>
getChanges
(
String
url
)
{
System
.
out
.
println
(
"链接:"
+
url
);
Response
response
=
given
().
header
(
"Accept-Language"
,
"zh-CN,zh;q=0.8"
).
get
(
url
);
String
s
=
response
.
asString
();
Document
document
=
Jsoup
.
parse
(
s
);
Elements
elements
=
null
;
String
changeTime
=
null
;
try
{
elements
=
document
.
getElementsByTag
(
"ol"
);
changeTime
=
document
.
getElementsByTag
(
"h2"
).
get
(
0
).
getElementsByTag
(
"a"
).
get
(
0
).
text
();
}
catch
(
Exception
e
){
return
new
AbstractMap
.
SimpleEntry
<
String
,
String
>(
"2018-1-24 20:17:09"
,
"未修改"
);
}
String
regex
=
"(?<=\\()(.+?)(?=\\))"
;
Pattern
pattern
=
Pattern
.
compile
(
regex
);
Matcher
matcher
=
pattern
.
matcher
(
changeTime
);
String
s3
=
null
;
while
(
matcher
.
find
())
{
s3
=
matcher
.
group
(
0
);
}
/*String s1=changeTime.split("\\(")[1];
String s2=s1.split("\\)")[0];*/
//String s3="2017-11-13 10:14:11";
return
new
AbstractMap
.
SimpleEntry
<
String
,
String
>(
s3
,
elements
.
get
(
0
).
text
().
replace
(
"detail"
,
""
).
replace
(
" "
,
""
));
}
//将各job的最新变更放到一个排序map,最新的在最上
public
static
Map
<
String
,
String
>
getLatestChanges
(
String
[]
jobs
){
System
.
out
.
println
(
"获取以下job的更改信息:"
+
jobs
);
Map
<
String
,
String
>
map
=
new
TreeMap
<
String
,
String
>(
new
Comparator
<
String
>()
{
public
int
compare
(
String
obj1
,
String
obj2
)
{
return
compareTime
(
obj2
,
obj1
);
}
});
for
(
String
job:
jobs
){
job
=
job
.
trim
();
String
url
=
"http://tst.deploy.dui88.com/view/duiba/job/"
+
job
+
"/changes"
;
AbstractMap
.
SimpleEntry
entry
=
getChanges
(
url
);
map
.
put
((
String
)
entry
.
getKey
(),
job
+
":"
+(
String
)
entry
.
getValue
());
}
return
map
;
}
public
static
void
main
(
String
[]
args
)
{
String
activityGroup
=
"tuia-activity-center,tuia-ssp-center,tuia-ssp-web,tuia-ssp-manager,tuia-open-web"
;
String
adGroup
=
"tuia-engine,tuia-advert-center,tuia-advert-manager,tuia-advert-web,tuia-engine-billing"
;
String
duibaGroup
=
"credits-home-web,developer-center,goods-access-web,goods-center,activity-access-web,activity-center,trade-center,trade-access-web,duiba-manager,duiba-manager-web"
;
Map
<
String
,
String
>
map
=
getLatestChanges
(
duibaGroup
.
split
(
","
));
System
.
out
.
println
(
map
);
// System.out.println(getChangesWithin(90,map));
//System.out.println(map);
/*Set<String> keySet=map.keySet();
String[] group;
group=new String[]{map.get(keySet.toArray()[0])};
System.out.println(group[0]);*/
}
public
static
Map
<
String
,
String
>
getChangesWithin
(
int
min
,
Map
<
String
,
String
>
changes
){
if
(
changes
==
null
){
return
null
;
}
else
{
System
.
out
.
println
(
"最近更改筛选:"
+
changes
);
Map
<
String
,
String
>
map
=
new
TreeMap
<
String
,
String
>(
new
Comparator
<
String
>()
{
public
int
compare
(
String
obj1
,
String
obj2
)
{
return
compareTime
(
obj2
,
obj1
);
}
});
Set
<
String
>
keySet
=
changes
.
keySet
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
timeLimit
=
new
Date
(
System
.
currentTimeMillis
()
-
min
*
60
*
1000
);
String
limit
=
sdf
.
format
(
timeLimit
);
System
.
out
.
println
(
limit
);
for
(
String
key
:
keySet
)
{
if
(
compareTime
(
key
,
limit
)
>=
0
)
{
map
.
put
(
key
,
changes
.
get
(
key
));
}
}
return
map
;
}
}
public
static
int
compareTime
(
String
time1
,
String
time2
)
{
//如果想比较日期则写成"yyyy-MM-dd"就可以了
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//将字符串形式的时间转化为Date类型的时间
Date
a
=
null
;
Date
b
=
null
;
try
{
a
=
sdf
.
parse
(
time1
);
b
=
sdf
.
parse
(
time2
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
//Date类的一个方法,如果a早于b返回true,否则返回false
//return a.getTime()-b.getTime();
if
(
a
.
before
(
b
))
return
-
1
;
else
if
(
a
.
equals
(
b
)){
return
0
;
}
else
return
1
;
}
}
src/test/java/base/ClassResult.java
0 → 100644
View file @
fdeb0172
package
base
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by hanzhanli on 2017/10/31.
*/
public
class
ClassResult
{
String
className
;
int
count
;
List
<
Map
<
String
,
String
>>
resultList
=
new
ArrayList
<>();
public
ClassResult
(
String
className
){
this
.
className
=
className
;
}
public
void
addResult
(
String
testName
,
String
duration
,
String
testOut
){
this
.
count
++;
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"testName"
,
testName
);
resultMap
.
put
(
"duration"
,
duration
);
resultMap
.
put
(
"testOut"
,
testOut
);
this
.
resultList
.
add
(
resultMap
);
}
}
src/test/java/base/Config.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.context.support.PropertySourcesPlaceholderConfigurer
;
/**
* Created by mabo on 2018/9/20
*/
@Configuration
@ComponentScan
(
basePackages
=
{
"ui"
,
"http"
,
"base"
})
@PropertySource
(
value
=
{
"duiba.properties"
})
public
class
Config
{
@Bean
public
PropertySourcesPlaceholderConfigurer
propertyConfigInDev
()
{
PropertySourcesPlaceholderConfigurer
pspc
=
new
PropertySourcesPlaceholderConfigurer
();
pspc
.
setFileEncoding
(
"UTF-8"
);
return
pspc
;
}
}
src/test/java/base/DingdingResult.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.env.Environment
;
import
java.io.UnsupportedEncodingException
;
import
java.util.*
;
/**
* Created by hanzhanli on 2017/11/9.
*/
public
class
DingdingResult
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
DingdingResult
.
class
);
Object
[]
group
={
"test"
};
String
project
=
"tuia-media"
;
String
changes
=
""
;
int
total
;
int
passCount
;
int
skipCount
;
int
failCount
;
String
resultUrl
;
List
<
String
>
names
=
new
ArrayList
<>();
private
transient
String
activityGroup
=
"tuia-activity-center,tuia-ssp-manager,tuia-open-web,tuia-activity-web"
;
private
transient
String
duibaGroup
=
"credits-home-web,developer-center,goods-access-web,goods-center,activity-access-web,activity-center,trade-center,trade-access-web,duiba-manager,duiba-manager-web,activity-cms-web,activity-comm-center,consumer-center,goods-access-web,goods-center,hdtool-web,hdtool-center,intersection-service,kvtable-service,plugin-web,plugin-center,prize-center,seckill-web,sign-web,sign-center,stock-service,thirdparty-service,trade-access-web,trade-center"
;
private
transient
String
adGroup
=
"tuia-engine,tuia-advert-center,tuia-advert-manager,tuia-advert-web,tuia-engine-billing"
;
private
transient
String
sspGroup
=
"tuia-ssp-center,tuia-ssp-web,tuia-ssp-manager,tuia-open-web"
;
transient
String
caseSuites
=
System
.
getProperty
(
"test"
);
private
transient
String
run
=
System
.
getProperty
(
"run"
);
transient
ApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
Config
.
class
);
transient
Environment
env
=
context
.
getBean
(
Environment
.
class
);
public
transient
static
String
[]
name
;
String
path
=
null
;
public
DingdingResult
(
int
total
,
int
passCount
,
int
skipCount
,
int
failCount
)
throws
UnsupportedEncodingException
{
logger
.
info
(
"job-name:"
+
System
.
getProperty
(
"JOB_NAME"
));
logger
.
info
(
"属性:"
+
System
.
getProperties
());
Map
<
String
,
String
>
changeMap
=
null
;
group
=
duibaGroup
.
split
(
","
);
changeMap
=
BeTested
.
getLatestChanges
(
duibaGroup
.
split
(
","
));
project
=
"duiba-service"
;
String
getName
=
getByRun
(
run
,
"names"
);
String
[]
getNames
=
getName
.
split
(
","
);
name
=
getNames
;
names
.
addAll
(
Arrays
.
asList
(
getNames
));
Map
<
String
,
String
>
resentChanges
=
BeTested
.
getChangesWithin
(
30
,
changeMap
);
System
.
out
.
println
(
resentChanges
);
if
(
resentChanges
!=
null
&&
resentChanges
.
size
()>
0
){
List
<
String
>
changeList
=
new
ArrayList
<>();
for
(
Object
key:
resentChanges
.
keySet
().
toArray
()){
//changeList.add(key+"-"+resentChanges.get(key));
if
(
changes
!=
null
&&
changes
.
length
()>
0
){
changes
=
changes
+
","
+
key
+
"-"
+
resentChanges
.
get
(
key
);
}
else
changes
=
key
+
"-"
+
resentChanges
.
get
(
key
);
}
//group=changeList.toArray();
//this.changes=changeList.toString();
}
else
{
if
(
changeMap
==
null
){
this
.
changes
=
""
;
}
else
{
Set
<
String
>
keySet
=
changeMap
.
keySet
();
this
.
changes
=
keySet
.
toArray
()[
0
]
+
"-"
+
changeMap
.
get
(
keySet
.
toArray
()[
0
]);
}
}
if
(
changes
.
length
()>
140
){
changes
=
changes
.
substring
(
0
,
141
)+
"……"
;
}
//project="tuia-media";
this
.
total
=
total
;
this
.
passCount
=
passCount
;
this
.
skipCount
=
skipCount
;
this
.
failCount
=
failCount
;
resultUrl
=
getresultUrl
();
}
private
String
getresultUrl
()
throws
UnsupportedEncodingException
{
String
resultUrl
=
null
;
String
host
=
System
.
getProperty
(
"runEnv"
);
String
serviceLine
=
null
;
String
caseSuites
=
System
.
getProperty
(
"test"
);
resultUrl
=
getByRun
(
run
,
"resultUrl"
);
return
resultUrl
;
}
public
Map
<
String
,
Object
>
getResult
()
throws
UnsupportedEncodingException
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Object
[]
mygroup
=
new
Object
[
1
];
mygroup
[
0
]=
getByRun
(
run
,
"group"
);
result
.
put
(
"group"
,
mygroup
);
result
.
put
(
"project"
,
project
);
result
.
put
(
"total"
,
this
.
total
);
result
.
put
(
"passCount"
,
this
.
passCount
);
result
.
put
(
"skipCount"
,
this
.
skipCount
);
result
.
put
(
"failCount"
,
this
.
failCount
);
result
.
put
(
"resultUrl"
,
this
.
resultUrl
);
List
<
String
>
exceptionServices
=
SFExpress
.
getExceptionServices
();
List
<
String
>
exceptionMessage
=
SFExpress
.
getExceptionMessage
();
String
others
=
null
;
if
(
exceptionServices
.
size
()>
0
){
others
=
"以下被测服务未启动:"
+
exceptionServices
.
toString
()+
"<br>跳过用例总数:"
+
this
.
total
;
changes
=
changes
+
"<br>"
+
others
;
logger
.
info
(
others
);
result
.
put
(
"passCount"
,
0
);
result
.
put
(
"skipCount"
,
this
.
total
);
result
.
put
(
"failCount"
,
0
);
}
if
(
exceptionMessage
.
size
()>
0
){
others
=
"以下原因导致测试跳过:"
+
exceptionMessage
.
toString
()+
"<br>跳过用例总数:"
+
this
.
total
;
changes
=
changes
+
"<br>"
+
others
;
logger
.
info
(
others
);
result
.
put
(
"passCount"
,
0
);
result
.
put
(
"skipCount"
,
this
.
total
);
result
.
put
(
"failCount"
,
0
);
}
result
.
put
(
"changes"
,
this
.
changes
+
"<br>"
);
if
(
this
.
failCount
>
0
||
exceptionServices
.
size
()>
0
||
exceptionMessage
.
size
()>
0
){
try
{
String
name
=
this
.
changes
.
split
(
"—"
)[
1
].
split
(
"/"
)[
0
];
names
.
add
(
name
);
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);
}
}
else
{
names
.
clear
();
}
result
.
put
(
"names"
,
names
);
return
result
;
}
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
}
public
static
void
main
(
String
[]
args
)
throws
UnsupportedEncodingException
{
String
s
=
"**/*_signTest.java"
;
s
=
s
.
substring
(
s
.
indexOf
(
"_"
)+
1
,
s
.
indexOf
(
"."
));
System
.
out
.
println
(
s
);
ApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
Config
.
class
);
Environment
env
=
context
.
getBean
(
Environment
.
class
);
String
ss
=
env
.
getProperty
(
"pluginTest.names"
);
System
.
out
.
println
(
ss
=
new
String
(
ss
.
getBytes
(
"ISO-8859-1"
),
"UTF-8"
));
String
run
=
"**/*_signTest.java"
;
String
type
=
"names"
;
run
=
run
.
substring
(
run
.
indexOf
(
"_"
)+
1
,
run
.
indexOf
(
"."
));
run
=
env
.
getProperty
(
run
+
"."
+
type
);
System
.
out
.
println
(
run
=
new
String
(
run
.
getBytes
(
"ISO-8859-1"
),
"UTF-8"
));
String
[]
sp
=
run
.
split
(
","
);
List
<
String
>
list
=
Arrays
.
asList
(
sp
);
List
<
String
>
names
=
new
ArrayList
<>();
names
.
addAll
(
list
);
}
}
\ No newline at end of file
src/test/java/base/DuibaBase.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.annotations.AfterSuite
;
import
org.testng.annotations.BeforeSuite
;
import
javax.annotation.PostConstruct
;
/**
* Created by mabo on 2018/9/20
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
DuibaBase
extends
AbstractTestNGSpringContextTests
{
@Autowired
public
MysqlConnPool
jdbc
;
public
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@PostConstruct
public
void
setUp
()
{
//只初始化一次
jdbc
.
initDataSource
();
}
}
src/test/java/base/DuibaLog.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.testng.Reporter
;
import
sun.reflect.Reflection
;
/**
* Created by mabo on 2018/10/8
*/
public
class
DuibaLog
{
private
Logger
logger
;
private
DuibaLog
(){
/*Class c = Reflection.getCallerClass(2);
//Field logger=c.getField("logger");
Field[] fields= c.getDeclaredFields();
for (Field field:fields){
System.out.println(field);
}*/
Logger
logger
=
LogManager
.
getLogger
(
Reflection
.
getCallerClass
(
3
));
//logger=LogManager.getRootLogger();
//logger=LogManager.getLogger("name");
this
.
logger
=
logger
;
}
private
DuibaLog
(
Logger
logger
){
this
.
logger
=
logger
;
}
public
static
DuibaLog
getLogger
(){
return
new
DuibaLog
();
}
public
void
info
(
String
msg
){
logger
.
info
(
msg
);
Reporter
.
log
(
msg
);
}
}
src/test/java/base/DuibaReporter.java
0 → 100644
View file @
fdeb0172
This diff is collapsed.
Click to expand it.
src/test/java/base/DuibaTestBase.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.annotations.BeforeSuite
;
/**
* Created by mabo on 2018/10/9
*/
public
class
DuibaTestBase
extends
DuibaBase
{
// @Autowired
// public MysqlConnPool jdbc;
//
// @BeforeSuite
// public void setUp() {
// if(jdbc == null){
// return;
// }
//
// jdbc.getDbs();
//
// }
}
src/test/java/base/MysqlConnPool.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.apache.commons.dbcp2.BasicDataSource
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.test.context.ContextConfiguration
;
import
java.sql.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by mabo on 2018/10/9
*/
//@Component
@Service
public
class
MysqlConnPool
{
//数据库用户名
@Value
(
"${db.name}"
)
String
USERNAME
;
//数据库密码
@Value
(
"${db.password}"
)
String
PASSWORD
;
//url
@Value
(
"${db.url}"
)
String
URL
;
//驱动信息
@Value
(
"${db.driver}"
)
String
DRIVER
;
//最大连接池
@Value
(
"${db.maxtotal}"
)
int
maxtotal
;
public
BasicDataSource
bds
;
public
DuibaLog
log
=
DuibaLog
.
getLogger
();
public
void
initDataSource
(){
if
(
bds
!=
null
){
return
;
}
synchronized
(
MysqlConnPool
.
class
){
if
(
bds
!=
null
){
return
;
}
System
.
out
.
println
(
"初始化数据库"
);
BasicDataSource
bds
=
new
BasicDataSource
();
bds
.
setDriverClassName
(
DRIVER
);
bds
.
setUrl
(
URL
);
bds
.
setUsername
(
USERNAME
);
bds
.
setPassword
(
PASSWORD
);
bds
.
setMaxTotal
(
maxtotal
);
this
.
bds
=
bds
;
}
}
/**
* 查询结果只有一行数据
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return map
* @throws SQLException
*/
public
Map
<
String
,
Object
>
findSimpleResult
(
String
sql
,
Object
...
params
)
throws
SQLException
{
Map
<
String
,
Object
>
map
=
null
;
try
(
Connection
conn
=
bds
.
getConnection
()){
map
=
new
HashMap
<
String
,
Object
>();
int
index
=
1
;
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
sql
);
log
.
info
(
conn
.
toString
());
if
(
params
!=
null
&&
!(
params
.
length
==
0
)){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
pstmt
.
setObject
(
index
++,
params
[
i
]);
}
}
ResultSet
resultSet
=
pstmt
.
executeQuery
();
//返回查询结果
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
col_len
=
metaData
.
getColumnCount
();
while
(
resultSet
.
next
()){
for
(
int
i
=
0
;
i
<
col_len
;
i
++
){
String
cols_name
=
metaData
.
getColumnName
(
i
+
1
);
Object
cols_value
=
resultSet
.
getObject
(
cols_name
);
if
(
cols_value
==
null
){
cols_value
=
""
;
}
map
.
put
(
cols_name
,
cols_value
);
}
}
// try {
// Thread.sleep(5000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
map
;
}
/**
* 增加、删除、改
* @param sql sql语句
* @param params 参数,替换 ?
* @return true or false
* @throws SQLException
*/
public
boolean
update
(
String
sql
,
Object
...
params
)
throws
SQLException
{
Connection
conn
=
null
;
boolean
flag
=
false
;
try
{
int
result
=
-
1
;
conn
=
bds
.
getConnection
();
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
sql
);
int
index
=
1
;
if
(
params
!=
null
&&
!(
params
.
length
==
0
)){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
pstmt
.
setObject
(
index
++,
params
[
i
]);
}
}
result
=
pstmt
.
executeUpdate
();
flag
=
result
>
0
?
true
:
false
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
finally
{
if
(
conn
!=
null
)
conn
.
close
();
}
return
flag
;
}
/**
* 返回多条数据
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return list
* @throws SQLException
*/
public
List
<
Map
<
String
,
Object
>>
findModeResult
(
String
sql
,
Object
...
params
)
throws
SQLException
{
Connection
conn
=
null
;
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
try
{
int
index
=
1
;
conn
=
bds
.
getConnection
();
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
sql
);
if
(
params
!=
null
&&
!(
params
.
length
==
0
)){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
pstmt
.
setObject
(
index
++,
params
[
i
]);
}
}
ResultSet
resultSet
=
pstmt
.
executeQuery
();
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
cols_len
=
metaData
.
getColumnCount
();
while
(
resultSet
.
next
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
for
(
int
i
=
0
;
i
<
cols_len
;
i
++){
String
cols_name
=
metaData
.
getColumnName
(
i
+
1
);
Object
cols_value
=
resultSet
.
getObject
(
cols_name
);
if
(
cols_value
==
null
){
cols_value
=
""
;
}
map
.
put
(
cols_name
,
cols_value
);
}
list
.
add
(
map
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
finally
{
if
(
conn
!=
null
)
conn
.
close
();
}
return
list
;
}
}
src/test/java/base/MysqlUtils.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.apache.commons.dbcp2.BasicDataSource
;
import
java.sql.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by mabo on 2018/10/8
*/
public
class
MysqlUtils
{
//数据库用户名
private
String
USERNAME
;
// = "root";
//数据库密码
private
String
PASSWORD
;
//= "yanzi";
//驱动信息
private
String
DRIVER
=
"com.mysql.jdbc.Driver"
;
private
BasicDataSource
bds
;
public
DuibaLog
log
=
DuibaLog
.
getLogger
();
//数据库地址
private
String
URL
;
// = "jdbc:mysql://localhost:3306/mydb";
private
Connection
connection
;
private
PreparedStatement
pstmt
;
private
ResultSet
resultSet
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
MysqlUtils
(
String
username
,
String
password
,
String
url
){
USERNAME
=
username
;
PASSWORD
=
password
;
URL
=
url
;
connection
=
getConnection
();
}
public
MysqlUtils
(){
bds
=
getDbs
();
}
/**
*
* @param username 用户名
* @param password 密码
* @param ip 数据库ip
* @param port 端口号
* @param databaseName 数据库名
*/
public
MysqlUtils
(
String
username
,
String
password
,
String
ip
,
String
port
,
String
databaseName
){
this
(
username
,
password
,
"jdbc:mysql://"
+
ip
+
":"
+
port
+
"/"
+
databaseName
);
}
/**
* 阿里云数据库连接
* @param databaseName 数据库名字
*/
public
MysqlUtils
(
String
databaseName
){
this
(
"duiba_test"
,
"svbP3KUw2PurAnBb2rbs3vohF"
,
"rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com"
,
"3306"
,
databaseName
);
}
public
static
MysqlUtils
mysqlDuiba
(
String
databaseName
){
return
new
MysqlUtils
(
"duiba_test"
,
"svbP3KUw2PurAnBb2rbs3vohF"
,
"rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com"
,
"3306"
,
databaseName
);
}
/**
* 获得数据库的连接
* @return
*/
public
Connection
getConnection
(){
try
{
try
{
Class
.
forName
(
DRIVER
);
logger
.
info
(
"数据库连接成功!"
);
}
catch
(
ClassNotFoundException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
connection
=
DriverManager
.
getConnection
(
URL
,
USERNAME
,
PASSWORD
);
}
catch
(
SQLException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
connection
;
}
public
BasicDataSource
getDbs
(){
BasicDataSource
bds
=
new
BasicDataSource
();
bds
.
setDriverClassName
(
"com.mysql.jdbc.Driver"
);
bds
.
setUrl
(
"jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/"
);
bds
.
setUsername
(
"duiba_test"
);
bds
.
setPassword
(
"svbP3KUw2PurAnBb2rbs3vohF"
);
bds
.
setMaxTotal
(
2
);
return
bds
;
}
public
Connection
getconnectionByDataSource
()
throws
SQLException
{
return
bds
.
getConnection
();
}
/**
* 增加、删除、改
* @param sql sql语句
* @param params 参数,替换 ?
* @return true or false
* @throws SQLException
*/
public
boolean
update
(
String
sql
,
Object
...
params
)
throws
SQLException
{
boolean
flag
=
false
;
int
result
=
-
1
;
pstmt
=
connection
.
prepareStatement
(
sql
);
int
index
=
1
;
if
(
params
!=
null
&&
!(
params
.
length
==
0
)){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
pstmt
.
setObject
(
index
++,
params
[
i
]);
}
}
result
=
pstmt
.
executeUpdate
();
flag
=
result
>
0
?
true
:
false
;
return
flag
;
}
/**
* 查询结果只有一行数据
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return map
* @throws SQLException
*/
public
Map
<
String
,
Object
>
findSimpleResult
(
String
sql
,
Object
...
params
)
throws
SQLException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
int
index
=
1
;
pstmt
=
connection
.
prepareStatement
(
sql
);
if
(
params
!=
null
&&
!(
params
.
length
==
0
)){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
pstmt
.
setObject
(
index
++,
params
[
i
]);
}
}
resultSet
=
pstmt
.
executeQuery
();
//返回查询结果
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
col_len
=
metaData
.
getColumnCount
();
while
(
resultSet
.
next
()){
for
(
int
i
=
0
;
i
<
col_len
;
i
++
){
String
cols_name
=
metaData
.
getColumnName
(
i
+
1
);
Object
cols_value
=
resultSet
.
getObject
(
cols_name
);
if
(
cols_value
==
null
){
cols_value
=
""
;
}
map
.
put
(
cols_name
,
cols_value
);
}
}
return
map
;
}
/**
* 返回多条数据
* @param sql sql语句
* @param params 可变参数,替换 ?
* @return list
* @throws SQLException
*/
public
List
<
Map
<
String
,
Object
>>
findModeResult
(
String
sql
,
Object
...
params
)
throws
SQLException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
int
index
=
1
;
pstmt
=
connection
.
prepareStatement
(
sql
);
if
(
params
!=
null
&&
!(
params
.
length
==
0
)){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
pstmt
.
setObject
(
index
++,
params
[
i
]);
}
}
resultSet
=
pstmt
.
executeQuery
();
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
int
cols_len
=
metaData
.
getColumnCount
();
while
(
resultSet
.
next
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
for
(
int
i
=
0
;
i
<
cols_len
;
i
++){
String
cols_name
=
metaData
.
getColumnName
(
i
+
1
);
Object
cols_value
=
resultSet
.
getObject
(
cols_name
);
if
(
cols_value
==
null
){
cols_value
=
""
;
}
map
.
put
(
cols_name
,
cols_value
);
}
list
.
add
(
map
);
}
return
list
;
}
/**
* 释放数据库连接
*/
public
void
releaseConn
(){
if
(
resultSet
!=
null
){
try
{
resultSet
.
close
();
logger
.
info
(
"数据库连接释放成功"
);
}
catch
(
SQLException
e
){
e
.
printStackTrace
();
}
}
}
}
src/test/java/base/Postman.java
0 → 100644
View file @
fdeb0172
package
base
;
import
io.restassured.RestAssured
;
import
io.restassured.config.RestAssuredConfig
;
import
io.restassured.http.ContentType
;
import
io.restassured.response.Response
;
import
org.apache.http.client.params.ClientPNames
;
import
org.apache.http.params.CoreConnectionPNames
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Map
;
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"
;
//dingdingUrl="http://www.json.cn/";
private
static
Logger
logger
=
LogManager
.
getLogger
(
Postman
.
class
);
public
static
void
send2Dingding
(
Map
result
){
System
.
out
.
println
(
"Dingding:"
+
result
);
RestAssuredConfig
config
=
RestAssured
.
config
();
config
.
getHttpClientConfig
()
.
setParam
(
ClientPNames
.
CONN_MANAGER_TIMEOUT
,
150000
)
// HttpConnectionManager connection return time
.
setParam
(
CoreConnectionPNames
.
CONNECTION_TIMEOUT
,
150000
)
// Remote host connection time
.
setParam
(
CoreConnectionPNames
.
SO_TIMEOUT
,
150000
)
;
// Remote host response time
Response
response
=
given
().
relaxedHTTPSValidation
().
contentType
(
ContentType
.
JSON
).
body
(
result
).
post
(
dingdingUrl
);
logger
.
info
(
"钉钉响应数据:"
+
response
.
asString
());
Boolean
bl
=
response
.
jsonPath
().
getString
(
"success"
).
equals
(
"false"
);
if
(
bl
){
String
[]
name
=
DingdingResult
.
name
;
result
.
put
(
"names"
,
name
);
response
=
given
().
contentType
(
ContentType
.
JSON
).
body
(
result
).
post
(
dingdingUrl
);
System
.
out
.
println
(
"钉钉重试响应数据:"
+
response
.
asString
());
}
}
public
static
void
sendTestPlatform
(
Map
result
){
Response
response
=
given
().
contentType
(
ContentType
.
JSON
).
body
(
result
).
post
(
testPlatformUrl
);
System
.
out
.
println
(
"自动化数据收集平台响应数据:"
+
response
.
asString
());
}
public
static
Boolean
getName
(){
Calendar
c
=
Calendar
.
getInstance
();
Date
date
=
new
Date
();
c
.
setTime
(
date
);
int
week_num
=
c
.
get
(
Calendar
.
WEEK_OF_YEAR
);
System
.
out
.
println
(
week_num
);
System
.
out
.
println
(
week_num
==
0
);
if
(
week_num
%
2
==
0
)
return
true
;
else
return
false
;
}
}
src/test/java/base/RetryListener.java
0 → 100644
View file @
fdeb0172
package
base
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Method
;
import
com.sun.net.httpserver.Authenticator
;
import
org.testng.IAnnotationTransformer
;
import
org.testng.IRetryAnalyzer
;
import
org.testng.annotations.ITestAnnotation
;
/**
* Created by mabo on 2018/9/29
*/
public
class
RetryListener
implements
IAnnotationTransformer
{
public
void
transform
(
ITestAnnotation
annotation
,
Class
testClass
,
Constructor
testConstructor
,
Method
testMethod
)
{
IRetryAnalyzer
retry
=
annotation
.
getRetryAnalyzer
();
if
(
retry
==
null
)
{
annotation
.
setRetryAnalyzer
(
RetryToRunCase
.
class
);
}
}
}
\ No newline at end of file
src/test/java/base/RetryToRunCase.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.testng.IRetryAnalyzer
;
import
org.testng.ITestResult
;
/**
* Created by mabo on 2018/9/29
*/
public
class
RetryToRunCase
implements
IRetryAnalyzer
{
private
int
retryCount
=
0
;
private
int
maxRetryCount
=
Integer
.
valueOf
(
System
.
getProperty
(
"maxRetryCount"
));
// retry a failed test 2 additional times
public
boolean
retry
(
ITestResult
result
)
{
if
(
retryCount
<
maxRetryCount
)
{
retryCount
++;
return
true
;
}
return
false
;
}
}
src/test/java/base/SFExpress.java
0 → 100644
View file @
fdeb0172
package
base
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
/**
* Created by hanzhanli on 2017/11/30.
*/
public
class
SFExpress
{
private
final
static
List
<
String
>
exceptionServices
=
new
ArrayList
<>();
private
final
static
List
<
String
>
exceptionMessage
=
new
ArrayList
<>();
private
final
static
Set
<
String
>
toBeTestedServices
=
new
HashSet
<>();
public
static
void
addToBeTestedServices
(
Set
<
String
>
services
){
toBeTestedServices
.
addAll
(
services
);
}
public
static
void
addExceptionService
(
String
service
){
exceptionServices
.
add
(
service
);
}
public
static
void
addExceptionMessage
(
String
message
){
exceptionMessage
.
add
(
message
);
}
public
static
void
addExceptionService
(
List
<
String
>
service
){
exceptionServices
.
addAll
(
service
);
}
public
static
Set
<
String
>
getToBeTestedServices
(){
return
toBeTestedServices
;
}
public
static
List
<
String
>
getExceptionServices
(){
return
exceptionServices
;
}
public
static
List
<
String
>
getExceptionMessage
(){
return
exceptionMessage
;
}
}
src/test/java/base/SuiteResult.java
0 → 100644
View file @
fdeb0172
package
base
;
import
org.testng.IClass
;
import
org.testng.ISuiteResult
;
import
org.testng.ITestResult
;
import
org.testng.Reporter
;
import
org.uncommons.reportng.HTMLReporter
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.SortedMap
;
/**
* Created by hanzhanli on 2017/11/1.
*/
public
class
SuiteResult
{
String
suiteName
;
int
total
=
0
;
int
passCount
=
0
;
int
skipCount
=
0
;
public
int
getTotal
()
{
return
total
;
}
public
int
getPassCount
()
{
return
passCount
;
}
public
int
getSkipCount
()
{
return
skipCount
;
}
public
int
getFailCount
()
{
return
failCount
;
}
int
failCount
=
0
;
Map
<
String
,
List
<
ClassResult
>>
result
=
new
HashMap
<>();
public
SuiteResult
(
String
suiteName
){
this
.
suiteName
=
suiteName
;
}
public
void
addResult
(
String
key
,
List
<
ClassResult
>
classResultList
,
int
count
){
result
.
put
(
key
,
classResultList
);
this
.
total
=
total
+
count
;
if
(
key
.
equals
(
"pass"
)){
this
.
passCount
=
count
;
}
else
if
(
key
.
equals
(
"skip"
)){
this
.
skipCount
=
count
;
}
else
if
(
key
.
equals
(
"fail"
)){
this
.
failCount
=
count
;
}
}
//{"suiteName":"myName","results":{"total":3,"data":{"pass":{"count":1,"data":{"method":"mathodNameB","duration":10,"out":"contents"}},"skip":null,"fail":null}}}
// public SuiteResult(ISuiteResult result){
// this.result=new HashMap<>();
// int total=0;
// Map<String,Object> data=new HashMap<>();
// SortedMap<IClass, List<ITestResult>> failedMap = HTMLReporter.sortByTestClassTool(result.getTestContext().getFailedConfigurations());
// Map<String,Object> failedResultMap=new HashMap<>();
//
// for(IClass testClass:failedMap.keySet()){
// List<ITestResult> testResultList=failedMap.get(testClass);
//
// for(ITestResult testResult:testResultList){
//
// }
// }
//
//
// }
public
Map
<
String
,
String
>
getMethodResult
(
ITestResult
testResult
){
Map
<
String
,
String
>
methodResult
=
new
HashMap
<>();
String
title
=
testResult
.
getName
();
String
description
=
testResult
.
getMethod
().
getDescription
();
if
(
description
!=
null
&&
description
.
length
()>
0
){
title
=
title
+
":"
+
description
;
}
String
duration
=
String
.
valueOf
(
testResult
.
getEndMillis
()-
testResult
.
getStartMillis
());
String
output
=
Reporter
.
getOutput
(
testResult
).
toString
();
methodResult
.
put
(
"title"
,
title
);
methodResult
.
put
(
"duration"
,
duration
);
methodResult
.
put
(
"output"
,
output
);
return
methodResult
;
}
}
src/test/java/base/TestListener.java
0 → 100644
View file @
fdeb0172
package
base
;
import
java.util.Iterator
;
import
org.testng.ITestContext
;
import
org.testng.ITestListener
;
import
org.testng.ITestNGMethod
;
import
org.testng.ITestResult
;
/**
* Created by mabo on 2018/9/29
*/
public
class
TestListener
implements
ITestListener
{
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
public
void
onFinish
(
ITestContext
context
)
{
Iterator
<
ITestResult
>
listOfFailedTests
=
context
.
getFailedTests
().
getAllResults
().
iterator
();
while
(
listOfFailedTests
.
hasNext
())
{
ITestResult
failedTest
=
listOfFailedTests
.
next
();
ITestNGMethod
method
=
failedTest
.
getMethod
();
if
(
context
.
getFailedTests
().
getResults
(
method
).
size
()
>
1
)
{
listOfFailedTests
.
remove
();
}
else
{
if
(
context
.
getPassedTests
().
getResults
(
method
).
size
()
>
0
)
{
listOfFailedTests
.
remove
();
}
}
}
}
// Following are all the method stubs that you do not have to implement
public
void
onTestStart
(
ITestResult
result
)
{
// TODO Auto-generated method stub
logger
.
info
(
"Current Thread Id: "
+
Thread
.
currentThread
().
getId
());
}
public
void
onTestSuccess
(
ITestResult
result
)
{
// TODO Auto-generated method stub
}
public
void
onTestFailure
(
ITestResult
result
)
{
// TODO Auto-generated method stub
}
public
void
onTestSkipped
(
ITestResult
result
)
{
// TODO Auto-generated method stub
}
public
void
onTestFailedButWithinSuccessPercentage
(
ITestResult
result
)
{
// TODO Auto-generated method stub
}
public
void
onStart
(
ITestContext
context
)
{
// TODO Auto-generated method stub
}
}
\ No newline at end of file
src/test/java/base/TestReport.java
0 → 100644
View file @
fdeb0172
package
base
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
org.testng.*
;
import
org.testng.xml.XmlSuite
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by mabo on 2018/10/12
*/
public
class
TestReport
implements
IReporter
{
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Override
public
void
generateReport
(
List
<
XmlSuite
>
xmlSuites
,
List
<
ISuite
>
suites
,
String
outputDirectory
)
{
int
total
=
0
;
int
passCount
=
0
;
int
skipCount
=
0
;
int
failCount
=
0
;
List
<
String
>
failCase
=
new
ArrayList
<>();
for
(
ISuite
suite
:
suites
)
{
Map
<
String
,
ISuiteResult
>
result
=
suite
.
getResults
();
for
(
ISuiteResult
r
:
result
.
values
())
{
ITestContext
context
=
r
.
getTestContext
();
total
=
context
.
getAllTestMethods
().
length
;
passCount
=
context
.
getPassedTests
().
size
();
failCount
=
context
.
getFailedTests
().
size
();
skipCount
=
context
.
getSkippedTests
().
size
();
for
(
ITestNGMethod
m:
context
.
getFailedTests
().
getAllMethods
())
{
String
[]
classes
=
m
.
getTestClass
().
toString
().
split
(
" "
);
String
cla
=
classes
[
classes
.
length
-
1
];
failCase
.
add
(
cla
.
substring
(
0
,
cla
.
length
()-
1
)+
"."
+
m
.
getMethodName
());
}
}
}
DingdingResult
ddResult
=
null
;
try
{
ddResult
=
new
DingdingResult
(
total
,
passCount
,
skipCount
,
failCount
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
boolean
noticeDD
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
"noticeDD"
));
boolean
noticePerson
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
"noticePerson"
));
boolean
sendPlatform
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
"sendPlatform"
));
Gson
gson
=
new
GsonBuilder
().
create
();
Map
<
String
,
Object
>
map
=
null
;
try
{
map
=
ddResult
.
getResult
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
map
.
put
(
"failCase"
,
failCase
);
// logger.in fo("gson.toJson(ddResult)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System
.
out
.
println
(
"测试结果通知信息:"
+
gson
.
toJson
(
map
));
//发送运行结果到自动化数据收集平台
if
(
sendPlatform
)
Postman
.
sendTestPlatform
(
map
);
//发送钉钉通知
if
(
noticeDD
){
if
(!
noticePerson
){
map
.
put
(
"names"
,
new
ArrayList
<>());
}
// logger.info("noticeDD:"+noticeDD);
Postman
.
send2Dingding
(
map
);
}
}
}
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