fix(接口自动化): 修复调试结果匹配问题,log日志不全问题,导出报错问题
This commit is contained in:
parent
45988d225e
commit
5673555d2d
|
@ -68,6 +68,9 @@ public class MsAssertions extends MsTestElement {
|
|||
ResponseAssertion assertion = new ResponseAssertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(assertionRegex.getDescription());
|
||||
if(StringUtils.isEmpty(assertionRegex.getDescription())){
|
||||
assertion.setName("AssertionRegex");
|
||||
}
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionRegex.getDescription()) ? assertionRegex.getDescription() : this.getName());
|
||||
assertion.setProperty(TestElement.TEST_CLASS, ResponseAssertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("AssertionGui"));
|
||||
|
@ -94,6 +97,9 @@ public class MsAssertions extends MsTestElement {
|
|||
JSONPathAssertion assertion = new JSONPathAssertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionJsonPath.getDescription()) ? assertionJsonPath.getDescription() : this.getName());
|
||||
if(StringUtils.isEmpty(assertion.getName())){
|
||||
assertion.setName("JSONPathAssertion");
|
||||
}
|
||||
/* assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSONPathAssertion");*/
|
||||
assertion.setProperty(TestElement.TEST_CLASS, JSONPathAssertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPathAssertionGui"));
|
||||
|
@ -115,6 +121,9 @@ public class MsAssertions extends MsTestElement {
|
|||
XPath2Assertion assertion = new XPath2Assertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionXPath2.getExpression()) ? assertionXPath2.getExpression() : this.getName());
|
||||
if(StringUtils.isEmpty(assertion.getName())){
|
||||
assertion.setName("XPath2Assertion");
|
||||
}
|
||||
/*assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "XPath2Assertion");*/
|
||||
assertion.setProperty(TestElement.TEST_CLASS, XPath2Assertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2AssertionGui"));
|
||||
|
@ -138,6 +147,9 @@ public class MsAssertions extends MsTestElement {
|
|||
JSR223Assertion assertion = new JSR223Assertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionJSR223.getDesc()) ? assertionJSR223.getDesc() : this.getName());
|
||||
if(StringUtils.isEmpty(assertion.getName())){
|
||||
assertion.setName("JSR223Assertion");
|
||||
}
|
||||
/*assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSR223Assertion");*/
|
||||
assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
|
|
|
@ -72,6 +72,9 @@ public class MsExtract extends MsTestElement {
|
|||
RegexExtractor extractor = new RegexExtractor();
|
||||
extractor.setEnabled(this.isEnable());
|
||||
extractor.setName(StringUtils.isNotEmpty(extractRegex.getVariable()) ? extractRegex.getVariable() : this.getName());
|
||||
if(StringUtils.isEmpty(extractor.getName())){
|
||||
extractor.setName("RegexExtractor");
|
||||
}
|
||||
/*extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " RegexExtractor");*/
|
||||
extractor.setProperty(TestElement.TEST_CLASS, RegexExtractor.class.getName());
|
||||
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("RegexExtractorGui"));
|
||||
|
@ -91,6 +94,9 @@ public class MsExtract extends MsTestElement {
|
|||
XPath2Extractor extractor = new XPath2Extractor();
|
||||
extractor.setEnabled(this.isEnable());
|
||||
extractor.setName(StringUtils.isNotEmpty(extractXPath.getVariable()) ? extractXPath.getVariable() : this.getName());
|
||||
if(StringUtils.isEmpty(extractor.getName())){
|
||||
extractor.setName("XPath2Extractor");
|
||||
}
|
||||
/*extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " XPath2Extractor");*/
|
||||
extractor.setProperty(TestElement.TEST_CLASS, XPath2Extractor.class.getName());
|
||||
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2ExtractorGui"));
|
||||
|
@ -107,6 +113,9 @@ public class MsExtract extends MsTestElement {
|
|||
JSONPostProcessor extractor = new JSONPostProcessor();
|
||||
extractor.setEnabled(this.isEnable());
|
||||
extractor.setName(StringUtils.isNotEmpty(extractJSONPath.getVariable()) ? extractJSONPath.getVariable() : this.getName());
|
||||
if(StringUtils.isEmpty(extractor.getName())){
|
||||
extractor.setName("JSONPostProcessor");
|
||||
}
|
||||
/*extractor.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : " JSONExtractor");*/
|
||||
extractor.setProperty(TestElement.TEST_CLASS, JSONPostProcessor.class.getName());
|
||||
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPostProcessorGui"));
|
||||
|
|
|
@ -17,17 +17,15 @@ public class JmeterLoggerAppender extends UnsynchronizedAppenderBase<ILoggingEve
|
|||
if (logger == null) {
|
||||
logger = new LinkedHashMap<>();
|
||||
}
|
||||
if (event.getLevel().levelStr.equals(LogUtil.INFO)) {
|
||||
StringBuffer message = new StringBuffer();
|
||||
message.append(DateUtils.getTimeStr(event.getTimeStamp())).append(" ")
|
||||
.append(event.getLevel()).append(" ")
|
||||
.append(event.getThreadName()).append(" ")
|
||||
.append(event.getFormattedMessage()).append("\n");
|
||||
if (logger.containsKey(event.getTimeStamp())) {
|
||||
logger.get(event.getTimeStamp()).append(message);
|
||||
} else {
|
||||
logger.put(event.getTimeStamp(), message);
|
||||
}
|
||||
StringBuffer message = new StringBuffer();
|
||||
message.append(DateUtils.getTimeStr(event.getTimeStamp())).append(" ")
|
||||
.append(event.getLevel()).append(" ")
|
||||
.append(event.getThreadName()).append(" ")
|
||||
.append(event.getFormattedMessage()).append("\n");
|
||||
if (logger.containsKey(event.getTimeStamp())) {
|
||||
logger.get(event.getTimeStamp()).append(message);
|
||||
} else {
|
||||
logger.put(event.getTimeStamp(), message);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
|
|
|
@ -886,11 +886,11 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
copySetRes(hashTree) {
|
||||
resetResourceId(hashTree) {
|
||||
hashTree.forEach(item => {
|
||||
item.resourceId = getUUID();
|
||||
if (item.hashTree && item.hashTree.length > 0) {
|
||||
this.copySetRes(item.hashTree);
|
||||
this.resetResourceId(item.hashTree);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -901,7 +901,7 @@ export default {
|
|||
let obj = JSON.parse(JSON.stringify(row));
|
||||
obj.resourceId = getUUID();
|
||||
if (obj.hashTree && obj.hashTree.length > 0) {
|
||||
this.copySetRes(obj.hashTree);
|
||||
this.resetResourceId(obj.hashTree);
|
||||
}
|
||||
if (obj.name) {
|
||||
obj.name = obj.name + '_copy';
|
||||
|
@ -1133,6 +1133,10 @@ export default {
|
|||
this.sort();
|
||||
})
|
||||
}
|
||||
// 初始化resourceId
|
||||
if (this.scenarioDefinition) {
|
||||
this.resetResourceId(this.scenarioDefinition);
|
||||
}
|
||||
},
|
||||
setParameter() {
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
|
|
Loading…
Reference in New Issue