工作项目中用jmeter做接口测试,想尝试用python写接口测试(练习下python),

接口中好多字段都需要加密,而加密方法是java开发写的,打的jar包,这就需要考虑python调用java;

开始了一系列的百度、谷歌,使用jpype库,总算成功使用python调用java方法;

安装jpype,安装的时候输入  pip install jpype1 (后面要加一个1)

相关资料:

官方文档:https://jpype.readthedocs.io/en/latest/index.html、 

https://github.com/emcnany/berkeleyinterface

http://blog.csdn.net/liujingqiu/article/details/77933437

https://testerhome.com/topics/9374

https://www.cnblogs.com/mumuli/p/5806963.html

 

遇到问题:RuntimeError: No matching overloads found. at native\common\jp_method.cpp:117

原因:调用的java方法为静态方法, public static String encryptWithBase64(String string),静态方法不需要实例化,实例化后会报此错误

python调用jar包

注释掉实例化类后,执行成功:

python调用jar包

 

相关文章:

  • 2021-08-10
  • 2021-12-05
  • 2022-12-23
  • 2021-10-10
  • 2021-11-29
  • 2021-12-07
  • 2021-08-17
猜你喜欢
  • 2021-10-04
  • 2021-08-25
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2021-04-03
  • 2022-12-23
相关资源
相似解决方案