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
f4fcef82
Commit
f4fcef82
authored
Aug 08, 2019
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab2.dui88.com:mabo/test-platform
parents
58c27935
089fbef0
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
214 additions
and
64 deletions
+214
-64
DingdingResult.java
src/test/java/base/DingdingResult.java
+27
-22
DuibaBaseUi.java
src/test/java/base/DuibaBaseUi.java
+15
-0
自有新优惠券_兑换限制测试_ExchangeTest.java
...es/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
+44
-0
自有新实物_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
+38
-40
自有新虚拟商品_充值_兑换限制_ExchangeTest.java
.../ExchangeTest/自有_商品兑换限制/自有新虚拟商品_充值_兑换限制_ExchangeTest.java
+46
-0
商品分组组件_DuibaTest.java
...st/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
+0
-0
商品组件_DuibaTest.java
...test/java/http/cases/VisualEditorTest/商品组件_DuibaTest.java
+0
-0
gawService.java
src/test/java/http/service/app/gawService.java
+2
-2
DevItemNewService.java
src/test/java/http/service/hd/DevItemNewService.java
+35
-0
duiba.properties
src/test/profiles/aliyun/duiba.properties
+7
-0
No files found.
src/test/java/base/DingdingResult.java
View file @
f4fcef82
...
...
@@ -151,40 +151,45 @@ public class DingdingResult {
System
.
out
.
println
(
"run+\".\"+type:"
+
run
+
"."
+
type
);
if
((
run
+
"."
+
type
).
equals
(
"ui.group"
))
return
"ui自动化测试"
;
run
=
this
.
env
.
getProperty
(
run
+
"."
+
type
);
// System.out.println("(runs+\".\"+type):"+run+"."+type);
// System.out.println("runs:"+run);
System
.
out
.
println
(
"run:"
+
run
);
return
new
String
(
run
.
getBytes
(
"ISO-8859-1"
),
"UTF-8"
);
//ISO-8859-1
String
returnString
=
new
String
(
run
.
getBytes
(
"ISO-8859-1"
),
"UTF-8"
);
//ISO-8859-1
System
.
out
.
println
(
"returnString:"
+
returnString
);
return
returnString
;
}
public
static
void
main
(
String
[]
args
)
throws
UnsupportedEncodingException
{
String
s
=
"**/*_signTest.java"
;
s
=
s
.
substring
(
s
.
indexOf
(
"_"
)+
1
,
s
.
indexOf
(
"."
));
System
.
out
.
println
(
s
);
// 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);
ApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
Config
.
class
);
Environment
env
=
context
.
getBean
(
Environment
.
class
);
String
ss
=
env
.
getProperty
(
"
pluginTest.names
"
);
String
ss
=
env
.
getProperty
(
"
Cms_ui.group
"
);
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/DuibaBaseUi.java
View file @
f4fcef82
...
...
@@ -456,6 +456,14 @@ public class DuibaBaseUi extends DuibaBase{
}
}
/**
* 输入,通过xpath
* @param xpath
* @param text
* @param index 元素的下标
* @throws Exception
*/
public
final
void
inputByXpath
(
String
xpath
,
String
text
,
int
index
)
throws
Exception
{
int
i
=
5
;
...
...
@@ -480,10 +488,17 @@ public class DuibaBaseUi extends DuibaBase{
}
/**
* 滑动窗口到顶部
*/
public
void
scrollToTop
(){
((
JavascriptExecutor
)
driver
).
executeScript
(
"window.scrollTo(document.body.scrollHeight,0)"
);
}
/**
* 滑动窗口到底部
*/
public
void
scrollToDown
(){
((
JavascriptExecutor
)
driver
).
executeScript
(
"window.scrollTo(0,document.body.scrollHeight)"
);
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
View file @
f4fcef82
...
...
@@ -628,6 +628,50 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
}
@Test
(
description
=
"新优惠券扣库存测试"
)
public
void
优惠券扣库存测试
()
throws
Exception
{
int
uid
=
7312
;
String
appItemId
=
"197567"
;
int
skuId
=
187
;
//查询兑换前的库存
//stock_id 通过表tb_goods_batch 来查询
Map
<
String
,
Object
>
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060747299329170094"
);
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
i
--;
}
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060747299329170094"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
logger
.
info
(
"兑换后的库存:"
+
newStock
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.status"
),
"success"
,
"校验订单状态失败"
);
Assert
.
assertEquals
(
newStock
,
result
,
"校验扣库存失败"
);
logger
.
info
(
"校验新优惠券商品扣库存成功"
);
}
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
View file @
f4fcef82
...
...
@@ -497,55 +497,53 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test
(
description
=
"新实物扣库存测试"
)
public
void
实物扣库存测试
()
throws
Exception
{
int
uid
=
7302
;
String
appItemId
=
"197385"
;
String
itemId
=
null
;
String
skuId
=
"183"
;
String
credits
=
"10"
;
String
actualCredits
=
"10"
;
//查询兑换前的库存
//stock_id 通过表tb_app_item_sku 来查询
Map
<
String
,
Object
>
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1059049813690420183"
);
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
i
--;
}
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1059049813690420183"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
logger
.
info
(
"兑换后的库存:"
+
newStock
);
//测试使用
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
@DataProvider
(
name
=
"testdp"
,
parallel
=
true
)
public
static
Object
[][]
testdp
(){
return
new
Object
[][]{
{
1
},
{
2
},
{
3
},
{
4
},
{
162
},
{
6
},
{
8
},
{
10
},
{
157
},
{
158
}
};
}
// @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
public
void
test
(
int
uid
)
throws
Exception
{
// System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber);
// Thread.sleep(5000);
String
appItemId
=
"159040"
;
String
itemId
=
"null"
;
String
message
=
""
;
String
skuId
=
"144"
;
String
actualCredits
=
"8"
;
String
credits
=
"100"
;
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.status"
),
"wait_delivery"
,
"校验订单状态失败"
);
Assert
.
assertEquals
(
newStock
,
result
,
"校验扣库存失败"
);
logger
.
info
(
"校验新实物商品扣库存成功"
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
response
.
prettyPrint
();
//(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=2)
}
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新虚拟商品_充值_兑换限制_ExchangeTest.java
View file @
f4fcef82
...
...
@@ -500,4 +500,50 @@ public class 自有新虚拟商品_充值_兑换限制_ExchangeTest extends Chec
}
@Test
(
description
=
"虚拟商品扣库存测试"
)
public
void
虚拟商品扣库存测试
()
throws
Exception
{
int
uid
=
7313
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
String
appItemId
=
"197568"
;
int
skuId
=
188
;
//查询兑换前的库存
//stock_id 通过表tb_app_item_sku 来查询
Map
<
String
,
Object
>
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060758938511670188"
);
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
virtualExchange
(
cookies
,
appItemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
i
--;
}
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060758938511670188"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
logger
.
info
(
"兑换后的库存:"
+
newStock
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.status"
),
"success"
,
"校验订单状态失败"
);
Assert
.
assertEquals
(
newStock
,
result
,
"校验扣库存失败"
);
logger
.
info
(
"校验充值商品扣库存成功"
);
}
}
src/test/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
View file @
f4fcef82
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/VisualEditorTest/商品组件_DuibaTest.java
0 → 100644
View file @
f4fcef82
This diff is collapsed.
Click to expand it.
src/test/java/http/service/app/gawService.java
View file @
f4fcef82
...
...
@@ -222,7 +222,7 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求
实物
兑换接口:"
+
"/gaw/couponExchange/create"
);
logger
.
info
(
"请求
优惠券
兑换接口:"
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/couponExchange/create"
);
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...
...
@@ -353,7 +353,7 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求
实物兑换接口:"
+
"/gaw/coupon
Exchange/create"
);
logger
.
info
(
"请求
虚拟商品兑换接口:"
+
"/gaw/virtual
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/virtualExchange/create"
);
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...
...
src/test/java/http/service/hd/DevItemNewService.java
View file @
f4fcef82
...
...
@@ -127,6 +127,41 @@ public class DevItemNewService {
}
//商品组件
public
Response
appItems
(
Map
cookies
,
String
appId
,
List
<
Integer
>
itemIdList
)
throws
Exception
{
String
url
=
hdserverHost
+
"/devItemNew/appItems"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"status"
,
"on"
);
map
.
put
(
"pageSize"
,
"300"
);
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"itemIdList"
,
itemIdList
);
map
.
put
(
"sort"
,
"custom"
);
map
.
put
(
"soldOutType"
,
"show"
);
map
.
put
(
"forGoodsVisual"
,
"true"
);
logger
.
info
(
"请求商品组件接口:"
+
"/devItemNew/appItems"
);
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
get
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/devItemNew/appItems接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/devItemNew/appItems接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
...
...
src/test/profiles/aliyun/duiba.properties
View file @
f4fcef82
...
...
@@ -85,3 +85,10 @@ ui.names=mabo
ui.group
=
\u
81EA
\u
52A8
\u5316
ui.resultUrl
=
http://101.68.72.146:18080/job/duiba_ui/HTML_20Report/suite1_test1_results.html
ui.job
=
duiba_ui
Cms_ui.project
=
界面自动化核心业务
Cms_ui.names
=
mabo
Cms_ui.group
=
自动化
Cms_ui.resultUrl
=
http://10.254.187.25/job/duiba_ui/HTML_20Report/suite1_test1_results.html
Cms_ui.job
=
duiba_cms_ui
\ No newline at end of file
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