青年IT男

个人从事金融行业,就职过易极付、思建科技、某网约车平台等重庆一流技术团队,目前就职于某银行负责统一支付系统建设。自身对金融行业有强烈的爱好。同时也实践大数据、数据存储、自动化集成和部署、分布式微服务、响应式编程、人工智能等领域。同时也热衷于技术分享创立公众号和博客站点对知识体系进行分享。微信公众号:青年IT男。

pmock项目mock工具

pmock项目mock工具

pmock

好用的mock框架,无侵入、零学习成本,case通过脚本语言配置。

mock example:

PersonBusinessService personBusinessService = mockObject(PersonBusinessDao.class). mockTarget(PersonBusinessServiceImpl.class). mockObject(PlayRpc.class). mockField(“playRpc”). mockField(“personBusinessDao”).target();

1 var personBusinessService is tested class object.

2 function mockTarget is uesed to instantiation the tested class: PersonBusinessService.

3 funtion mockObject is used to mock the Oject that mockTarget dependent on ,funtion mockField is used to establish mockObject.

4 groovy tested cas,queryShopping is the function of mockObject ,paraObj is input parameter of mockField,returned json data is reponse parameter of mockField.

case config example:

def queryShopping(paraObj) {

if (paraObj.name == ‘test’)
return “{‘person’:{‘name’:’shopping’}}”
}

Git地址:https://github.com/yangtaihsou/pmock.git

0
青年IT男

个人从事金融行业,就职过易极付、思建科技等重庆一流技术团队,目前就职于某网约车平台负责整个支付系统建设。自身对金融行业有强烈的爱好。同时也实践大数据、数据存储、自动化集成和部署、分布式微服务、响应式编程、人工智能等领域。

You must be logged in to post a comment

This site is protected by wp-copyrightpro.com