refactor(接口测试): 删除日志

This commit is contained in:
wxg0103 2023-06-29 14:49:32 +08:00 committed by wxg0103
parent 845f952331
commit 65e1f9b8af
1 changed files with 0 additions and 10 deletions

View File

@ -19,7 +19,6 @@ package org.apache.jmeter.assertions;
import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.JsonPath;
import io.metersphere.utils.DocumentUtils; import io.metersphere.utils.DocumentUtils;
import io.metersphere.utils.LoggerUtil;
import net.minidev.json.JSONArray; import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject; import net.minidev.json.JSONObject;
import net.minidev.json.JSONValue; import net.minidev.json.JSONValue;
@ -131,7 +130,6 @@ public class JSONPathAssertion extends AbstractTestElement implements Serializab
private void doAssert(String jsonString) { private void doAssert(String jsonString) {
Object value = JsonPath.read(jsonString, getJsonPath()); Object value = JsonPath.read(jsonString, getJsonPath());
LoggerUtil.info("json断言第一次拿到的值: " + value.toString());
if (!isJsonValidationBool()) { if (!isJsonValidationBool()) {
if (value instanceof JSONArray) { if (value instanceof JSONArray) {
JSONArray arrayValue = (JSONArray) value; JSONArray arrayValue = (JSONArray) value;
@ -237,7 +235,6 @@ public class JSONPathAssertion extends AbstractTestElement implements Serializab
private boolean isEquals(Object subj) { private boolean isEquals(Object subj) {
String str = DocumentUtils.objectToString(subj, decimalFormatter); String str = DocumentUtils.objectToString(subj, decimalFormatter);
LoggerUtil.info("json断言拿到的值: " + str);
if (StringUtils.equals(str,KEY_PRE)) { if (StringUtils.equals(str,KEY_PRE)) {
return false; return false;
} }
@ -246,7 +243,6 @@ public class JSONPathAssertion extends AbstractTestElement implements Serializab
return JMeterUtils.compilePattern(getExpectedValue()).matcher(str).matches(); return JMeterUtils.compilePattern(getExpectedValue()).matcher(str).matches();
} else { } else {
Pattern pattern = JMeterUtils.getPatternCache().getPattern(getExpectedValue()); Pattern pattern = JMeterUtils.getPatternCache().getPattern(getExpectedValue());
LoggerUtil.info("json断言正则表达式的结果: " + JMeterUtils.getMatcher().matches(str, pattern));
return JMeterUtils.getMatcher().matches(str, pattern); return JMeterUtils.getMatcher().matches(str, pattern);
} }
} else { } else {
@ -286,9 +282,6 @@ public class JSONPathAssertion extends AbstractTestElement implements Serializab
try { try {
Number number1 = NumberUtils.createBigDecimal(v1); Number number1 = NumberUtils.createBigDecimal(v1);
Number number2 = NumberUtils.createBigDecimal(v2); Number number2 = NumberUtils.createBigDecimal(v2);
LoggerUtil.info("json断言的值 " + number1.toString());
LoggerUtil.info("期望的值 " + number2.toString());
LoggerUtil.info("json断言比较的结果: " + number1.equals(number2));
return number1.equals(number2); return number1.equals(number2);
} catch (Exception e) { } catch (Exception e) {
return StringUtils.equals(v1, v2); return StringUtils.equals(v1, v2);
@ -299,9 +292,6 @@ public class JSONPathAssertion extends AbstractTestElement implements Serializab
try { try {
Number number1 = NumberUtils.createBigDecimal(v1); Number number1 = NumberUtils.createBigDecimal(v1);
Number number2 = NumberUtils.createBigDecimal(v2); Number number2 = NumberUtils.createBigDecimal(v2);
LoggerUtil.info("json断言的值 " + number1.toString());
LoggerUtil.info("期望的值 " + number2.toString());
LoggerUtil.info("json断言比较的结果: " + !number1.equals(number2));
return !number1.equals(number2); return !number1.equals(number2);
} catch (Exception e) { } catch (Exception e) {
return !StringUtils.equals(v1, v2); return !StringUtils.equals(v1, v2);