From c0f313de9c80e87218d2efb4a82a312d431970a5 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 1 Nov 2024 14:51:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=BA=E6=99=AFID=E5=88=B0=20JMeter=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=8F=98=E9=87=8F=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1016499 --user=赵勇 支持通过脚本获取场景的唯一id https://www.tapd.cn/55049933/s/1604337 --- .../api/parser/jmeter/JmeterTestElementParser.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/JmeterTestElementParser.java b/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/JmeterTestElementParser.java index ab4d5afd22..4583cc7d02 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/JmeterTestElementParser.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/JmeterTestElementParser.java @@ -53,6 +53,14 @@ public class JmeterTestElementParser implements TestElementParser { this.config = config; HashTree hashTree = new ListedHashTree(); TestPlan testPlan = getPlan(); + + // 添加场景ID到 JMeter 测试计划变量中 + if (msTestElement instanceof MsScenario msScenario) { + Arguments arguments = new Arguments(); + arguments.addArgument("ms_scenario_id", msScenario.getResourceId()); + testPlan.setUserDefinedVariables(arguments); + } + name = msTestElement.getName(); final HashTree testPlanTree = hashTree.add(testPlan); final HashTree groupTree = testPlanTree.add(getThreadGroup(msTestElement));