You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...
2022-03-21 21:28:33.329 [main] INFO vip.lematech.hrun4j.helper.LogHelper - 当前步骤:获取Token信息
2022-03-21 21:32:45.730 [main] INFO vip.lematech.hrun4j.helper.LogHelper - 请求地址:https://reqres.in/api/login
2022-03-21 21:32:45.732 [main] INFO vip.lematech.hrun4j.helper.LogHelper - 请求类型:POST
2022-03-21 21:32:47.088 [main] INFO vip.lematech.hrun4j.helper.LogHelper - 请求头:{password=5, contentType=application/json}
2022-03-21 21:32:55.875 [main] ERROR vip.lematech.hrun4j.helper.LogHelper - Unknown exception occurred in test case execution. Exception information:java.lang.Long cannot be cast to java.lang.String
vip.lematech.hrun4j.common.DefinedException
at vip.lematech.hrun4j.core.runner.TestCaseRunner.execute(TestCaseRunner.java:122)
at com.liyun.qa.edu.hrun4j.testcases.GetStartedTest.login(GetStartedTest.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
初步分析:headers 字段 Value 存入时使用的是 Object 类型,取用时使用的是 String 类型,存在类型转换风险。
测试用例 login.xml 如下:
报错信息:
初步分析:headers 字段 Value 存入时使用的是 Object 类型,取用时使用的是 String 类型,存在类型转换风险。
private Map<String, Object> headers;
,其中 Value 为 Object 类型。ExpProcessor#dynHandleContainsExpObject(T t)
方法在解析 Header Value 中的表达式时赋值代码如下:OkHttpsHelper#initRequestParameter
中取值代码逻辑如下:The text was updated successfully, but these errors were encountered: