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
31ebddd4
Commit
31ebddd4
authored
Dec 06, 2018
by
钱雯君
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into qwj_181029
parents
718f7570
45efea03
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
234 additions
and
9 deletions
+234
-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
自有单抽限制_AccessTest.java
.../java/http/cases/SingleLotteryTest/自有单抽限制_AccessTest.java
+127
-0
种红包_AccessTest.java
src/test/java/http/cases/WalletTest/种红包_AccessTest.java
+10
-0
No files found.
pom.xml
View file @
31ebddd4
...
@@ -261,6 +261,12 @@
...
@@ -261,6 +261,12 @@
<artifactId>
guava
</artifactId>
<artifactId>
guava
</artifactId>
<version>
21.0
</version>
<version>
21.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.com.duiba.tool
</groupId>
<artifactId>
java-gitlab-api
</artifactId>
<version>
1.3.8
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/test/java/base/DingdingResult.java
View file @
31ebddd4
...
@@ -2,6 +2,7 @@ package base;
...
@@ -2,6 +2,7 @@ package base;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.gitlab.api.models.GitlabProjectMerges
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
...
@@ -52,6 +53,15 @@ public class DingdingResult {
...
@@ -52,6 +53,15 @@ public class DingdingResult {
names
.
addAll
(
Arrays
.
asList
(
getNames
));
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);
Map<String,String> resentChanges=BeTested.getChangesWithin(30,changeMap);
System.out.println(resentChanges);
System.out.println(resentChanges);
if(resentChanges!=null&&resentChanges.size()>0){
if(resentChanges!=null&&resentChanges.size()>0){
...
@@ -77,7 +87,7 @@ public class DingdingResult {
...
@@ -77,7 +87,7 @@ public class DingdingResult {
if(changes.length()>140){
if(changes.length()>140){
changes=changes.substring(0,141)+"……";
changes=changes.substring(0,141)+"……";
}
}
//project="tuia-media";
*/
this
.
total
=
total
;
this
.
total
=
total
;
this
.
passCount
=
passCount
;
this
.
passCount
=
passCount
;
this
.
skipCount
=
skipCount
;
this
.
skipCount
=
skipCount
;
...
@@ -125,14 +135,16 @@ public class DingdingResult {
...
@@ -125,14 +135,16 @@ public class DingdingResult {
result
.
put
(
"skipCount"
,
this
.
total
);
result
.
put
(
"skipCount"
,
this
.
total
);
result
.
put
(
"failCount"
,
0
);
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
){
if
(
this
.
failCount
>
0
||
exceptionServices
.
size
()>
0
||
exceptionMessage
.
size
()>
0
){
try
{
// try{
String
name
=
this
.
changes
.
split
(
"—"
)[
1
].
split
(
"/"
)[
0
];
// String name = this.changes.split("—")[1].split("/")[0];
names
.
add
(
name
);
// names.add(name);
}
catch
(
Exception
e
){
// }catch(Exception e){
System
.
out
.
println
(
e
);
// System.out.println(e);
}
// }
}
else
{
}
else
{
names
.
clear
();
names
.
clear
();
...
...
src/test/java/base/GitlabUtils.java
0 → 100644
View file @
31ebddd4
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 @
31ebddd4
...
@@ -25,6 +25,7 @@ public class Postman {
...
@@ -25,6 +25,7 @@ public class Postman {
final
static
String
testPlatformUrl
=
"http://101.37.27.82:8080/insert"
;
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
miriaUrl
=
"http://miria-aliyun.duibatest.com.cn/autoTest/finish"
;
final
static
String
miriaUrlTesting
=
"http://miria-aliyun.duibatest.com.cn/autoTest/testing"
;
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/";
//dingdingUrl="http://www.json.cn/";
private
static
Logger
logger
=
LogManager
.
getLogger
(
Postman
.
class
);
private
static
Logger
logger
=
LogManager
.
getLogger
(
Postman
.
class
);
...
@@ -67,6 +68,15 @@ public class Postman {
...
@@ -67,6 +68,15 @@ public class Postman {
System
.
out
.
println
(
"miriaUrl:"
+
miriaUrlTesting
);
System
.
out
.
println
(
"miriaUrl:"
+
miriaUrlTesting
);
System
.
out
.
println
(
"miria响应结果:"
+
response
.
asString
());
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
(){
public
static
Boolean
getName
(){
Calendar
c
=
Calendar
.
getInstance
();
Calendar
c
=
Calendar
.
getInstance
();
Date
date
=
new
Date
();
Date
date
=
new
Date
();
...
...
src/test/java/http/cases/FloorTest/Item_FloorTest.java
View file @
31ebddd4
...
@@ -393,7 +393,7 @@ public class Item_FloorTest extends DuibaTestBase {
...
@@ -393,7 +393,7 @@ public class Item_FloorTest extends DuibaTestBase {
JsonPath
jsonPath
=
from
(
s
.
substring
(
s
.
indexOf
(
"{"
),
s
.
length
()-
1
));
JsonPath
jsonPath
=
from
(
s
.
substring
(
s
.
indexOf
(
"{"
),
s
.
length
()-
1
));
List
<
Map
>
list
=
jsonPath
.
getList
(
"list"
,
Map
.
class
);
List
<
Map
>
list
=
jsonPath
.
getList
(
"list"
,
Map
.
class
);
Assert
.
assertEquals
(
list
.
size
(),
listDev
.
size
(),
"开发者配置和手机端展示数量不符"
);
//
Assert.assertEquals(list.size(),listDev.size(),"开发者配置和手机端展示数量不符");
...
...
src/test/java/http/cases/SingleLotteryTest/自有单抽限制_AccessTest.java
0 → 100644
View file @
31ebddd4
package
http
.
cases
.
SingleLotteryTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.SingleLotteryService
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
utils.RedisUtil
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by zhaoran on 2018/6/8.
*/
public
class
自有单抽限制
_AccessTest
extends
DuibaTestBase
{
@Autowired
SingleLotteryService
singleLotteryService
;
@Autowired
Authorization
authorization
;
@Value
(
"${activity.host}"
)
String
activityHost
;
@Value
(
"${manager.host}"
)
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
4881
;
private
static
int
uid2
=
4882
;
private
static
int
uid3
=
2709
;
private
static
int
uid4
=
2709
;
@BeforeClass
public
void
before
()
{
try
{
RedisUtil
.
clearKey
(
"AC_K001_36686_"
+
getTime
(
0
));
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
每日用户抽奖限制
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36686"
);
map
.
put
(
"oaId"
,
"36686"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"8"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已抽完"
,
"校验信息失败"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
@Test
public
void
永久用户抽奖限制
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36708"
);
map
.
put
(
"oaId"
,
"36708"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"2"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"已抽完"
,
"校验信息失败"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
@Test
public
void
抽奖日期限制
(){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36689"
);
map
.
put
(
"oaId"
,
"36689"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
//response.prettyPeek();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"4"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"已结束"
,
"校验信息失败"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
public
String
getTime
(
int
amount
){
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"YYYY-MM-dd"
,
Locale
.
ENGLISH
);
Date
date
=
new
Date
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
add
(
Calendar
.
MONTH
,
amount
);
date
=
calendar
.
getTime
();
// System.out.println(dateFormat.format(date));
String
time
=
dateFormat
.
format
(
date
);
// System.out.println(time);
return
time
;
}
}
\ No newline at end of file
src/test/java/http/cases/WalletTest/种红包_AccessTest.java
View file @
31ebddd4
package
http
.
cases
.
WalletTest
;
package
http
.
cases
.
WalletTest
;
import
base.DuibaTestBase
;
import
base.DuibaTestBase
;
import
org.testng.annotations.BeforeClass
;
import
utils.RedisUtil
;
import
utils.RedisUtil
;
import
http.service.Activity.SeedRedPacketService
;
import
http.service.Activity.SeedRedPacketService
;
import
http.service.Activity.WalletAccountService
;
import
http.service.Activity.WalletAccountService
;
...
@@ -28,6 +29,15 @@ public class 种红包_AccessTest extends DuibaTestBase{
...
@@ -28,6 +29,15 @@ public class 种红包_AccessTest extends DuibaTestBase{
Authorization
authorization
;
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@BeforeClass
public
void
beforeclass
()
{
try
{
//前置操作,确保土地是空地状态
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
"1"
,
"100066444"
,
"3"
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"数据前后置操作异常"
);
}
}
@Test
@Test
public
void
种红包
()
throws
Exception
{
public
void
种红包
()
throws
Exception
{
...
...
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