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
c570bb3f
Commit
c570bb3f
authored
Dec 06, 2018
by
马博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mabo'
parents
efb8a4b4
ee72d1f2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
9 deletions
+97
-9
pom.xml
pom.xml
+6
-0
DingdingResult.java
src/test/java/base/DingdingResult.java
+20
-8
GitlabUtils.java
src/test/java/base/GitlabUtils.java
+60
-0
Postman.java
src/test/java/base/Postman.java
+10
-0
Item_FloorTest.java
src/test/java/http/cases/FloorTest/Item_FloorTest.java
+1
-1
No files found.
pom.xml
View file @
c570bb3f
...
...
@@ -261,6 +261,12 @@
<artifactId>
guava
</artifactId>
<version>
21.0
</version>
</dependency>
<dependency>
<groupId>
cn.com.duiba.tool
</groupId>
<artifactId>
java-gitlab-api
</artifactId>
<version>
1.3.8
</version>
</dependency>
</dependencies>
<build>
...
...
src/test/java/base/DingdingResult.java
View file @
c570bb3f
...
...
@@ -2,6 +2,7 @@ package base;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.gitlab.api.models.GitlabProjectMerges
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.env.Environment
;
...
...
@@ -52,6 +53,15 @@ public class DingdingResult {
names
.
addAll
(
Arrays
.
asList
(
getNames
));
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"jobName"
,
getJob
());
changes
=
Postman
.
sendFindTestApp
(
params
);
GitlabProjectMerges
gitlabProjectMerges
=
GitlabUtils
.
getMessage
(
"credits-group"
,
changes
);
changes
=
changes
+
" 提交者:"
+
gitlabProjectMerges
.
getAuthor
().
getName
()+
" 描述:"
+
gitlabProjectMerges
.
getDescription
();
/*从jenkins上获取项目变更
Map<String,String> resentChanges=BeTested.getChangesWithin(30,changeMap);
System.out.println(resentChanges);
if(resentChanges!=null&&resentChanges.size()>0){
...
...
@@ -77,7 +87,7 @@ public class DingdingResult {
if(changes.length()>140){
changes=changes.substring(0,141)+"……";
}
//project="tuia-media";
*/
this
.
total
=
total
;
this
.
passCount
=
passCount
;
this
.
skipCount
=
skipCount
;
...
...
@@ -125,14 +135,16 @@ public class DingdingResult {
result
.
put
(
"skipCount"
,
this
.
total
);
result
.
put
(
"failCount"
,
0
);
}
result
.
put
(
"changes"
,
this
.
changes
+
"<br>"
);
// result.put("changes",this.changes+"<br>");
result
.
put
(
"changes"
,
this
.
changes
);
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
);
}
// try{
// String name = this.changes.split("—")[1].split("/")[0];
// names.add(name);
// }catch(Exception e){
// System.out.println(e);
// }
}
else
{
names
.
clear
();
...
...
src/test/java/base/GitlabUtils.java
0 → 100644
View file @
c570bb3f
package
base
;
import
org.gitlab.api.GitlabAPI
;
import
org.gitlab.api.models.GitabProjectLatelyChangeQry
;
import
org.gitlab.api.models.GitlabProject
;
import
org.gitlab.api.models.GitlabProjectMerges
;
import
java.io.IOException
;
import
java.util.List
;
/**
* Created by mabo on 2018/12/5
*/
public
class
GitlabUtils
{
public
static
final
String
GIT_URL
=
"http://gitlab2.dui88.com"
;
public
static
final
String
SECRET
=
"rCyBy1sQ-JckquyFmo4c"
;
public
static
GitlabProjectMerges
getMessage
(
String
namespace
,
String
projectname
){
GitlabAPI
gitlabAPI
=
GitlabAPI
.
connect
(
GitlabUtils
.
GIT_URL
,
GitlabUtils
.
SECRET
);
GitlabProject
gitlabProject
=
null
;
try
{
gitlabProject
=
gitlabAPI
.
getProject
(
namespace
,
projectname
);
// gitlabProject = gitlabAPI.getProject("credits-group","hdtool-web");
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
GitabProjectLatelyChangeQry
qry
=
new
GitabProjectLatelyChangeQry
();
qry
.
setId
(
gitlabProject
.
getId
());
qry
.
setTargetBranch
(
"develop"
);
List
<
GitlabProjectMerges
>
projectMerges
=
null
;
try
{
projectMerges
=
gitlabAPI
.
getLatelyMergeInfo
(
qry
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
projectMerges
.
size
());
GitlabProjectMerges
gitlabProjectMerges
=
projectMerges
.
get
(
0
);
return
gitlabProjectMerges
;
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// GitlabAPI gitlabAPI = GitlabAPI.connect(GitlabUtils.GIT_URL, GitlabUtils.SECRET);
// GitlabProject gitlabProject=gitlabAPI.getProject("credits-group","hdtool-web");
//
// GitabProjectLatelyChangeQry qry = new GitabProjectLatelyChangeQry();
// qry.setId(gitlabProject.getId());
// qry.setTargetBranch("develop");
// List<GitlabProjectMerges> projectMerges = gitlabAPI.getLatelyMergeInfo(qry);
// System.out.println(projectMerges.size());
// GitlabProjectMerges gitlabProjectMerges = projectMerges.get(0);
GitlabProjectMerges
gitlabProjectMerges
=
getMessage
(
"credits-group"
,
"trade-access-web"
);
System
.
out
.
println
(
gitlabProjectMerges
.
getDescription
());
System
.
out
.
println
(
gitlabProjectMerges
.
getAuthor
().
getName
());
System
.
out
.
println
(
gitlabProjectMerges
.
getAuthor
().
getUsername
());
System
.
out
.
println
(
gitlabProjectMerges
.
getAuthor
().
getId
());
}
}
src/test/java/base/Postman.java
View file @
c570bb3f
...
...
@@ -25,6 +25,7 @@ public class Postman {
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"
;
final
static
String
miriaUrlFindTestApp
=
"http://miria-aliyun.duibatest.com.cn/autoTest/findTestApp"
;
//dingdingUrl="http://www.json.cn/";
private
static
Logger
logger
=
LogManager
.
getLogger
(
Postman
.
class
);
...
...
@@ -67,6 +68,15 @@ public class Postman {
System
.
out
.
println
(
"miriaUrl:"
+
miriaUrlTesting
);
System
.
out
.
println
(
"miria响应结果:"
+
response
.
asString
());
}
public
static
String
sendFindTestApp
(
Map
result
){
Response
response
=
given
().
params
(
result
).
get
(
miriaUrlFindTestApp
);
System
.
out
.
println
(
"jobName:"
+
result
.
get
(
"jobName"
));
System
.
out
.
println
(
"miriaUrl:"
+
miriaUrlTesting
);
System
.
out
.
println
(
"miria响应结果:"
+
response
.
asString
());
String
value
=
response
.
jsonPath
().
getString
(
"value"
);
return
value
;
}
public
static
Boolean
getName
(){
Calendar
c
=
Calendar
.
getInstance
();
Date
date
=
new
Date
();
...
...
src/test/java/http/cases/FloorTest/Item_FloorTest.java
View file @
c570bb3f
...
...
@@ -393,7 +393,7 @@ public class Item_FloorTest extends DuibaTestBase {
JsonPath
jsonPath
=
from
(
s
.
substring
(
s
.
indexOf
(
"{"
),
s
.
length
()-
1
));
List
<
Map
>
list
=
jsonPath
.
getList
(
"list"
,
Map
.
class
);
Assert
.
assertEquals
(
list
.
size
(),
listDev
.
size
(),
"开发者配置和手机端展示数量不符"
);
//
Assert.assertEquals(list.size(),listDev.size(),"开发者配置和手机端展示数量不符");
...
...
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