Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
ManningTest
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ManningTest
ManningTest
Commits
03debae3
Commit
03debae3
authored
Aug 11, 2022
by
xiongjunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[modify:1.bugfix]
parent
dd41845c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
145 additions
and
5 deletions
+145
-5
ExcelUtil.java
src/main/java/com/miya/manning/framework/util/ExcelUtil.java
+11
-3
TestCaseUtil.java
...in/java/com/miya/manning/framework/util/TestCaseUtil.java
+4
-1
TestUtil.java
src/main/java/com/miya/manning/framework/util/TestUtil.java
+1
-1
Delivery.java
src/main/java/com/miya/manning/test/flow/order/Delivery.java
+129
-0
Delivery.xls
src/main/resources/testcase/Delivery.xls
+0
-0
Delivery_process.xls
src/main/resources/testcase/Delivery_process.xls
+0
-0
add-delivery.xls
src/main/resources/testcase/data/order/add-delivery.xls
+0
-0
No files found.
src/main/java/com/miya/manning/framework/util/ExcelUtil.java
View file @
03debae3
...
...
@@ -137,11 +137,17 @@ public class ExcelUtil {
XSSFSheet
sheet
=
sheets
.
getSheet
(
sheet_name
);
int
count
=
ExcelUtil
.
getcount
(
sheet
);
XSSFRow
header_row
=
sheet
.
getRow
(
0
);
StringJoiner
obj
=
new
StringJoiner
(
""
,
""
,
""
);
if
(
type
==
1
){
//如果是array,需要额外拼接多个object,{obj1},{obj2}
obj
=
new
StringJoiner
(
","
,
""
,
""
);
}
if
(
count
!=
1
){
//如果只有一列说明引用数据为空,不需要补数据
//StringJoiner object = new StringJoiner("," , "{" , "}");//一个对象由{开始,以}结束
//只有内部的引用数据会有多行,length会大于1
StringJoiner
key_value
=
new
StringJoiner
(
","
,
"{"
,
"}"
);
//用来拼接key_value和key_value的
for
(
int
i
=
0
;
i
<
nums
.
length
;
i
++){
//key_value需要放到循环内,每一次封装成一个jsonobject
StringJoiner
key_value
=
new
StringJoiner
(
","
,
"{"
,
"}"
);
//用来拼接key_value和key_value的
XSSFRow
data_row
=
sheet
.
getRow
(
Integer
.
parseInt
(
nums
[
i
]));
if
(
ExcelUtil
.
IsRowEmpty
(
data_row
)){
log
.
error
(
"引用的数据行为空!请检查!"
);
...
...
@@ -241,17 +247,19 @@ public class ExcelUtil {
}
}
//object.add(key_value.toString());//至此一个对象拼接完成
obj
.
add
(
key_value
.
toString
());
}
}
//内层拼接完了,开始拼接最外层
if
(
sheet_name
.
contains
(
"(Array)"
)){
StringJoiner
array
=
new
StringJoiner
(
","
,
"["
,
"]"
);
//数组类型传参,类似["a":1]
array
.
add
(
key_value
.
toString
());
array
.
add
(
obj
.
toString
());
//System.out.println(array);
return
array
.
toString
();
}
//System.out.println(key_value);
return
key_value
.
toString
();
return
obj
.
toString
();
}
else
{
throw
new
RuntimeException
(
"没有引用数据!"
);
}
...
...
src/main/java/com/miya/manning/framework/util/TestCaseUtil.java
View file @
03debae3
...
...
@@ -15,6 +15,7 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -299,7 +300,9 @@ public class TestCaseUtil {
else
if
(
entry
.
getValue
()
instanceof
Integer
){
int_var_map
.
put
(
var
,(
Integer
)
entry
.
getValue
());
}
else
{
else
if
(
entry
.
getValue
()
instanceof
BigDecimal
){
string_var_map
.
put
(
var
,
entry
.
getValue
().
toString
());
}
else
{
string_var_map
.
put
(
var
,
(
String
)
entry
.
getValue
());
}
}
...
...
src/main/java/com/miya/manning/framework/util/TestUtil.java
View file @
03debae3
package
com
.
miya
.
manning
.
framework
.
util
;
import
com.miya.manning.test.flow.order.Express
;
import
com.miya.manning.vo.conditions.Condition
;
import
com.miya.manning.vo.scripts.Script
;
import
com.miya.manning.vo.testcase.TestCase
;
...
...
src/main/java/com/miya/manning/test/flow/order/Delivery.java
0 → 100644
View file @
03debae3
package
com
.
miya
.
manning
.
test
.
flow
.
order
;
import
com.miya.manning.framework.util.TestCaseUtil
;
import
com.miya.manning.framework.util.TestUtil
;
import
com.miya.manning.vo.conditions.Condition
;
import
com.miya.manning.vo.scripts.Script
;
import
com.miya.manning.vo.testcase.TestCase
;
import
org.apache.log4j.Logger
;
import
org.testng.annotations.*
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
/**
* @ProjectName: manning_test
* @Package: com.miya.manning.test.flow.order.Delivery
* @ClassName: Mainprocess
* @Description: 万宁物流模块测试
* @Author: 熊军奕
* @CreateDate: 2022/5/23 下午22:38
* @UpdateUser: 熊军奕
* @UpdateDate: 2022/5/23 下午22:38
*/
public
class
Delivery
{
static
Logger
logger
=
Logger
.
getLogger
(
Delivery
.
class
);
private
String
url_start
=
"https://cs2-uat.mannings.com.cn/"
;
private
String
script_path
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"target"
+
File
.
separator
+
"classes"
+
File
.
separator
+
"testcase"
+
File
.
separator
+
"Scripts"
+
File
.
separator
+
"Script.xls"
;
private
String
condition_path
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"target"
+
File
.
separator
+
"classes"
+
File
.
separator
+
"testcase"
+
File
.
separator
+
"Conditions"
+
File
.
separator
+
"Condition.xls"
;
private
String
path
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"target"
+
File
.
separator
+
"classes"
+
File
.
separator
+
"testcase"
+
File
.
separator
+
"Delivery.xls"
;
//private String path = "D:\\autotest\\test_liucheng\\test_liucheng\\huihua_saas1.xls";
private
Map
<
String
,
String
>
res_map
=
new
TreeMap
<>();
private
static
Map
<
String
,
Integer
>
int_var_map
=
new
HashMap
<>();
private
static
Map
<
String
,
String
>
string_var_map
=
new
HashMap
<>();
private
static
List
<
Script
>
Scripts
=
null
;
private
static
List
<
Condition
>
Conditions
=
null
;
@DataProvider
(
name
=
"ex"
)
public
Object
[][]
Parameter
(){
/*return new Object[][]{
{1,10, "200", "null", null},//查询券列表
{2,10, "200", "null", null},//查询券列表第二页
//{ "200", "null", null},//
};*/
Object
[][]
testcases
=
null
;
try
{
Scripts
=
TestCaseUtil
.
GetScripts
(
script_path
);
Conditions
=
TestCaseUtil
.
GetConditions
(
condition_path
);
testcases
=
TestCaseUtil
.
GetMain
(
path
);
}
catch
(
RuntimeException
e
)
{
logger
.
error
(
"error:"
,
e
);
}
return
testcases
;
}
@BeforeClass
public
void
setUp
()
{
logger
.
info
(
"闪送订单主流程测试开始!"
);
}
@AfterClass
public
void
tearDown
()
{
logger
.
info
(
"闪送订单主流程测试结束!"
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
res_map
.
entrySet
())
logger
.
info
(
entry
.
getKey
()
+
":"
+
entry
.
getValue
());
}
@BeforeMethod
public
void
before
(){
}
@Test
(
dataProvider
=
"ex"
)
public
void
Delivery
(
TestCase
testCase
)
throws
Exception
{
TestUtil
.
doTest
(
testCase
,
string_var_map
,
int_var_map
,
res_map
,
Scripts
,
Conditions
,
url_start
);
/*if (code == "200") {
Response response = new Response(final_res.getString("code"), final_res.getString("msg"), final_res.getJSONObject("data"));
JSONObject final_res_data = (JSONObject) response.getData();
Assert.assertEquals(response.getCode(), code);
Assert.assertEquals(response.getMsg(), msg);
String manufacturer_id =PropertiesHandle.readValue(StringUtil.httpHeader, "manufacturerId");
List<CouponConfigPO> couponGetPagelist = CouponSql.couponGetPage(manufacturer_id,pageNum,pageSize);
for (int i = 0; i< couponGetPagelist.size(); i++) {
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("manufacturerId"),couponGetPagelist.get(i).getManufacturerId());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("picUrl"),couponGetPagelist.get(i).getPicUrl());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponScene"),couponGetPagelist.get(i).getCouponScene());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponName"),couponGetPagelist.get(i).getCouponName());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponRights"),couponGetPagelist.get(i).getCouponRights());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponType"),couponGetPagelist.get(i).getCouponType());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponBatch"),couponGetPagelist.get(i).getCouponBatch());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("instructions"),couponGetPagelist.get(i).getInstructions());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("state"),couponGetPagelist.get(i).getState());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getInt("costScore"),couponGetPagelist.get(i).getCostScore());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getInt("userDailyGetLimit"),couponGetPagelist.get(i).getUserDailyGetLimit());
}
} else {
Response response = new Response(final_res.getString("code"), final_res.getString("msg"), final_res.getString("data"));
Assert.assertEquals(response.getCode(), code);
Assert.assertEquals(response.getMsg(), msg);
Assert.assertEquals(response.getData(), data);
}*/
}
}
src/main/resources/testcase/Delivery.xls
0 → 100644
View file @
03debae3
File added
src/main/resources/testcase/Delivery_process.xls
View file @
03debae3
No preview for this file type
src/main/resources/testcase/data/order/add-delivery.xls
View file @
03debae3
No preview for this file type
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