Skip to content

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

Notifications You must be signed in to change notification settings

yangtaihsou/pmock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'}}"

}

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published