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
bb911049
Commit
bb911049
authored
Nov 16, 2018
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into wxs
parents
4e5e519a
4ea97b43
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
787 additions
and
44 deletions
+787
-44
AbstractTestNGSpringContextTestsDuiba.java
...test/java/base/AbstractTestNGSpringContextTestsDuiba.java
+171
-0
DuibaBase.java
src/test/java/base/DuibaBase.java
+4
-2
DuibaBases.java
src/test/java/base/DuibaBases.java
+24
-0
SuiteResult.java
src/test/java/base/SuiteResult.java
+1
-1
自有答题测试_DuibaTest.java
src/test/java/http/cases/DeveloperTest/自有答题测试_DuibaTest.java
+3
-9
CheckTemplet.java
src/test/java/http/cases/ExchangeTest/CheckTemplet.java
+104
-0
Exchange_ExchangeTest.java
...t/java/http/cases/ExchangeTest/Exchange_ExchangeTest.java
+4
-2
ObjectExchange_ExchangeTest.java
.../http/cases/ExchangeTest/ObjectExchange_ExchangeTest.java
+3
-3
Qb_兑换流程测试_ExchangeTest.java
.../java/http/cases/ExchangeTest/Qb_兑换流程测试_ExchangeTest.java
+1
-2
优惠券_兑换异常测试_ExchangeTest.java
...java/http/cases/ExchangeTest/优惠券_兑换异常测试_ExchangeTest.java
+2
-10
优惠券_兑换流程测试_ExchangeTest.java
...java/http/cases/ExchangeTest/优惠券_兑换流程测试_ExchangeTest.java
+1
-2
商品订单失败测试_ExchangeTest.java
...t/java/http/cases/ExchangeTest/商品订单失败测试_ExchangeTest.java
+1
-2
实物_兑换异常测试_ExchangeTest.java
.../java/http/cases/ExchangeTest/实物_兑换异常测试_ExchangeTest.java
+1
-2
平台券_兑换流程测试_ExchangeTest.java
...java/http/cases/ExchangeTest/平台券_兑换流程测试_ExchangeTest.java
+1
-2
开发者账户余额校验测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/开发者账户余额校验测试_ExchangeTest.java
+1
-2
支付宝_兑换流程测试_ExchangeTest.java
...java/http/cases/ExchangeTest/支付宝_兑换流程测试_ExchangeTest.java
+1
-2
虚拟商品_兑换异常测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
+0
-0
奖品发放限制_DuibaTest.java
...est/java/http/cases/NewActivityTest/奖品发放限制_DuibaTest.java
+1
-1
签到管理_DuibaTest.java
...est/java/http/cases/SaasDeveloperTest/签到管理_DuibaTest.java
+90
-0
计划任务.java
src/test/java/http/cases/SaasDeveloperTest/计划任务.java
+1
-1
种红包配置校验_AccessTest.java
src/test/java/http/cases/WalletTest/种红包配置校验_AccessTest.java
+84
-0
账户余额清零_AccessTest.java
src/test/java/http/cases/WalletTest/账户余额清零_AccessTest.java
+16
-1
SeedRedPacketService.java
...test/java/http/service/Activity/SeedRedPacketService.java
+15
-0
SignService.java
src/test/java/http/service/Saas/SignService.java
+235
-0
VirtualExchangeService.java
src/test/java/http/service/app/VirtualExchangeService.java
+22
-0
No files found.
src/test/java/base/AbstractTestNGSpringContextTestsDuiba.java
0 → 100644
View file @
bb911049
package
base
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.test.context.TestContextManager
;
import
org.springframework.test.context.TestExecutionListeners
;
import
org.springframework.test.context.support.DependencyInjectionTestExecutionListener
;
import
org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
;
import
org.springframework.test.context.support.DirtiesContextTestExecutionListener
;
import
org.springframework.test.context.web.ServletTestExecutionListener
;
import
org.testng.IHookCallBack
;
import
org.testng.IHookable
;
import
org.testng.ITestResult
;
import
org.testng.annotations.*
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
/**
* Created by mabo on 2018/11/15
*/
@TestExecutionListeners
({
ServletTestExecutionListener
.
class
,
DirtiesContextBeforeModesTestExecutionListener
.
class
,
DependencyInjectionTestExecutionListener
.
class
,
DirtiesContextTestExecutionListener
.
class
})
public
abstract
class
AbstractTestNGSpringContextTestsDuiba
implements
IHookable
,
ApplicationContextAware
{
/** Logger available to subclasses */
protected
final
Log
logger
=
LogFactory
.
getLog
(
getClass
());
/**
* The {@link ApplicationContext} that was injected into this test instance
* via {@link #setApplicationContext(ApplicationContext)}.
*/
protected
ApplicationContext
applicationContext
;
private
final
TestContextManager
testContextManager
;
private
Throwable
testException
;
/**
* Construct a new AbstractTestNGSpringContextTests instance and initialize
* the internal {@link TestContextManager} for the current test.
*/
public
AbstractTestNGSpringContextTestsDuiba
()
{
this
.
testContextManager
=
new
TestContextManager
(
getClass
());
}
/**
* Set the {@link ApplicationContext} to be used by this test instance,
* provided via {@link ApplicationContextAware} semantics.
*
* @param applicationContext the ApplicationContext that this test runs in
*/
@Override
public
final
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
this
.
applicationContext
=
applicationContext
;
}
/**
* Delegates to the configured {@link TestContextManager} to call
* {@link TestContextManager#beforeTestClass() 'before test class'}
* callbacks.
*
* @throws Exception if a registered TestExecutionListener throws an
* exception
*/
@BeforeSuite
(
alwaysRun
=
true
)
protected
void
springTestContextBeforeTestSuite
()
throws
Exception
{
this
.
testContextManager
.
beforeTestClass
();
}
/**
* Delegates to the configured {@link TestContextManager} to
* {@link TestContextManager#prepareTestInstance(Object) prepare} this test
* instance prior to execution of any individual tests, for example for
* injecting dependencies, etc.
*
* @throws Exception if a registered TestExecutionListener throws an
* exception
*/
@BeforeSuite
(
alwaysRun
=
true
,
dependsOnMethods
=
"springTestContextBeforeTestSuite"
)
protected
void
springTestContextPrepareTestInstanceSuite
()
throws
Exception
{
this
.
testContextManager
.
prepareTestInstance
(
this
);
}
@BeforeClass
(
alwaysRun
=
true
)
protected
void
springTestContextBeforeTestClass
()
throws
Exception
{
this
.
testContextManager
.
beforeTestClass
();
}
/**
* Delegates to the configured {@link TestContextManager} to
* {@link TestContextManager#prepareTestInstance(Object) prepare} this test
* instance prior to execution of any individual tests, for example for
* injecting dependencies, etc.
*
* @throws Exception if a registered TestExecutionListener throws an
* exception
*/
@BeforeClass
(
alwaysRun
=
true
,
dependsOnMethods
=
"springTestContextBeforeTestClass"
)
protected
void
springTestContextPrepareTestInstance
()
throws
Exception
{
this
.
testContextManager
.
prepareTestInstance
(
this
);
}
/**
* Delegates to the configured {@link TestContextManager} to
* {@link TestContextManager#beforeTestMethod(Object, Method) pre-process}
* the test method before the actual test is executed.
*
* @param testMethod the test method which is about to be executed.
* @throws Exception allows all exceptions to propagate.
*/
@BeforeMethod
(
alwaysRun
=
true
)
protected
void
springTestContextBeforeTestMethod
(
Method
testMethod
)
throws
Exception
{
this
.
testContextManager
.
beforeTestMethod
(
this
,
testMethod
);
}
/**
* Delegates to the {@link IHookCallBack#runTestMethod(ITestResult) test
* method} in the supplied {@code callback} to execute the actual test
* and then tracks the exception thrown during test execution, if any.
*
* @see org.testng.IHookable#run(org.testng.IHookCallBack,
* org.testng.ITestResult)
*/
@Override
public
void
run
(
IHookCallBack
callBack
,
ITestResult
testResult
)
{
callBack
.
runTestMethod
(
testResult
);
Throwable
testResultException
=
testResult
.
getThrowable
();
if
(
testResultException
instanceof
InvocationTargetException
)
{
testResultException
=
((
InvocationTargetException
)
testResultException
).
getCause
();
}
this
.
testException
=
testResultException
;
}
/**
* Delegates to the configured {@link TestContextManager} to
* {@link TestContextManager#afterTestMethod(Object, Method, Throwable)
* post-process} the test method after the actual test has executed.
*
* @param testMethod the test method which has just been executed on the
* test instance
* @throws Exception allows all exceptions to propagate
*/
@AfterMethod
(
alwaysRun
=
true
)
protected
void
springTestContextAfterTestMethod
(
Method
testMethod
)
throws
Exception
{
try
{
this
.
testContextManager
.
afterTestMethod
(
this
,
testMethod
,
this
.
testException
);
}
finally
{
this
.
testException
=
null
;
}
}
/**
* Delegates to the configured {@link TestContextManager} to call
* {@link TestContextManager#afterTestClass() 'after test class'} callbacks.
*
* @throws Exception if a registered TestExecutionListener throws an
* exception
*/
@AfterSuite
(
alwaysRun
=
true
)
protected
void
springTestContextAfterTestSuite
()
throws
Exception
{
this
.
testContextManager
.
afterTestClass
();
}
@AfterClass
(
alwaysRun
=
true
)
protected
void
springTestContextAfterTestClass
()
throws
Exception
{
this
.
testContextManager
.
afterTestClass
();
}
}
src/test/java/base/DuibaBase.java
View file @
bb911049
...
...
@@ -12,13 +12,15 @@ import javax.annotation.PostConstruct;
* Created by mabo on 2018/9/20
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
DuibaBase
extends
AbstractTestNGSpringContextTests
{
public
class
DuibaBase
extends
AbstractTestNGSpringContextTests
Duiba
{
@Autowired
public
MysqlConnPool
jdbc
;
public
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@PostConstruct
// @PostConstruct
@BeforeSuite
public
void
setUp
()
{
logger
.
info
(
"--------------------DuibaBase.setUp()"
);
//只初始化一次
jdbc
.
initDataSource
();
...
...
src/test/java/base/DuibaBases.java
0 → 100644
View file @
bb911049
package
base
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.testng.annotations.BeforeSuite
;
/**
* Created by mabo on 2018/11/15
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
DuibaBases
extends
AbstractTestNGSpringContextTestsDuiba
{
@Autowired
public
MysqlConnPool
jdbc
;
public
DuibaLog
logger
=
DuibaLog
.
getLogger
();
// @PostConstruct
@BeforeSuite
public
void
setUp
()
{
logger
.
info
(
"--------------------DuibaBase.setUp()"
);
//只初始化一次
jdbc
.
initDataSource
();
}
}
src/test/java/base/SuiteResult.java
View file @
bb911049
...
...
@@ -4,7 +4,7 @@ import org.testng.IClass;
import
org.testng.ISuiteResult
;
import
org.testng.ITestResult
;
import
org.testng.Reporter
;
import
org.uncommons.reportng.HTMLReporter
;
//
import org.uncommons.reportng.HTMLReporter;
import
java.util.HashMap
;
import
java.util.List
;
...
...
src/test/java/http/cases/DeveloperTest/自有答题测试_DuibaTest.java
View file @
bb911049
...
...
@@ -102,15 +102,9 @@ public class 自有答题测试_DuibaTest extends DuibaTestBase {
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"rightCount"
),
"2"
,
"校验答题数失败"
);
logger
.
info
(
"校验答题正确数成功"
);
response
=
newActivityService
.
getOrderStatus
(
uid
,
orderId
);
//推啊出券系统检测
// if(activityService.isRunning("10.110.10.12","17791","tuia-engine")){
logger
.
info
(
"tuia-engine服务启动成功"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.type"
),
"lucky"
,
"校验奖品类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.useBtnText"
),
"马上使用"
,
"校验奖品文案失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"result"
),
"2"
,
"校验抽奖结果失败"
);
// }else{
// logger.info("tuia-engine服务启动未成功,福袋降级成谢谢参与!");
// }
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.type"
),
"object"
,
"校验奖品类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.link"
).
contains
(
"/activity/takePrizeNew?recordId="
),
true
,
"校验奖品跳转链接失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"result"
),
"2"
,
"校验抽奖结果失败"
);
break
;
case
2
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"rightCount"
),
"1"
,
"校验答题数失败"
);
...
...
src/test/java/http/cases/ExchangeTest/CheckTemplet.java
0 → 100644
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaBases
;
import
http.service.app.SupplierExchangeTemplateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.annotations.BeforeSuite
;
import
java.util.Map
;
/**
* Created by zhaoran on 2018/11/15
* Remark: 校验Q币、虚拟商品兑换模板
*/
public
class
CheckTemplet
extends
DuibaBases
{
@Autowired
SupplierExchangeTemplateService
supplierExchangeTemplateService
;
@BeforeSuite
public
void
setTemplet
()
throws
Exception
{
logger
.
info
(
"------------------------setTemplet()"
);
this
.
setVirtual
();
Thread
.
sleep
(
1000
);
this
.
setQb
();
}
public
void
setVirtual
()
throws
Exception
{
//校验数据库supplier_exchange_template是否存在“虚拟商品充值成功”选项
Map
<
String
,
Object
>
selectResult
=
jdbc
.
findSimpleResult
(
"select count(*) from dafuweng.supplier_exchange_template where name = '虚拟商品充值成功' "
);
String
count
=
String
.
valueOf
(
selectResult
.
get
(
"count(*)"
));
if
(
count
.
equals
(
"0"
))
{
logger
.
info
(
"supplier_exchange_template不存在虚拟商品充值成功选项"
);
jdbc
.
update
(
"INSERT INTO `dafuweng`.`supplier_exchange_template` ( `version`, `gmt_create`, `gmt_modified`, `name`, `notify_content`, `notify_delay`, `ret_content`, `ret_type`, `supplier_type`) VALUES ('1', '2015-06-10 13:24:34', '2015-06-11 10:37:54', '虚拟商品充值成功', '', '0', '{status:\\\"success\\\",credits:\\\"10000\\\",supplierBizId:\\\"no123456\\\"}', '6', 'exchange-virtual');"
);
Map
<
String
,
Object
>
selectResult2
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.supplier_exchange_template where name = '虚拟商品充值成功' "
);
String
templetId
=
String
.
valueOf
(
selectResult2
.
get
(
"id"
));
Map
<
String
,
Object
>
selectResult3
=
jdbc
.
findSimpleResult
(
"select count(*) from dafuweng.supplier where supplier_type = 'exchange-virtual' "
);
String
count2
=
String
.
valueOf
(
selectResult3
.
get
(
"count(*)"
));
if
(
count2
.
equals
(
"0"
))
{
logger
.
info
(
"supplier不存在虚拟商品兑换模板"
);
jdbc
.
update
(
"INSERT INTO `dafuweng`.`supplier` (`version`, `callback_url`, `gmt_create`, `gmt_modified`, `name`, `supplier_exchange_template_id`, `supplier_type`) VALUES ( '71', 'http://trade.m.duibatest.com.cn/Confirm/Confirm', '2015-06-10 13:17:45', '2018-11-15 09:56:11', '虚拟商品充值', '534', 'exchange-virtual')"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
else
{
logger
.
info
(
"supplier存在虚拟商品兑换模板"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
}
else
{
logger
.
info
(
"supplier_exchange_template存在虚拟商品充值成功选项"
);
Map
<
String
,
Object
>
selectResult2
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.supplier_exchange_template where name = '虚拟商品充值成功' "
);
String
templetId
=
String
.
valueOf
(
selectResult2
.
get
(
"id"
));
//校验supplier是否存在exchange-virtual选项
Map
<
String
,
Object
>
selectResult3
=
jdbc
.
findSimpleResult
(
"select count(*) from dafuweng.supplier where supplier_type = 'exchange-virtual' "
);
String
count2
=
String
.
valueOf
(
selectResult3
.
get
(
"count(*)"
));
if
(
count2
.
equals
(
"0"
))
{
logger
.
info
(
"supplier不存在虚拟商品兑换模板"
);
jdbc
.
update
(
"INSERT INTO `dafuweng`.`supplier` (`version`, `callback_url`, `gmt_create`, `gmt_modified`, `name`, `supplier_exchange_template_id`, `supplier_type`) VALUES ( '71', 'http://trade.m.duibatest.com.cn/Confirm/Confirm', '2015-06-10 13:17:45', '2018-11-15 09:56:11', '虚拟商品充值', '534', 'exchange-virtual')"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
else
{
logger
.
info
(
"supplier存在虚拟商品兑换模板"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
}
}
public
void
setQb
()
throws
Exception
{
//校验数据库supplier_exchange_template是否存在“虚拟商品充值成功”选项
Map
<
String
,
Object
>
selectResult
=
jdbc
.
findSimpleResult
(
"select count(*) from dafuweng.supplier_exchange_template where name = '开心果Q币-处理后成功' "
);
String
count
=
String
.
valueOf
(
selectResult
.
get
(
"count(*)"
));
if
(
count
.
equals
(
"0"
))
{
logger
.
info
(
"supplier_exchange_template不存在Qb充值成功选项"
);
jdbc
.
update
(
"INSERT INTO `dafuweng`.`supplier_exchange_template` ( `version`, `gmt_create`, `gmt_modified`, `name`, `notify_content`, `notify_delay`, `ret_content`, `ret_type`, `supplier_type`) VALUES ('0', '2018-08-07 10:21:25', '2018-08-07 17:22:08', '开心果Q币-处理后成功', 'account_no=102790481&face_price=100&order_no=${duibaOrderNum}&order_time=test20180101001&order_type=10&partner_id=test&pay_money=98&profit=0.00&sign_type=MD5&status=SUCCESS&stream_id=${duibaOrderNum}&sign=ee17945bc4457a059f5679ca8fdce9be', '5000', '{\\\"result\\\":{\\\"ret_code\\\":\\\"10000000\\\",\\\"ret_msg\\\":\\\"交易成功\\\"},\\\"body\\\":{\\\"order_no\\\":\\\"${duibaOrderNum}\\\",\\\"stream_id\\\":\\\"${duibaOrderNum}\\\",\\\"order_time\\\":\\\"20180806174326\\\",\\\"number\\\":\\\"1\\\",\\\"pay_money\\\":\\\"0.94\\\"}}', '1', 'qb-kaixin')"
);
Map
<
String
,
Object
>
selectResult2
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.supplier_exchange_template where name = '开心果Q币-处理后成功' "
);
String
templetId
=
String
.
valueOf
(
selectResult2
.
get
(
"id"
));
Map
<
String
,
Object
>
selectResult3
=
jdbc
.
findSimpleResult
(
"select count(*) from dafuweng.supplier where supplier_type = 'qb-kaixin' "
);
String
count2
=
String
.
valueOf
(
selectResult3
.
get
(
"count(*)"
));
if
(
count2
.
equals
(
"0"
))
{
logger
.
info
(
"supplier不存在Qb兑换模板"
);
jdbc
.
update
(
"INSERT INTO `dafuweng`.`supplier` ( `version`, `callback_url`, `gmt_create`, `gmt_modified`, `name`, `supplier_exchange_template_id`, `supplier_type`) VALUES ( '0', 'http://trade.m.duibatest.com.cn/taw/QbExchange/callbackFromKaixinQb', '2018-08-07 11:57:46', '2018-11-15 09:56:24', '开心果Q币', '554', 'qb-kaixin')"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
else
{
logger
.
info
(
"supplier存在Qb兑换模板"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
}
else
{
logger
.
info
(
"supplier_exchange_template存在Qb充值成功选项"
);
Map
<
String
,
Object
>
selectResult2
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.supplier_exchange_template where name = '开心果Q币-处理后成功' "
);
String
templetId
=
String
.
valueOf
(
selectResult2
.
get
(
"id"
));
//校验supplier是否存在exchange-virtual选项
Map
<
String
,
Object
>
selectResult3
=
jdbc
.
findSimpleResult
(
"select count(*) from dafuweng.supplier where supplier_type = 'qb-kaixin' "
);
String
count2
=
String
.
valueOf
(
selectResult3
.
get
(
"count(*)"
));
if
(
count2
.
equals
(
"0"
))
{
logger
.
info
(
"supplier不存在Qb兑换模板"
);
jdbc
.
update
(
"INSERT INTO `dafuweng`.`supplier` ( `version`, `callback_url`, `gmt_create`, `gmt_modified`, `name`, `supplier_exchange_template_id`, `supplier_type`) VALUES ( '0', 'http://trade.m.duibatest.com.cn/taw/QbExchange/callbackFromKaixinQb', '2018-08-07 11:57:46', '2018-11-15 09:56:24', '开心果Q币', '554', 'qb-kaixin')"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
else
{
logger
.
info
(
"supplier存在Qb兑换模板"
);
supplierExchangeTemplateService
.
use
(
templetId
);
}
}
}
}
src/test/java/http/cases/ExchangeTest/Exchange_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.CouponExchangeService
;
...
...
@@ -18,7 +17,7 @@ import org.testng.annotations.Test;
import
java.util.Map
;
//@ContextConfiguration(classes = DuibaConfig.class)
public
class
Exchange_ExchangeTest
extends
DuibaTestBase
{
public
class
Exchange_ExchangeTest
extends
CheckTemplet
{
@Value
(
"${manager.host}"
)
String
ManagerHost
;
@Autowired
...
...
@@ -50,11 +49,14 @@ public class Exchange_ExchangeTest extends DuibaTestBase{
// }
//实物兑换并发货
@Test
(
description
=
"实物兑换"
)
public
void
goods
()
throws
Exception
{
//查询数据库,当前积分
logger
.
info
(
"----------------------------jdbc:"
+
jdbc
);
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid
);
String
credits
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"兑换前积分:"
+
credits
);
...
...
src/test/java/http/cases/ExchangeTest/ObjectExchange_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.*
;
...
...
@@ -22,7 +21,7 @@ import java.util.Map;
* Created by yeqinqin on 2018/4/24.
*/
public
class
ObjectExchange_ExchangeTest
extends
DuibaTestBase
{
public
class
ObjectExchange_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
...
...
@@ -507,7 +506,7 @@ public class ObjectExchange_ExchangeTest extends DuibaTestBase{
credits
=
String
.
valueOf
(
Integer
.
valueOf
(
credits
)
-
100
);
//兑换详情页
Response
response
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"55"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
);
//
Map<String, String> map = authorization.dafuwengLogin(uid);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"活动详情页请求异常"
);
//支付宝(1元)兑换
response
=
couponExchangeService
.
alipayExchange
(
uid
,
"55"
);
...
...
@@ -544,6 +543,7 @@ public class ObjectExchange_ExchangeTest extends DuibaTestBase{
}
//查询数据库,获取当前积分
Thread
.
sleep
(
2000
);
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid
);
String
creditsNew
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"兑换后积分:"
+
creditsNew
);
...
...
src/test/java/http/cases/ExchangeTest/Qb_兑换流程测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.*
;
...
...
@@ -26,7 +25,7 @@ import java.util.Map;
/**
* Created by mabo on 2018/9/13
*/
public
class
Qb_
兑换流程测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
Qb_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
@Autowired
...
...
src/test/java/http/cases/ExchangeTest/优惠券_兑换
流程测试pyl
_ExchangeTest.java
→
src/test/java/http/cases/ExchangeTest/优惠券_兑换
异常测试
_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.CouponExchangeService
;
...
...
@@ -13,17 +12,9 @@ import http.service.hd.DsOrderService;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
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.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
...
...
@@ -32,7 +23,8 @@ import static io.restassured.RestAssured.given;
* Created by panyuli on 2018/07/06.
*/
public
class
优惠券
_
兑换流程测试
pyl_ExchangeTest
extends
DuibaTestBase
{
public
class
优惠券
_
兑换异常测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
...
...
src/test/java/http/cases/ExchangeTest/优惠券_兑换流程测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
utils.RedisUtil
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
...
...
@@ -25,7 +24,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2018/07/06.
*/
public
class
优惠券
_
兑换流程测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
优惠券
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
...
...
src/test/java/http/cases/ExchangeTest/商品订单失败测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.AlipayExchangeService
;
...
...
@@ -21,7 +20,7 @@ import java.util.Map;
* Created by lvwenyan on 2018/06/08.
*/
public
class
商品订单失败测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
商品订单失败测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
...
...
src/test/java/http/cases/ExchangeTest/实物_兑换异常测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.CouponExchangeService
;
...
...
@@ -21,7 +20,7 @@ import java.util.Map;
/**
* Created by yeqinqin on 2018/6/11.
*/
public
class
实物
_
兑换异常测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
实物
_
兑换异常测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
...
...
src/test/java/http/cases/ExchangeTest/平台券_兑换流程测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Authorization
;
import
http.service.app.AppPlatformCouponService
;
import
http.service.app.CrecordService
;
...
...
@@ -24,7 +23,7 @@ import static io.restassured.RestAssured.given;
*/
//@ContextConfiguration(classes = DuibaConfig.class)
public
class
平台券
_
兑换流程测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
平台券
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
AppPlatformCouponService
appPlatformCouponService
;
...
...
src/test/java/http/cases/ExchangeTest/开发者账户余额校验测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.*
;
...
...
@@ -22,7 +21,7 @@ import java.util.Map;
* 测试开发者账号:zhaoran@duiba.com.cn , 用户uid:4386
*/
public
class
开发者账户余额校验测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
开发者账户余额校验测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
...
...
src/test/java/http/cases/ExchangeTest/支付宝_兑换流程测试_ExchangeTest.java
View file @
bb911049
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Authorization
;
import
http.service.Manager.ADeveloperService
;
import
http.service.app.AlipayExchangeService
;
...
...
@@ -25,7 +24,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2018/08/24.
*/
public
class
支付宝
_
兑换流程测试
_ExchangeTest
extends
DuibaTestBase
{
public
class
支付宝
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
AlipayExchangeService
alipayExchangeService
;
...
...
src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
View file @
bb911049
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/NewActivityTest/奖品发放限制_DuibaTest.java
View file @
bb911049
...
...
@@ -76,7 +76,7 @@ public class 奖品发放限制_DuibaTest extends DuibaTestBase {
//第一次抽奖
Response
response
=
this
.
新活动工具接口传参
(
"35920"
,
"adsdas"
,
"iOS"
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"lottery.type"
)),
"phonebill"
,
"第一次抽奖出奖类型失败"
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"lottery.type"
)),
"phonebill"
,
"第一次抽奖出奖类型失败
,请考虑是否activity-access-web发布了master分支所导致
"
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"lottery.title"
)),
"话费"
,
"第一次抽奖出奖title失败"
);
//第二次抽奖
...
...
src/test/java/http/cases/SaasDeveloperTest/签到管理_DuibaTest.java
0 → 100644
View file @
bb911049
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
http.service.Saas.SignService
;
import
utils.PublicMethod
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
/**
* Created by humengxin on 2018/11/13.
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
签到管理
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
SignService
signService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Test
(
description
=
"新建签到活动"
)
public
void
a_
新建签到活动
()
throws
Exception
{
signService
.
find
();
//保存
signService
.
save
();
signService
.
findConfigById
();
signService
.
configEdit
();
signService
.
find
();
}
@Test
(
description
=
"预览签到活动"
)
public
void
b_
预览签到活动
()
throws
Exception
{
Response
response
=
signService
.
link
();
}
@Test
(
description
=
"获取链接"
)
public
void
c_
获取链接
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//查询实物商品集合
Response
response
=
signService
.
getSignActivityUrl
();
//查看商品列表确认是否上架成功
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.isContainsCreditsRemainQueryUrl"
),
"true"
,
"校验获取链接失败"
);
logger
.
info
(
"校验获取链接成功"
);
}
@Test
(
description
=
"编辑签到活动"
)
public
void
d_
编辑签到活动
()
throws
Exception
{
signService
.
findConfigById
();
signService
.
configEdit
();
signService
.
find
();
}
@Test
(
description
=
"查询总签到个数"
)
public
void
e_
查询总签到个数
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
signService
.
selectsignOperList
();
//查看签到列表个数是否成功
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
),
"90"
,
"校验签到id失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.params.total"
),
"1"
,
"校验总个数失败"
);
logger
.
info
(
"校验签到总个数成功"
);
}
@Test
(
description
=
"删除签到"
)
public
void
f_
删除签到
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
signService
.
selectsignOperList
();
String
id
=
response
.
jsonPath
().
getString
(
"data.list[0].signOperatingId"
);
//查看签到列表个数是否成功
Response
response1
=
signService
.
deleteSignOperatingById
(
id
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.message"
),
"删除成功!"
,
"校验删除成功失败"
);
logger
.
info
(
"校验删除成功"
);
}
}
\ No newline at end of file
src/test/java/http/cases/SaasDeveloperTest/计划任务
_DuibaTest
.java
→
src/test/java/http/cases/SaasDeveloperTest/计划任务.java
View file @
bb911049
...
...
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
计划任务
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
public
class
计划任务
extends
AbstractTestNGSpringContextTests
{
@Autowired
PlannedTaskService
plannedTaskService
;
...
...
src/test/java/http/cases/WalletTest/种红包配置校验_AccessTest.java
0 → 100644
View file @
bb911049
package
http
.
cases
.
WalletTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.SeedRedPacketService
;
import
http.service.Activity.WalletAccountService
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
utils.RedisUtil
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by mabo on 2018/8/15
*/
public
class
种红包配置校验
_AccessTest
extends
DuibaTestBase
{
@Autowired
SeedRedPacketService
seedRedPacketService
;
@Autowired
WalletAccountService
walletAccountService
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
4689
;
private
static
int
uid2
=
4552
;
@Test
public
void
出券开关校验
_
开
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//校验种红包配置
Response
response
=
seedRedPacketService
.
getExtConfig
(
cookies
);
String
adPositions
=
response
.
jsonPath
().
getString
(
"data.adPositions"
);
String
adSwitch
=
response
.
jsonPath
().
getString
(
"data.adSwitch"
);
String
drawNumDaily
=
response
.
jsonPath
().
getString
(
"data.drawNumDaily"
);
String
decrBeginTime
=
response
.
jsonPath
().
getString
(
"data.decrBeginTime"
);
String
decrSwitch
=
response
.
jsonPath
().
getString
(
"data.decrSwitch"
);
String
seedCreditsPrice
=
response
.
jsonPath
().
getString
(
"data.seedCreditsPrice"
);
String
stealRedPacketSwitch
=
response
.
jsonPath
().
getString
(
"data.stealRedPacketSwitch"
);
String
unlockLandCreditsPrice
=
response
.
jsonPath
().
getString
(
"data.unlockLandCreditsPrice"
);
Assert
.
assertEquals
(
adPositions
,
"1,2,3"
,
"发券位置校验异常"
);
Assert
.
assertEquals
(
adSwitch
,
"true"
,
"种红包发券开关校验异常"
);
Assert
.
assertEquals
(
drawNumDaily
,
"20"
,
"每日中奖个数校验异常"
);
Assert
.
assertEquals
(
decrSwitch
,
"true"
,
"种红包衰减开关校验异常"
);
Assert
.
assertEquals
(
decrBeginTime
,
"1"
,
"衰减时间校验异常"
);
Assert
.
assertEquals
(
seedCreditsPrice
,
"1"
,
"种红包种植单价校验异常"
);
Assert
.
assertEquals
(
stealRedPacketSwitch
,
"false"
,
"偷红包开关校验异常"
);
Assert
.
assertEquals
(
unlockLandCreditsPrice
,
"300"
,
"解锁土地所需积分校验异常"
);
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
出券开关校验
_
关
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid2
);
//校验种红包配置
Response
response
=
seedRedPacketService
.
getExtConfig
(
cookies
);
response
.
prettyPrint
();
String
adPositions
=
response
.
jsonPath
().
getString
(
"data.adPositions"
);
String
adSwitch
=
response
.
jsonPath
().
getString
(
"data.adSwitch"
);
String
decrBeginTime
=
response
.
jsonPath
().
getString
(
"data.decrBeginTime"
);
String
decrSwitch
=
response
.
jsonPath
().
getString
(
"data.decrSwitch"
);
Assert
.
assertNull
(
adPositions
,
"发券位置校验异常"
);
Assert
.
assertEquals
(
adSwitch
,
"false"
,
"种红包开关校验异常"
);
Assert
.
assertEquals
(
decrSwitch
,
"false"
,
"种红包衰减开关校验异常"
);
Assert
.
assertNull
(
decrBeginTime
,
"衰减时间校验异常"
);
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
}
src/test/java/http/cases/WalletTest/账户余额清零_AccessTest.java
View file @
bb911049
...
...
@@ -121,8 +121,23 @@ public class 账户余额清零_AccessTest extends DuibaTestBase {
}
@Test
(
description
=
"老用户进入积分商城获得的金额不过期"
)
public
void
c_
金额不过期测试
()
throws
Exception
{
//账户充值100
walletAccountService
.
updateConsumerAccount
(
consumerId
,
"6"
,
"100"
);
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//调用获取getWalletAccount,获取账户金额
Response
response
=
walletAccountService
.
getWalletAccount
(
cookies
);
String
balanceAmount
=
response
.
jsonPath
().
getString
(
"balanceAmount"
);
logger
.
info
(
"当前账户余额为:"
+
balanceAmount
);
//校验,与数据对比
Assert
.
assertTrue
(
new
BigDecimal
(
balanceAmount
).
compareTo
(
new
BigDecimal
(
"1"
))==
0
,
"钱包账户余额校验失败"
);
logger
.
info
(
"钱包账户余额校验失败"
);
}
@Test
(
description
=
"过期日前账户余额=0"
)
public
void
c
_
账户过期余额清零
2
()
throws
Exception
{
public
void
d
_
账户过期余额清零
2
()
throws
Exception
{
//修改账户过期时间,确保账户始终处于过期状态
jdbc
.
update
(
"update consumer_account_log.tb_expire_consumer_account set gmt_modified ='"
+
getTime
(-
1
)
+
"' where account_id = '"
+
consumerId2
+
"_6_0'"
);
...
...
src/test/java/http/service/Activity/SeedRedPacketService.java
View file @
bb911049
...
...
@@ -131,6 +131,21 @@ public class SeedRedPacketService {
return
response
;
}
public
Response
getExtConfig
(
Map
cookies
)
throws
Exception
{
logger
.
info
(
"请求getExtConfig接口"
);
Response
response
=
given
().
cookies
(
cookies
).
get
(
activityHost
+
"/seedRedPacket/getExtConfig"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/seedRedPacket/getExtConfig接口失败"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/seedRedPacket/getExtConfig接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/seedRedPacket/getExtConfig接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
/**
* 修改土地解锁状态后门
* @param appId
...
...
src/test/java/http/service/Saas/SignService.java
0 → 100644
View file @
bb911049
package
http
.
service
.
Saas
;
import
base.DuibaLog
;
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.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by humengxin on 2018/11/13.
*/
@Service
public
class
SignService
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//7查询签到管理列表数据:appid=19515
public
Response
selectsignOperList
()
throws
Exception
{
String
url
=
hdHost
+
"/saas/selectsignOperList"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"appId"
,
"19515"
);
logger
.
info
(
"查询签到管理列表数据url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"查询签到管理列表数据接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"查询签到管理列表数据接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//5预览签到链接:appid=20979
public
Response
link
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/preview/link"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"2"
);
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"activityId"
,
"90"
);
map
.
put
(
"skinId"
,
"51"
);
logger
.
info
(
"预览签到链接url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"预览签到链接,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"预览签到链接接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//6获取链接接口
public
Response
getSignActivityUrl
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/getSignActivityUrl"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"id"
,
"90"
);
logger
.
info
(
"请求获取链接接口url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"获取链接接口接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"获取链接接口接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//3查询某款签到活动
public
Response
findConfigById
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/findConfigById"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"actId"
,
"90"
);
logger
.
info
(
"查询某款签到活动url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"查询某款签到活动接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"查询某款签到活动接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//4保存某款签到活动配置
public
Response
configEdit
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/configEdit"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"title"
,
"Saas开发者后台签到"
);
map
.
put
(
"description"
,
"<p>Saas开发者后台签到</p>"
);
map
.
put
(
"id"
,
"90"
);
map
.
put
(
"signRule"
,
"{\"acValidityType\":\"DAY\",\"cusCirType\":\"MONTH\",\"cusCirStart\":\"2018-06-15\",\"type\":\"CONTINUE\"}"
);
map
.
put
(
"reSignRule"
,
"{\"open\":true,\"dateUnit\":\"CUSTOM\",\"days\":30,\"conType\":\"NO\",\"credits\":null,\"card\":null,\"awardType\":\"NO\",\"countLimit\":\"30\",\"openAddLimit\":true,\"addLimitCycle\":null,\"addLimitCount\":null}"
);
map
.
put
(
"cntReward"
,
"{\"rwType\":\"CONTINUE\",\"plActSkinId\":null,\"plActId\":909,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"
);
map
.
put
(
"cirReward"
,
"{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"
);
map
.
put
(
"acmReward"
,
"{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"
);
map
.
put
(
"firstSignReward"
,
"{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"
);
map
.
put
(
"fullSignReward"
,
"{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}"
);
map
.
put
(
"firstSignReward"
,
"[]"
);
logger
.
info
(
"保存某款签到活动配置url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"保存某款签到活动配置接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"保存某款签到活动配置接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//1查询某款签到活动下绑定的皮肤
public
Response
find
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/activityskin/find"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"activityId"
,
"90"
);
map
.
put
(
"type"
,
"2"
);
logger
.
info
(
"查询某款签到活动下绑定的皮肤url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"查询某款签到活动下绑定的皮肤接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"查询某款签到活动下绑定的皮肤接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//2查询某款签到活动关联的签到皮肤
public
Response
save
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/save"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"activityId"
,
"90"
);
map
.
put
(
"type"
,
"2"
);
map
.
put
(
"activitySkinId"
,
"51"
);
logger
.
info
(
"查询某款签到活动关联的签到皮肤url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"查询某款签到活动关联的签到皮肤接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"查询某款签到活动关联的签到皮肤接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//8删除某款签到活动
public
Response
deleteSignOperatingById
(
String
id
)
throws
Exception
{
String
url
=
hdHost
+
"/saas/deleteSignOperatingById"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
logger
.
info
(
"删除某款签到活动url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"删除某款签到活动接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"删除某款签到活动接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
\ No newline at end of file
src/test/java/http/service/app/VirtualExchangeService.java
View file @
bb911049
...
...
@@ -42,4 +42,26 @@ public class VirtualExchangeService {
return
response
;
}
public
Response
exchange2
(
Map
cookies
,
String
appItemId
,
String
degreeId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"degreeId"
,
degreeId
);
map
.
put
(
"token"
,
"xz9eyi"
);
logger
.
info
(
"请求/virtualExchange/exchange接口"
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
goodsHost
+
"/virtualExchange/exchange"
);
//couponExchange
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/objectExchange/exchange接口返回异常"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
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