Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nwn_Api_auto_test
Overview
Overview
Details
Activity
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
shuai
nwn_Api_auto_test
Commits
db44930a
Commit
db44930a
authored
Jan 21, 2019
by
Li Yongyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
程序修改导致的历史接口问题和新增新接口
parent
78235e3e
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
113 additions
and
116 deletions
+113
-116
CaseMake.xls
nwn_Api_auto_test/TestData/CaseMake.xls
+0
-0
DataAll.xls
nwn_Api_auto_test/TestData/DataAll.xls
+0
-0
DefectTest.xml
nwn_Api_auto_test/src/DefectTest.xml
+1
-1
MapUtil.java
nwn_Api_auto_test/src/com/offcn/TestUnti/MapUtil.java
+1
-1
ReadProperties.java
nwn_Api_auto_test/src/com/offcn/TestUnti/ReadProperties.java
+1
-1
Reflect_api.java
nwn_Api_auto_test/src/com/offcn/TestUnti/Reflect_api.java
+3
-2
createPackage.java
nwn_Api_auto_test/src/com/offcn/api/nwn/createPackage.java
+17
-9
BasicsGM.java
nwn_Api_auto_test/src/com/offcn/process/BasicsGM.java
+8
-1
NWN.java
nwn_Api_auto_test/src/com/offcn/process/NWN.java
+21
-2
APITest_nwn.java
nwn_Api_auto_test/src/com/offcn/test/APITest_nwn.java
+27
-17
class.properties
nwn_Api_auto_test/src/resources/class.properties
+4
-2
reflect.properties
nwn_Api_auto_test/src/resources/reflect.properties
+2
-74
system.xml
nwn_Api_auto_test/src/resources/system.xml
+16
-0
test.java
nwn_Api_auto_test/src/test/test.java
+12
-6
No files found.
nwn_Api_auto_test/TestData/CaseMake.xls
View file @
db44930a
No preview for this file type
nwn_Api_auto_test/TestData/DataAll.xls
View file @
db44930a
No preview for this file type
nwn_Api_auto_test/src/DefectTest.xml
View file @
db44930a
...
...
@@ -6,7 +6,7 @@
<classes>
<class
name=
"com.puhui.test.RenMai_APITest"
>
<methods>
<include
name=
"f"
invocation-numbers=
"
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
"
/>
<include
name=
"f"
invocation-numbers=
"
-3 -2 -1 0 1 2 3 4 5
"
/>
</methods>
</class>
</classes>
...
...
nwn_Api_auto_test/src/com/offcn/TestUnti/MapUtil.java
View file @
db44930a
...
...
@@ -210,7 +210,7 @@ public class MapUtil {
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
k
=
0
;
k
<
comma
;
k
++){
//此时是多个,,,
String
[]
str
=
strcomma
[
k
].
split
(
"
:
"
);
String
[]
str
=
strcomma
[
k
].
split
(
"
\":\"
"
);
String
str_strcomma
=
Arrays
.
toString
(
str
);
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
...
...
nwn_Api_auto_test/src/com/offcn/TestUnti/ReadProperties.java
View file @
db44930a
...
...
@@ -139,7 +139,7 @@ public class ReadProperties {
Properties
pps
=
new
Properties
();
try
{
File
directory
=
new
File
(
"."
);
String
sourceFile
=
directory
.
getCanonicalPath
()
+
File
.
separator
+
"src"
+
File
.
separator
+
"resources"
+
File
.
separator
+
qudao
+
"
_
reflect.properties"
;
String
sourceFile
=
directory
.
getCanonicalPath
()
+
File
.
separator
+
"src"
+
File
.
separator
+
"resources"
+
File
.
separator
+
qudao
+
"reflect.properties"
;
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
sourceFile
));
pps
.
load
(
in
);
String
value
=
pps
.
getProperty
(
key
);
...
...
nwn_Api_auto_test/src/com/offcn/TestUnti/Reflect_api.java
View file @
db44930a
...
...
@@ -87,8 +87,9 @@ public class Reflect_api {
// return classRoute+ classReflectName;
// }
// }
if
(
"xyzb"
.
equals
(
system
)){
String
classReflectName
=
ReadProperties
.
GetPropertyByClassName
(
serviceUrl
,
system
);
if
(
"nwn"
.
equals
(
system
)){
String
classReflectName
=
ReadProperties
.
GetPropertyByClassName
(
serviceUrl
);
if
(
classReflectName
!=
null
)
{
return
classRoute
+
classReflectName
;
}
...
...
nwn_Api_auto_test/src/com/offcn/api/nwn/createPackage.java
View file @
db44930a
...
...
@@ -39,7 +39,7 @@ public class createPackage extends NWN implements API {
public
String
for_year
;
//年
public
String
product
;
//平台:1 题库 2 星课堂 3 在线课堂 4 优课',
public
String
intro
;
//介绍
public
String
img_url
;
//图片地址
public
String
cover
;
//图片地址
@Override
public
void
initialize
(
HashMap
<
String
,
Object
>
data
)
{
...
...
@@ -58,7 +58,7 @@ public class createPackage extends NWN implements API {
for_year
=
MapUtil
.
getParameter
(
parameter
,
"for_year"
).
trim
();
product
=
MapUtil
.
getParameter
(
parameter
,
"product"
).
trim
();
intro
=
MapUtil
.
getParameter
(
parameter
,
"intro"
).
trim
();
img_url
=
MapUtil
.
getParameter
(
parameter
,
"img_url
"
).
trim
();
cover
=
MapUtil
.
getParameter
(
parameter
,
"cover
"
).
trim
();
data
.
put
(
"parameter"
,
parameter
);
return
data
;
...
...
@@ -128,13 +128,12 @@ public class createPackage extends NWN implements API {
for_year
=
MapUtil
.
getParameter
(
parameter
,
"for_year"
).
trim
();
product
=
MapUtil
.
getParameter
(
parameter
,
"product"
).
trim
();
intro
=
MapUtil
.
getParameter
(
parameter
,
"intro"
).
trim
();
img_url
=
MapUtil
.
getParameter
(
parameter
,
"img_url
"
).
trim
();
cover
=
MapUtil
.
getParameter
(
parameter
,
"cover
"
).
trim
();
pack_name
=
MapUtil
.
killQuotes
(
pack_name
,
"\""
);
for_year
=
MapUtil
.
killQuotes
(
for_year
,
"\""
);
product
=
MapUtil
.
killQuotes
(
product
,
"\""
);
intro
=
MapUtil
.
killQuotes
(
intro
,
"\""
);
img_url
=
MapUtil
.
killQuotes
(
img_url
,
"\""
);
cover
=
MapUtil
.
killQuotes
(
cover
,
"\""
);
try
{
...
...
@@ -156,7 +155,16 @@ public class createPackage extends NWN implements API {
String
act_id
=
rs_bankcard
.
getString
(
"id"
).
equals
(
"null "
)?
"null"
:
rs_bankcard
.
getString
(
"id"
);
n_package_idList
.
add
(
act_id
);
//
System
.
out
.
println
(
"pack_name=="
+
pack_name
);
System
.
out
.
println
(
"act_pack_name=="
+
act_pack_name
);
System
.
out
.
println
(
"for_year=="
+
for_year
);
System
.
out
.
println
(
"act_for_year=="
+
act_for_year
);
System
.
out
.
println
(
"product=="
+
product
);
System
.
out
.
println
(
"act_product=="
+
act_product
);
System
.
out
.
println
(
"intro=="
+
intro
);
System
.
out
.
println
(
"act_intro=="
+
act_intro
);
System
.
out
.
println
(
"cover=="
+
cover
);
System
.
out
.
println
(
"act_cover=="
+
act_cover
);
if
(!(
pack_name
.
equals
(
act_pack_name
))){
result
=
result
&&
false
;
failReason
=
failReason
+
"t_exam_area info pack_name is not in DB;"
;
...
...
@@ -173,11 +181,11 @@ public class createPackage extends NWN implements API {
result
=
result
&&
false
;
failReason
=
failReason
+
"t_exam_area info intro is not in DB;"
;
}
if
(!(
img_url
.
equals
(
act_cover
))){
if
(!(
cover
.
equals
(
act_cover
))){
result
=
result
&&
false
;
failReason
=
failReason
+
"t_exam_area info i
mg_url
is not in DB;"
;
failReason
=
failReason
+
"t_exam_area info i
ntro
is not in DB;"
;
}
}
}
catch
(
Exception
e
)
{
...
...
nwn_Api_auto_test/src/com/offcn/process/BasicsGM.java
View file @
db44930a
...
...
@@ -45,6 +45,8 @@ public abstract class BasicsGM {
//
public
static
Connection
conn
=
null
;
public
static
Statement
stmt
=
null
;
public
static
Connection
conn1
=
null
;
public
static
Statement
stmt1
=
null
;
//
public
static
Map
<
String
,
Object
>
map
=
new
XMLread
().
getSystem
();
// 读取XML配置文件
//
...
...
@@ -85,7 +87,12 @@ public abstract class BasicsGM {
return
rs
;
}
//查询表名tableName的条件是condition的结果集
public
ResultSet
sqlFromDB_template
(
String
sql
)
throws
Exception
{
ResultSet
rs
=
stmt1
.
executeQuery
(
sql
);
return
rs
;
}
//查询表名tableName的条件是condition的结果集,返回数量
public
ResultSet
selectCountFromDB
(
String
tableName
,
String
condition
)
throws
Exception
{
String
sql
;
...
...
nwn_Api_auto_test/src/com/offcn/process/NWN.java
View file @
db44930a
...
...
@@ -42,10 +42,10 @@ public class NWN extends BasicsGM{
public
static
List
<
String
>
n_admin_username_List
=
new
ArrayList
<
String
>();
//n_admin的username
public
static
List
<
String
>
getcode_id_List
=
new
ArrayList
<
String
>();
//getcode的id
public
static
List
<
String
>
n_getcode_id_List
=
new
ArrayList
<
String
>();
//getcode的id
public
static
List
<
String
>
movie_id_list
=
new
ArrayList
<
String
>();
//movid_id的id
public
static
String
level_id_List
=
""
;
//层级的id
public
static
List
<
String
>
user_id_List
=
new
ArrayList
<
String
>();
//user_id
public
static
String
template_id
=
""
;
// public static String phone_code = "";//手机号验证码
//
//
...
...
@@ -70,6 +70,17 @@ public class NWN extends BasicsGM{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
try
{
Class
.
forName
(
"com.mysql.jdbc.Driver"
);
conn1
=
DriverManager
.
getConnection
(((
system
)
map
.
get
(
"nwn_template"
)).
getSqlurl
(),
((
system
)
map
.
get
(
"nwn_template"
)).
getSqlname
(),
((
system
)
map
.
get
(
"nwn_template"
)).
getSqlpwd
());
stmt1
=
conn1
.
createStatement
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
mysql_local_Online
.
equals
(
"Online"
)){
//线上数据库连接
...
...
@@ -190,6 +201,14 @@ public class NWN extends BasicsGM{
// System.out.println(user_idList.toString());
}
public
String
getCurrentYear
(){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy"
);
Date
date
=
new
Date
();
return
sdf
.
format
(
date
);
}
//
//
// //清除用户地区操作表t_exam_area
...
...
nwn_Api_auto_test/src/com/offcn/test/APITest_nwn.java
View file @
db44930a
...
...
@@ -100,23 +100,23 @@ public class APITest_nwn extends NWN{
//数据回写
////
HashMap<String, Object> ExpectResult=MapUtil.Expect(data);
//
SheetUtils sheet = new SheetUtils("DataAll.xls", "Output");
//
sheet.writeExcel(
//
data.get("NO").toString(),
//
data.get("TCNO").toString() + "_Step" + data.get("Step").toString(),
//
data.get("Description").toString(),
//
parameter,
//
//
JSONObject.fromObject(ExpectResult).toString(),
//
re.getStatusCode()+"",
//
//
StringUtils.decodeUnicode(re==null?"":re.asString()),
//
StringUtils.decodeUnicode(body),
//
codeORerrcode,
//
msgORerrmsy,
//
result,
//
time
//
);
//
HashMap<String, Object> ExpectResult=MapUtil.Expect(data);
/*
SheetUtils sheet = new SheetUtils("DataAll.xls", "Output");
sheet.writeExcel(
data.get("NO").toString(),
data.get("TCNO").toString() + "_Step" + data.get("Step").toString(),
data.get("Description").toString(),
parameter,
// JSONObject.fromObject(ExpectResult).toString(),
re.getStatusCode()+"",
// StringUtils.decodeUnicode(re==null?"":re.asString()),
StringUtils.decodeUnicode(body),
codeORerrcode,
msgORerrmsy,
result,
time
);
*/
if
(
result
.
indexOf
(
"Fail"
)!=-
1
){
String
Expect1
=
data
.
get
(
"code"
)==
null
?
""
:
data
.
get
(
"code"
).
toString
();
String
Expect2
=
data
.
get
(
"msg"
)==
null
?
""
:
data
.
get
(
"msg"
).
toString
();
...
...
@@ -148,6 +148,16 @@ public class APITest_nwn extends NWN{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
try
{
if
(
stmt1
!=
null
){
stmt1
.
close
();
}
if
(
conn1
!=
null
){
conn1
.
close
();
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
Log
.
logInfo
(
"========测试结束========"
);
...
...
nwn_Api_auto_test/src/resources/class.properties
View file @
db44930a
...
...
@@ -2,4 +2,6 @@ xyzb=com.offcn.api.xyzb.
tk
=
com.offcn.api.tk.
nwn
=
com.offcn.api.nwn.
nwnht
=
com.offcn.api.nwn.
nwngg
=
com.offcn.api.nwn.
\ No newline at end of file
nwngg
=
com.offcn.api.nwn.
tkapp
=
com.offcn.api.tk.app
tkht
=
com.offcn.api.tk.ht
\ No newline at end of file
nwn_Api_auto_test/src/resources/reflect.properties
View file @
db44930a
/user/
register
=
register
/userInfo/bank/
save
=
bank_save
/userInfo/bank/
update
=
bank_update
/userInfo/bank/
change
=
bank_change
/userInfo/personal/
update
=
companyinfo
/userInfo/practitioner/
update
=
WorkerAndStudent
/userInfo/contacts/
save
=
contactsinfo_save
/userInfo/
contacts
=
userInfoContacts
/v1/customer/photo/
upload
=
photo_upload
/photo/list/=list
/v1/third/
getMoxieH5Url
=
getMoxieH5Url_app
/v1/customer/
identification
=
identification
/v1/customer/
modifyWorkerInfo
=
modifyWorkerInfo
/v1/customer/
modifyStudentInfo
=
modifyStudentInfo
/v1/customer/
canModify
=
canModify
/v1/customer/
isIdentified
=
isIdentified
/v1/customer/
queryInfo
=
queryInfo
/v1/customer/
schoolOptions
=
schoolOptions
/user/
resetPwd
=
resetPwd
/sms/
resetPwd
=
getResetPwd
/contract/
template
=
template
/v1/sms/
login
=
smsLogin
/user/
exchange
=
exchange
/v1/grab/
location
=
location
/v1/order/
confirm
=
orderConfirm
/v1/order/
cancel
=
cancelOrder
/v1/bill/
list
=
billList
/v1/bankcard/
check
=
check
/v1/bill/
detail
=
billDetail
/v1/bankcard/
getBankcard
=
getBankcard
/v1/customer/
licenses
=
licenses
/v1/
merchant
=
merchant
/v1/
order
=
order
/v1/order/
submit
=
submit
/city/
support
=
CitySupport
/user/send/code/
login
=
SendCodeLogin
/user/
login
=
login
/userInfo/
personal
=
Personal
/user/
twoSubmit
=
TwoSubmit
/userInfo/identity/
save
=
IdentitySaveAndUpdate
/userInfo/identity/
update
=
IdentitySaveAndUpdate
/buy/
save
=
Save
/userInfo/
identity
=
Identity
/userInfo/identity/
upload
=
IdentityUpload
/userInfo/
contacts
=
Contacts
/v1/grab/
contacts
=
contacts
/order/
list
=
OrderList
/order/status/
confirm
=
Confirm
/order/status/
cancel
=
OrderCancel
/order/
success
=
OrderSuccess
/order/
detail
=
OrderDetails
/order/
contract
=
Contract
/order/pwd/
isExist
=
PasswordExistance
/user/send/code/
setDeal
=
SetDeal
/user/mobileCodeConfirm/
setDeal
=
MobileCodeConfirm
/userCenter/setDealPwd/
save
=
DealPwdSave
/decision/
busiagree
=
BusiAgree
/userCenter/setDealPwd/
update
=
ResetDealPwd
/api/business/
hot
=
Hot
/api/business/
detail
=
BusinessDetail
/user/
getContacts
=
GetContacts
/user/
getCurCity
=
GetCurCity
/api/business/
getShareContent
=
GetShareContent
/api/business/detail/
pic
=
BusinessDetailPic
/user/
getLocation
=
GetLocation
/user/register/
sms
=
RegisterSms
/user/
exist
=
UserIfExist
/oauth/v1/receive/data/
rental
=
DataRental
/v1/order/
create
=
CreateOrder
/v1/procedure/
list
=
ProcedureList
/v1/order/
queryInfo
=
orderQreryInfo
/v1/channel/
queryConfig
=
queryConfig
/oauth/v1/receive/data/
rental
=
rental
\ No newline at end of file
/admin/template/
addChildModuleMovie
=
addChildModuleMovie_template
\ No newline at end of file
nwn_Api_auto_test/src/resources/system.xml
View file @
db44930a
...
...
@@ -81,6 +81,22 @@
<sqlpwd>
Beta@
&
123
</sqlpwd>
</system>
<system
name=
"nwn_template"
>
<!-- nwn -->
<access_token_uri>
http://106.75.5.205:8082/uaa/oauth/token
</access_token_uri>
<client_id>
bestbuy-acceptance
</client_id>
<client_secret>
bestbuy-acceptance
</client_secret>
<grant_type>
client_credentials
</grant_type>
<isProduct>
false
</isProduct>
<RM_URI>
http://beta.alitest.eoffcn.com
</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>
10.10.229.48
</redis_URI>
<redis_db_index>
5
</redis_db_index>
<sqlurl>
jdbc:mysql://39.105.124.219:3312/nwn_template?useUnicode=true
&
characterEncoding=UTF-8
&
zeroDateTimeBehavior=convertToNull
</sqlurl>
<sqlname>
nwnBeta
</sqlname>
<sqlpwd>
Beta@
&
123
</sqlpwd>
</system>
<system
name=
"nwnht"
>
<!-- nwn后台 -->
<access_token_uri>
http://106.75.5.205:8082/uaa/oauth/token
</access_token_uri>
<client_id>
bestbuy-acceptance
</client_id>
...
...
nwn_Api_auto_test/src/test/test.java
View file @
db44930a
package
test
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.offcn.process.NWN
;
public
class
test
{
public
class
test
{
public
static
void
main
(
String
[]
args
)
{
String
res1
=
"page=1&size=10&username=code&phone=code&card_no=code&status=1"
;
String
sss
=
getParameter_get
(
res1
,
"size"
);
System
.
out
.
println
(
sss
);
String
year
=
getCurrentYear
();
System
.
out
.
println
(
year
);
}
//在parameter中获取get请求中的参数
public
static
String
getCurrentYear
(){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy"
);
Date
date
=
new
Date
();
return
sdf
.
format
(
date
);
}
//在parameter中获取get请求中的参数
public
static
String
getParameter_get
(
String
parameter
,
String
Letter
){
if
(
parameter
==
null
){
return
""
;
...
...
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