You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dubbo_feng.py 926 B

2 years ago
1234567891011121314151617181920212223242526272829
  1. """
  2. @author: lileilei
  3. @file: dubbo_feng.py
  4. @time: 2018/3/29 12:26
  5. """
  6. from pyhessian.client import HessianProxy
  7. from pyhessian import protocol
  8. from public.log import LOG, logger
  9. @logger('dubbo接口')
  10. class DubboInterface:
  11. def __init__(self, url, interface, method, param, **kwargs):
  12. self.url = url
  13. self.interface = interface
  14. self.method = method
  15. self.param = param
  16. self.interfaceparam = protocol.object_factory(self.param, **kwargs)
  17. def getresult(self):
  18. try:
  19. result = HessianProxy(self.url + self.interface)
  20. return_result = getattr(result, self.method)(self.interfaceparam)
  21. LOG.info('测试返回结果:%s' % return_result)
  22. res = {'code': 0, 'result': return_result}
  23. except Exception as e:
  24. LOG.info('测试失败,原因:%s' % e)
  25. res = {'code': 1, 'result': e}
  26. return res

Introduction

生成接口测试报告

No topics